Annotation of elwix/build_tools.sh, revision 1.5.2.3
1.2 misho 1: #!/bin/sh
2: #
3: # ELWIX build script for tools
4: #
5: # (C) AITNET ltd - Sofia/Bulgaria <office@aitnet.org>
6: # by Michael Pounov <misho@elwix.org>
7: #
1.5.2.3 ! misho 8: # $Id: build_tools.sh,v 1.5.2.2 2013/07/21 16:50:58 misho Exp $
1.2 misho 9: #
10:
11: [ -r ./config/rc.elwix ] && . ./config/rc.elwix
12: if [ X"${ELWIX_IS_CONFIGURED}" != X"YES" ]; then
13: echo
14: echo "ELWIX project is not configured !?!"
15: echo
16: exit 1
17: fi
18: V=${VERSION}
19: [ -r ${CENV} ] && . ${CENV}
20: unset INSTALL
21: unset VERSION
22: VERSION="$V"
23:
1.5.2.1 misho 24:
1.2 misho 25: if [ ! -d $BSDSRC ]; then
26: echo
27: echo "ELWIX project is not configured - missing BSD sources !?!"
28: echo
29: exit 1
30: fi
31:
32: if [ ! -d $DEST ]; then
33: echo
34: echo "ELWIX project is not configured - missing Dest directory !?!"
35: echo
36: exit 1
37: fi
38:
39: clean_tools()
40: {
41: echo "+++ Clean ELWIX FreeBSD tools ..."
42:
43: rm -rf ${WORLD}/usr/local
44: install -d ${WORLD}/usr/local
45: install -d ${WORLD}/usr/local/bin
46: install -d ${WORLD}/usr/local/include
47: install -d ${WORLD}/usr/local/lib
48: install -d ${WORLD}/usr/local/libdata
49: install -d ${WORLD}/usr/local/sbin
50:
51: }
52:
53: clean_bootstrap()
54: {
55: echo "+++ Clean ELWIX pkgsrc bootstrap tools ..."
56:
1.5.2.1 misho 57: rm -Rf ${WORLD}/usr/pkgsrc/bootstrap/work
1.2 misho 58: rm -f /elwix ${WORLD}/usr/pkgsrc
1.5.2.1 misho 59: rm -Rf ${WORLD}/elwix
1.2 misho 60: install -d ${WORLD}/elwix
61: ln -sf ${WORLD}/elwix /elwix
62: ln -sf ${PKGSRC} ${WORLD}/usr/pkgsrc
63:
64: install -d ${PKGDIR}
65: install -d ${PKGDIR}/db
66: install -d ${PKGDIR}/etc
67: }
68:
1.5.2.1 misho 69: compile_deps()
70: {
71: echo "+++ Compile ELWIX programs bootstrap tools ..."
72: if [ -d tools -a -f tools/Makefile ]; then
73: cd tools
74: make cleandepend
75: make clean
76: make obj
77: make
78: make install
79: cd -
80: fi
81: }
82:
1.2 misho 83: compile_bootstrap()
84: {
85: echo "+++ Compile ELWIX pkgsrc bootstrap tools ..."
86: if [ ! -d ${WORLD}/usr/pkgsrc/bootstrap/work ]; then
87: cd ${WORLD}/usr/pkgsrc/bootstrap
1.5.2.1 misho 88: ./cleanup --prefix /elwix/pkg --pkgdbdir /elwix/pkg/db
1.2 misho 89: ./bootstrap --prefix /elwix/pkg --pkgdbdir /elwix/pkg/db
90: cd -
91: else
92: echo " Skip bootstrap pkgsrc - already inited pkgsrc"
93: fi
94:
95: cat >>/elwix/pkg/etc/mk.conf << _EOF
96:
97: .if defined(USE_CROSS_COMPILE) && !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
98: USE_DESTDIR= yes
99: DEPENDS_TARGET= package-install
100:
101: TOOLDIR= ${CROSSTOOLDIR}
102: CROSS_DESTDIR= ${WORLD}
103:
104: TARGET= ${TARGET}
105: TARGET_ARCH= ${TARGET_ARCH}
106: MACHINE_PLATFORM= FreeBSD-${PLATFORM}-${TARGET_ARCH}
107: MACHINE_GNU_PLATFORM= ${TARGET_ARCH}-elwix-freebsd
108:
109: PKGSRC_COMPILER= gcc
110: USE_PKGSRC_GCC= no
111: USE_NATIVE_GCC= yes
112:
113: .endif # end cross-compilation settings
114: _EOF
115: }
116:
117: compile_fbsdtools()
118: {
119: echo "+++ Compile ELWIX FreeBSD tools ..."
120:
1.3 misho 121: cd $CROSS_FT_VIMAGE
1.2 misho 122: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
123: clean DESTDIR=${WORLD}
124: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
125: DESTDIR=${WORLD}
126: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
127: install DESTDIR=${WORLD}
128: cd -
129:
1.3 misho 130: cd $CROSS_FT_ATH
1.2 misho 131: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
132: clean DESTDIR=${WORLD}
133: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
134: DESTDIR=${WORLD}
135: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1.3 misho 136: install DESTDIR=${WORLD}
1.2 misho 137: cd -
138:
1.3 misho 139: cd $CROSS_FT_IPW
1.2 misho 140: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
141: clean DESTDIR=${WORLD}
142: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
143: DESTDIR=${WORLD}
144: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
145: install DESTDIR=${WORLD}/usr/local/bin
146: cd -
147:
1.3 misho 148: cd $CROSS_FT_IWI
1.2 misho 149: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
150: clean DESTDIR=${WORLD}
151: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
152: DESTDIR=${WORLD}
153: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
1.3 misho 154: install DESTDIR=${WORLD}/usr/local/bin
1.2 misho 155: cd -
156:
1.3 misho 157: cd $CROSS_FT_MWL
1.2 misho 158: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
159: clean DESTDIR=${WORLD}
160: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
161: DESTDIR=${WORLD}
162: env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
163: install DESTDIR=${WORLD}
164: cd -
165:
1.5.2.2 misho 166: # cd $CROSS_FT_NET80211
167: # env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
168: # clean DESTDIR=${WORLD}
169: # env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
170: # DESTDIR=${WORLD}
171: # env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
172: # install DESTDIR=${WORLD}
173: # cd -
1.2 misho 174:
175: # cd $CROSS_FT_WTAP
176: # env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
177: # clean DESTDIR=${WORLD}
178: # env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
179: # DESTDIR=${WORLD}
180: # env MAKEOBJDIRPREFIX=${BSDOBJ} make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
181: # install DESTDIR=${WORLD}
182: # cd -
183: }
184:
185: compile_files()
186: {
187: cd files
188: env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
189: TARGET_ARCH=${TARGET_ARCH} clean DESTDIR=${WORLD}
190: env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
191: TARGET_ARCH=${TARGET_ARCH} obj depend DESTDIR=${WORLD}
192: env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
193: TARGET_ARCH=${TARGET_ARCH} DESTDIR=${WORLD}
194: env MAKEOBJDIRPREFIX=${BSDOBJ} BSDSRC=${BSDSRC} make TARGET=${TARGET} \
195: TARGET_ARCH=${TARGET_ARCH} install DESTDIR=${WORLD}
196: cd -
197:
1.5.2.3 ! misho 198: strip -s ${WORLD}/usr/bin/csh
1.2 misho 199: }
200:
201: compile_tools()
202: {
203: echo "+++ Compile ELWIX Cross ..."
204:
205: cd $CROSS_AXL
206: ${AXL_CFG}
207: ${CBUILD} clean
208: ${CBUILD}
209: ${CBUILD} install
210: cd -
211:
1.3 misho 212: cd $CROSS_ELWIX
213: ${ELWIX_CFG}
1.2 misho 214: ${CBUILD} clean
215: ${CBUILD}
216: ${CBUILD} install
217: cd -
218:
219: cd $CROSS_AITIO
220: ${AITIO_CFG}
221: ${CBUILD} clean
222: ${CBUILD}
223: ${CBUILD} install
224: cd -
225:
226: cd $CROSS_AITCFG
227: ${AITCFG_CFG}
228: ${CBUILD} clean
229: ${CBUILD}
230: ${CBUILD} install
231: cd -
232:
1.5.2.1 misho 233: cd $CROSS_AITSCHED
234: ${AITSCHED_CFG}
1.2 misho 235: ${CBUILD} clean
236: ${CBUILD}
237: ${CBUILD} install
238: cd -
239:
1.5.2.1 misho 240: cd $CROSS_AITRPC
241: ${AITRPC_CFG}
1.2 misho 242: ${CBUILD} clean
243: ${CBUILD}
244: ${CBUILD} install
245: cd -
246:
247: cd $CROSS_AITWWW
248: ${AITWWW_CFG}
249: ${CBUILD} clean
250: ${CBUILD}
251: ${CBUILD} install
252: cd -
253:
254: cd $CROSS_AITPELCO
255: ${AITPELCO_CFG}
256: ${CBUILD} clean
257: ${CBUILD}
258: ${CBUILD} install
259: cd -
260:
261: cd $CROSS_AITSYNC
262: ${AITSYNC_CFG}
263: ${CBUILD} clean
264: ${CBUILD}
265: ${CBUILD} install
266: cd -
267:
268: cd $CROSS_AITCLI
269: ${AITCLI_CFG}
270: ${CBUILD} clean
271: ${CBUILD}
272: ${CBUILD} install
273: cd -
274:
275: cd $CROSS_AITMQTT
276: ${AITMQTT_CFG}
277: ${CBUILD} clean
278: ${CBUILD}
279: ${CBUILD} install
280: cd -
281:
282: cd $CROSS_EMBEDTOOLS
283: ${EMBEDTOOLS_CFG}
284: ${CBUILD} clean
285: ${CBUILD}
286: ${CBUILD} install
287: cd -
288:
289: cd $CROSS_ANSH
290: ${ANSH_CFG}
291: ${CBUILD} clean
292: ${CBUILD}
293: ${CBUILD} install
294: cd -
295:
296: cd $CROSS_MQTT
297: ${MQTT_CFG}
298: ${CBUILD} clean
299: ${CBUILD}
300: ${CBUILD} install
301: cd -
302:
1.5.2.1 misho 303: cd $CROSS_WIFINATOR
304: ${WIFINATOR_CFG}
305: ${CBUILD} clean
306: ${CBUILD}
307: ${CBUILD} install
308: cd -
1.2 misho 309: }
310:
1.5.2.3 ! misho 311: install_tools()
! 312: {
! 313: LIBS="${ROMFS_USR2}/lib"
! 314: LIBEXEC="${ROMFS_USR2}/libexec"
! 315: BIN="${ROMFS_USR2}/bin"
! 316: SBIN="${ROMFS_USR2}/sbin"
! 317: ETC="${ROMFS_USR2}/etc"
! 318:
! 319: echo "+++ Install ELWIX RomFS secondary firmware ..."
! 320:
! 321: StripFiles \*.so\* ${PKG}/lib
! 322: InstallFiles \*.so\* ${PKG}/lib $LIBS
! 323: StripFiles \* ${PKG}/libexec
! 324: InstallFiles \* ${PKG}/libexec $LIBEXEC
! 325: StripFiles \* ${PKG}/bin
! 326: InstallFiles \* ${PKG}/bin $BIN
! 327: StripFiles \* ${PKG}/sbin
! 328: InstallFiles \* ${PKG}/sbin $SBIN
! 329:
! 330: InstallFiles \* ${PKG}/etc $ETC
! 331:
! 332: chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
! 333: }
! 334:
! 335: build_tools()
! 336: {
! 337: echo "+++ Build ELWIX core firmware image ..."
! 338:
! 339: cd ${WORLD}/usr/local
! 340: pax -w -z -v -f${REL}/${LOCALFS_IMG} .
! 341: cd -
! 342: }
! 343:
1.2 misho 344: ### main()
345: if ! SnitVer ${WORLD}/elwix/elwix.ver; then
1.5.2.1 misho 346: compile_deps || exit 1
1.2 misho 347: clean_bootstrap
1.5.2.1 misho 348: compile_bootstrap || exit 1
349:
350: echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/elwix/elwix.ver
1.2 misho 351: else
352: echo "Skipped ELWIX bootstrap pkgsrc tools build ..."
353: fi
354:
355: if ! SnitVer ${WORLD}/usr/local/elwix.ver; then
356: clean_tools
357: compile_fbsdtools
358: compile_files
359: compile_tools
1.5.2.3 ! misho 360: build_tools
1.5.2.1 misho 361:
362: echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/usr/local/elwix.ver
1.2 misho 363: else
364: echo "Skipped ELWIX tools build ..."
365: fi
366:
367: echo "+++ Complete build ELWIX tools"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>