Annotation of elwix/build_tools.sh, revision 1.6.6.8
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.8 ! misho 8: # $Id: build_tools.sh,v 1.6.6.7 2014/01/21 16:33:40 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}
1.6.6.5 misho 19: #[ -r ${CENV} ] && . ${CENV}
1.2 misho 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!
1.6.6.4 misho 25: X_TARGET_CPUTYPE="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.6.6.7 misho 124: ${CBUILD} DESTDIR=${WORLD} clean
125: ${CBUILD} DESTDIR=${WORLD}
126: ${CBUILD} DESTDIR=${WORLD} install
1.2 misho 127: cd -
128:
1.3 misho 129: cd $CROSS_FT_ATH
1.6.6.7 misho 130: ${CBUILD} DESTDIR=${WORLD} clean
131: ${CBUILD} DESTDIR=${WORLD}
132: ${CBUILD} DESTDIR=${WORLD} install
1.2 misho 133: cd -
134:
1.3 misho 135: cd $CROSS_FT_IPW
1.6.6.7 misho 136: ${CBUILD} DESTDIR=${WORLD} clean
137: ${CBUILD} DESTDIR=${WORLD}
138: ${CBUILD} DESTDIR=${WORLD}/usr/local/bin install
1.2 misho 139: cd -
140:
1.3 misho 141: cd $CROSS_FT_IWI
1.6.6.7 misho 142: ${CBUILD} DESTDIR=${WORLD} clean
143: ${CBUILD} DESTDIR=${WORLD}
144: ${CBUILD} DESTDIR=${WORLD}/usr/local/bin install
1.2 misho 145: cd -
146:
1.3 misho 147: cd $CROSS_FT_MWL
1.6.6.7 misho 148: ${CBUILD} DESTDIR=${WORLD} clean
149: ${CBUILD} DESTDIR=${WORLD}
150: ${CBUILD} DESTDIR=${WORLD} install
1.2 misho 151: cd -
152: }
153:
154: compile_files()
155: {
156: cd files
1.6.6.7 misho 157: ${CBUILD} DESTDIR=${WORLD} clean
158: ${CBUILD} DESTDIR=${WORLD} obj
159: ${CBUILD} DESTDIR=${WORLD} depend
160: ${CBUILD} DESTDIR=${WORLD}
161: ${CBUILD} DESTDIR=${WORLD} install
1.2 misho 162: cd -
163: }
164:
165: compile_tools()
166: {
167: echo "+++ Compile ELWIX Cross ..."
168:
1.6.6.7 misho 169: # cd $CROSS_AXL
170: # ${AXL_CFG}
171: # ${CBUILD} clean
172: # ${CBUILD}
173: # ${CBUILD} install
174: # cd -
175:
176: cd $CROSS_ELWIX
177: ${ELWIX_CFG}
1.2 misho 178: ${CBUILD} clean
179: ${CBUILD}
180: ${CBUILD} install
181: cd -
182:
1.6.6.7 misho 183: cd $CROSS_AITSCHED
184: ${AITSCHED_CFG}
1.2 misho 185: ${CBUILD} clean
186: ${CBUILD}
187: ${CBUILD} install
188: cd -
189:
190: cd $CROSS_AITIO
191: ${AITIO_CFG}
192: ${CBUILD} clean
193: ${CBUILD}
194: ${CBUILD} install
195: cd -
196:
197: cd $CROSS_AITCFG
198: ${AITCFG_CFG}
199: ${CBUILD} clean
200: ${CBUILD}
201: ${CBUILD} install
202: cd -
203:
1.6 misho 204: cd $CROSS_AITRPC
205: ${AITRPC_CFG}
1.2 misho 206: ${CBUILD} clean
207: ${CBUILD}
208: ${CBUILD} install
209: cd -
210:
211: cd $CROSS_AITWWW
212: ${AITWWW_CFG}
213: ${CBUILD} clean
214: ${CBUILD}
215: ${CBUILD} install
216: cd -
217:
218: cd $CROSS_AITPELCO
219: ${AITPELCO_CFG}
220: ${CBUILD} clean
221: ${CBUILD}
222: ${CBUILD} install
223: cd -
224:
225: cd $CROSS_AITSYNC
226: ${AITSYNC_CFG}
227: ${CBUILD} clean
228: ${CBUILD}
229: ${CBUILD} install
230: cd -
231:
232: cd $CROSS_AITCLI
233: ${AITCLI_CFG}
234: ${CBUILD} clean
235: ${CBUILD}
236: ${CBUILD} install
237: cd -
238:
239: cd $CROSS_AITMQTT
240: ${AITMQTT_CFG}
241: ${CBUILD} clean
242: ${CBUILD}
243: ${CBUILD} install
244: cd -
245:
246: cd $CROSS_EMBEDTOOLS
247: ${EMBEDTOOLS_CFG}
248: ${CBUILD} clean
249: ${CBUILD}
250: ${CBUILD} install
251: cd -
252:
253: cd $CROSS_ANSH
254: ${ANSH_CFG}
255: ${CBUILD} clean
256: ${CBUILD}
257: ${CBUILD} install
258: cd -
259:
260: cd $CROSS_MQTT
261: ${MQTT_CFG}
262: ${CBUILD} clean
263: ${CBUILD}
264: ${CBUILD} install
265: cd -
266:
1.6 misho 267: cd $CROSS_WIFINATOR
268: ${WIFINATOR_CFG}
269: ${CBUILD} clean
270: ${CBUILD}
271: ${CBUILD} install
272: cd -
1.6.6.8 ! misho 273:
! 274: cd $CROSS_TFTPD
! 275: ${TFTPD_CFG}
! 276: ${CBUILD} clean
! 277: ${CBUILD}
! 278: ${CBUILD} install
! 279: cd -
1.6 misho 280: }
281:
282: install_tools()
283: {
284: LIBS="${ROMFS_USR2}/lib"
285: LIBEXEC="${ROMFS_USR2}/libexec"
286: BIN="${ROMFS_USR2}/bin"
287: SBIN="${ROMFS_USR2}/sbin"
288: ETC="${ROMFS_USR2}/etc"
289:
290: echo "+++ Install ELWIX RomFS secondary firmware ..."
291:
292: StripFiles \*.so\* ${PKG}/lib
293: InstallFiles \*.so\* ${PKG}/lib $LIBS
294: StripFiles \* ${PKG}/libexec
295: InstallFiles \* ${PKG}/libexec $LIBEXEC
296: StripFiles \* ${PKG}/bin
297: InstallFiles \* ${PKG}/bin $BIN
298: StripFiles \* ${PKG}/sbin
299: InstallFiles \* ${PKG}/sbin $SBIN
300:
301: InstallFiles \* ${PKG}/etc $ETC
302:
303: chown -R root:wheel $SBIN $BIN $LIBDATA $LIBEXEC $LIBS
304: }
305:
306: build_tools()
307: {
308: echo "+++ Build ELWIX core firmware image ..."
309:
310: cd ${WORLD}/usr/local
311: pax -w -z -v -f${REL}/${LOCALFS_IMG} .
312: cd -
1.2 misho 313: }
314:
315: ### main()
1.6.6.6 misho 316: compile_deps || exit 1
317:
318: #if ! SnitVer ${WORLD}/elwix/elwix.ver; then
1.6.6.1 misho 319: # clean_bootstrap
320: # compile_bootstrap || exit 1
1.6.6.6 misho 321: #
322: # echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/elwix/elwix.ver
323: #else
324: # echo "Skipped ELWIX bootstrap pkgsrc tools build ..."
325: #fi
1.2 misho 326:
327: if ! SnitVer ${WORLD}/usr/local/elwix.ver; then
328: clean_tools
1.6.6.6 misho 329:
1.2 misho 330: compile_fbsdtools
331: compile_files
332: compile_tools
1.6.6.6 misho 333:
1.6 misho 334: build_tools
335:
336: echo "ELWIX Platform:${PLATFORM} Version:${VERSION} TargetArch:${TARGET_ARCH}" >${WORLD}/usr/local/elwix.ver
1.2 misho 337: else
338: echo "Skipped ELWIX tools build ..."
339: fi
340:
341: echo "+++ Complete build ELWIX tools"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>