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