Tue Apr 28 21:08:34 2015 UTC ()
Ensure the wrapper directories are created before WRAPPER_TARGETS.


(jperkin)
diff -r1.23 -r1.24 pkgsrc/mk/cwrappers.mk

cvs diff -r1.23 -r1.24 pkgsrc/mk/cwrappers.mk (switch to unified diff)

--- pkgsrc/mk/cwrappers.mk 2015/04/27 19:59:07 1.23
+++ pkgsrc/mk/cwrappers.mk 2015/04/28 21:08:34 1.24
@@ -1,156 +1,158 @@ @@ -1,156 +1,158 @@
1# $NetBSD: cwrappers.mk,v 1.23 2015/04/27 19:59:07 jperkin Exp $ 1# $NetBSD: cwrappers.mk,v 1.24 2015/04/28 21:08:34 jperkin Exp $
2# 2#
3# This Makefile fragment implements integration of pkgtools/cwrappers. 3# This Makefile fragment implements integration of pkgtools/cwrappers.
4 4
5.include "../../mk/buildlink3/bsd.buildlink3.mk" 5.include "../../mk/buildlink3/bsd.buildlink3.mk"
6 6
7BUILD_DEPENDS+= cwrappers>=20150314:../../pkgtools/cwrappers 7BUILD_DEPENDS+= cwrappers>=20150314:../../pkgtools/cwrappers
8 8
9# Public variables used by pkgsrc infrastructure and packages. 9# Public variables used by pkgsrc infrastructure and packages.
10WRAPPER_DIR= ${WRKDIR}/.cwrapper 10WRAPPER_DIR= ${WRKDIR}/.cwrapper
11WRAPPER_BINDIR= ${WRAPPER_DIR}/bin 11WRAPPER_BINDIR= ${WRAPPER_DIR}/bin
12 12
13# XXX This should be PREFIX, but USE_CROSSBASE overrides it. 13# XXX This should be PREFIX, but USE_CROSSBASE overrides it.
14CWRAPPERS_SRC_DIR= ${LOCALBASE}/libexec/cwrappers 14CWRAPPERS_SRC_DIR= ${LOCALBASE}/libexec/cwrappers
15CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config 15CWRAPPERS_CONFIG_DIR= ${WRKDIR}/.cwrapper/config
16CONFIGURE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} 16CONFIGURE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
17MAKE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} 17MAKE_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
18ALL_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR} 18ALL_ENV+= CWRAPPERS_CONFIG_DIR=${CWRAPPERS_CONFIG_DIR}
19 19
20# TODO: Fix direct calls to CC and LIBTOOL to provide correct environment. 20# TODO: Fix direct calls to CC and LIBTOOL to provide correct environment.
21.export CWRAPPERS_CONFIG_DIR 21.export CWRAPPERS_CONFIG_DIR
22 22
23CWRAPPERS_CONFIG.as= as 23CWRAPPERS_CONFIG.as= as
24CWRAPPERS_CONFIG.cc= cc 24CWRAPPERS_CONFIG.cc= cc
25CWRAPPERS_CONFIG.cxx= c++ 25CWRAPPERS_CONFIG.cxx= c++
26CWRAPPERS_CONFIG.cpp= cpp 26CWRAPPERS_CONFIG.cpp= cpp
27CWRAPPERS_CONFIG.f77= f77 27CWRAPPERS_CONFIG.f77= f77
28CWRAPPERS_CONFIG.imake= imake 28CWRAPPERS_CONFIG.imake= imake
29CWRAPPERS_CONFIG.ld= ld 29CWRAPPERS_CONFIG.ld= ld
30CWRAPPERS_CONFIG.libtool= libtool 30CWRAPPERS_CONFIG.libtool= libtool
31CWRAPPERS_CONFIG.shlibtool= shlibtool 31CWRAPPERS_CONFIG.shlibtool= shlibtool
32 32
33CWRAPPERS_ALIASES.as= as 33CWRAPPERS_ALIASES.as= as
34CWRAPPERS_ALIASES.cc= cc gcc clang 34CWRAPPERS_ALIASES.cc= cc gcc clang
35CWRAPPERS_ALIASES.cxx= c++ g++ cxx clang++ 35CWRAPPERS_ALIASES.cxx= c++ g++ cxx clang++
36CWRAPPERS_ALIASES.cpp= cpp clang-cpp 36CWRAPPERS_ALIASES.cpp= cpp clang-cpp
37CWRAPPERS_ALIASES.f77= f77 g77 gfortran 37CWRAPPERS_ALIASES.f77= f77 g77 gfortran
38CWRAPPERS_ALIASES.imake= imake 38CWRAPPERS_ALIASES.imake= imake
39CWRAPPERS_ALIASES.ld= ld 39CWRAPPERS_ALIASES.ld= ld
40CWRAPPERS_ALIASES.libtool= libtool 40CWRAPPERS_ALIASES.libtool= libtool
41CWRAPPERS_ALIASES.shlibtool= shlibtool 41CWRAPPERS_ALIASES.shlibtool= shlibtool
42 42
43CWRAPPERS_WRAPPEE.as= ${AS:Ufalse} 43CWRAPPERS_WRAPPEE.as= ${AS:Ufalse}
44CWRAPPERS_WRAPPEE.cxx= ${PKG_CXX:Ufalse} 44CWRAPPERS_WRAPPEE.cxx= ${PKG_CXX:Ufalse}
45CWRAPPERS_WRAPPEE.cc= ${PKG_CC:Ufalse} 45CWRAPPERS_WRAPPEE.cc= ${PKG_CC:Ufalse}
46CWRAPPERS_WRAPPEE.cpp= ${PKG_CPP:Ufalse} 46CWRAPPERS_WRAPPEE.cpp= ${PKG_CPP:Ufalse}
47CWRAPPERS_WRAPPEE.f77= ${PKG_FC:Ufalse} 47CWRAPPERS_WRAPPEE.f77= ${PKG_FC:Ufalse}
48CWRAPPERS_WRAPPEE.imake= ${TOOLS_PATH.imake:Ufalse} 48CWRAPPERS_WRAPPEE.imake= ${TOOLS_PATH.imake:Ufalse}
49CWRAPPERS_WRAPPEE.ld= ${LD:Ufalse} 49CWRAPPERS_WRAPPEE.ld= ${LD:Ufalse}
50CWRAPPERS_WRAPPEE.libtool= ${PKG_LIBTOOL:Ufalse} 50CWRAPPERS_WRAPPEE.libtool= ${PKG_LIBTOOL:Ufalse}
51CWRAPPERS_WRAPPEE.shlibtool= ${PKG_SHLIBTOOL:Ufalse} 51CWRAPPERS_WRAPPEE.shlibtool= ${PKG_SHLIBTOOL:Ufalse}
52 52
53# TODO: Find and fix packages depending on the implicit include path. 53# TODO: Find and fix packages depending on the implicit include path.
54CWRAPPERS_APPEND.cc+= -I${PREFIX}/include 54CWRAPPERS_APPEND.cc+= -I${PREFIX}/include
55CWRAPPERS_APPEND.cxx+= -I${PREFIX}/include 55CWRAPPERS_APPEND.cxx+= -I${PREFIX}/include
56CWRAPPERS_APPEND.cpp+= -I${PREFIX}/include 56CWRAPPERS_APPEND.cpp+= -I${PREFIX}/include
57 57
58.if defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake) 58.if defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake)
59CWRAPPERS_TRANSFORM.imake+= I:${PREFIX}/lib/X11/config:${PREFIX}/lib/X11/config 59CWRAPPERS_TRANSFORM.imake+= I:${PREFIX}/lib/X11/config:${PREFIX}/lib/X11/config
60CWRAPPERS_APPEND.imake+= ${IMAKEOPTS} 60CWRAPPERS_APPEND.imake+= ${IMAKEOPTS}
61.endif 61.endif
62 62
63.PHONY: generate-cwrappers 63.PHONY: generate-cwrappers
64 64
65.for _target_ in ${WRAPPER_TARGETS} 65.for _target_ in ${WRAPPER_TARGETS}
66generate-cwrappers: ${_target_} 66generate-cwrappers: ${_target_}
67.endfor 67.endfor
68 68
69generate-cwrappers: 69generate-cwrappers:
70 ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${WRAPPER_BINDIR} 
71.for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool 70.for wrappee in as cxx cc cpp f77 imake ld libtool shlibtool
72 ${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 71 ${RUN}echo worklog=${WRKLOG:Q} > ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
73 ${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 72 ${RUN}echo wrksrc=${WRKSRC:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
74 ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac 73 ${RUN}case ${wrappee} in *libtool) ;; *) echo path=${_PATH_ORIG:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}};; esac
75 ${RUN}echo exec_path=${WRAPPER_BINDIR}/${CWRAPPERS_ALIASES.${wrappee}:[1]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 74 ${RUN}echo exec_path=${WRAPPER_BINDIR}/${CWRAPPERS_ALIASES.${wrappee}:[1]} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
76 ${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 75 ${RUN}echo exec=${CWRAPPERS_WRAPPEE.${wrappee}:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
77. for cmd in ${WRAPPER_REORDER_CMDS} 76. for cmd in ${WRAPPER_REORDER_CMDS}
78 ${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 77 ${RUN}echo reorder=${cmd:S/^reorder://:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
79. endfor 78. endfor
80. for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM} 79. for cmd in ${CWRAPPERS_TRANSFORM.${wrappee}} ${_CWRAPPERS_TRANSFORM}
81 ${RUN}echo transform=${cmd:u:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 80 ${RUN}echo transform=${cmd:u:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
82. endfor 81. endfor
83. for cmd in ${CWRAPPERS_APPEND.${wrappee}:U} 82. for cmd in ${CWRAPPERS_APPEND.${wrappee}:U}
84 ${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 83 ${RUN}echo append=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
85. endfor 84. endfor
86. for cmd in ${_CWRAPPERS_UNWRAP} 85. for cmd in ${_CWRAPPERS_UNWRAP}
87 ${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}} 86 ${RUN}echo unwrap=${cmd:Q} >> ${CWRAPPERS_CONFIG_DIR}/${CWRAPPERS_CONFIG.${wrappee}}
88. endfor 87. endfor
89. for alias in ${CWRAPPERS_ALIASES.${wrappee}} 88. for alias in ${CWRAPPERS_ALIASES.${wrappee}}
90 ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${WRAPPER_BINDIR}/${alias} 89 ${RUN}ln -s ${CWRAPPERS_SRC_DIR}/${CWRAPPERS_CONFIG.${wrappee}}-wrapper ${WRAPPER_BINDIR}/${alias}
91. endfor 90. endfor
92.endfor 91.endfor
93 92
94.if defined(USE_LIBTOOL) 93.if defined(USE_LIBTOOL)
95_LIBTOOL= ${WRAPPER_BINDIR}/libtool 94_LIBTOOL= ${WRAPPER_BINDIR}/libtool
96_SHLIBTOOL= ${WRAPPER_BINDIR}/shlibtool 95_SHLIBTOOL= ${WRAPPER_BINDIR}/shlibtool
97.endif 96.endif
98PREPEND_PATH+= ${WRAPPER_BINDIR} 97PREPEND_PATH+= ${WRAPPER_BINDIR}
99 98
100_COOKIE.wrapper= ${WRKDIR}/.wrapper_done 99_COOKIE.wrapper= ${WRKDIR}/.wrapper_done
101 100
102.PHONY: wrapper 101.PHONY: wrapper
103.if !target(wrapper) 102.if !target(wrapper)
104. if exists(${_COOKIE.wrapper}) 103. if exists(${_COOKIE.wrapper})
105wrapper: 104wrapper:
106 @${DO_NADA} 105 @${DO_NADA}
107. elif defined(_PKGSRC_BARRIER) 106. elif defined(_PKGSRC_BARRIER)
108wrapper: check-vulnerable patch acquire-wrapper-lock ${_COOKIE.wrapper} release-wrapper-lock 107wrapper: check-vulnerable patch acquire-wrapper-lock ${_COOKIE.wrapper} release-wrapper-lock
109. else 108. else
110wrapper: barrier 109wrapper: barrier
111. endif 110. endif
112.endif 111.endif
113 112
114.PHONY: acquire-wrapper-lock release-wrapper-lock 113.PHONY: acquire-wrapper-lock release-wrapper-lock
115acquire-wrapper-lock: acquire-lock 114acquire-wrapper-lock: acquire-lock
116release-wrapper-lock: release-lock 115release-wrapper-lock: release-lock
117 116
118.if exists(${_COOKIE.wrapper}) 117.if exists(${_COOKIE.wrapper})
119${_COOKIE.wrapper}: 118${_COOKIE.wrapper}:
120 @${DO_NADA} 119 @${DO_NADA}
121.else 120.else
122${_COOKIE.wrapper}: real-wrapper 121${_COOKIE.wrapper}: real-wrapper
123.endif 122.endif
124 123
125.PHONY: real-wrapper 124.PHONY: real-wrapper
126real-wrapper: wrapper-message wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check 125real-wrapper: wrapper-message wrapper-dirs wrapper-vars pre-wrapper do-wrapper post-wrapper wrapper-cookie error-check
127 126
128.PHONY: wrapper-message 127.PHONY: wrapper-message
129 
130wrapper-message: 128wrapper-message:
131 @${PHASE_MSG} "Creating toolchain wrappers for ${PKGNAME}" 129 @${PHASE_MSG} "Creating toolchain wrappers for ${PKGNAME}"
132 130
 131.PHONY: wrapper-dirs
 132wrapper-dirs:
 133 ${RUN}${MKDIR} ${CWRAPPERS_CONFIG_DIR} ${WRAPPER_BINDIR}
 134
133.PHONY: pre-wrapper do-wrapper post-wrapper 135.PHONY: pre-wrapper do-wrapper post-wrapper
134 136
135do-wrapper: generate-cwrappers 137do-wrapper: generate-cwrappers
136 138
137.if !target(do-wrapper) 139.if !target(do-wrapper)
138do-wrapper: 140do-wrapper:
139 @${DO_NADA} 141 @${DO_NADA}
140.endif 142.endif
141 143
142.if !target(pre-wrapper) 144.if !target(pre-wrapper)
143pre-wrapper: 145pre-wrapper:
144 @${DO_NADA} 146 @${DO_NADA}
145.endif 147.endif
146 148
147.if !target(post-wrapper) 149.if !target(post-wrapper)
148post-wrapper: 150post-wrapper:
149 @${DO_NADA} 151 @${DO_NADA}
150.endif 152.endif
151 153
152.PHONY: wrapper-cookie 154.PHONY: wrapper-cookie
153wrapper-cookie: 155wrapper-cookie:
154 ${RUN} [ ! -f ${_COOKIE.wrapper} ] 156 ${RUN} [ ! -f ${_COOKIE.wrapper} ]
155 ${RUN} ${MKDIR} ${_COOKIE.wrapper:H} 157 ${RUN} ${MKDIR} ${_COOKIE.wrapper:H}
156 ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.wrapper} 158 ${RUN} ${ECHO} ${PKGNAME} > ${_COOKIE.wrapper}