summaryrefslogtreecommitdiffhomepage
path: root/007.musl.full.build
blob: b18f91e014aab42bdff20b26d22b4afbea677ad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# . ./build.vars and set -o errexit are assumed.
#

# Order: no-complex, native

export lz_arch=${ARCH} lz_cflags_debug=-O2 lz_target=${TARGET};

if [ "${3}" = no-complex ]; then
	# Musl: build (no-complex)
	_install=install_no_complex;
	set_build_dir musl-${PKG_MUSL_VERSION}-${3} cross;
	if ! is_build_script_done fetch; then
		fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz	\
			${PKG_MUSL_SHA256SUM};
		[ ${ARG_NO_DOWNLOAD:-0} -eq 0 ] &&\
			rm_if_exists mmglue;
		fetch_git mmglue ${GITROOT}/mmglue;
		set_build_script_done fetch -extract;
	fi;
	if ! is_build_script_done extract; then
		rm_if_exists musl-${PKG_MUSL_VERSION};
		tar -xf musl-${PKG_MUSL_VERSION}.tar.gz;
		cp -R mmglue/* musl-${PKG_MUSL_VERSION}/;
		set_build_script_done extract -patch;
	fi;
	if ! is_build_script_done patch; then
		patch -b -d musl-${PKG_MUSL_VERSION} -p1	\
			< ${MIDIPIX_BUILD_PWD}/musl-${PKG_MUSL_VERSION}.local.patch;
		set_build_script_done patch -configure;
	fi;
elif [ "${3}" = native ]; then
	# Musl: build (full)
	_install=install;
	set_build_dir musl-${PKG_MUSL_VERSION} "${3}";
elif [ "${3}" = full ]; then
	# Musl: build (full)
	_install=install;
	set_build_dir musl-${PKG_MUSL_VERSION} cross;
fi;
if ! is_build_script_done configure; then
	rm_if_exists -m -c ${PKG_BUILD_DIR};
	env	lz_cflags_cmdline="${PKG_MUSL_CFLAGS_CONFIGURE_EXTRA}"	\
		lz_debug="yes"						\
	../lazy/lazy				\
		-a ${ARCH}			\
		-c gcc				\
		-f ${PREFIX_LVL}		\
		-n musl				\
		-p ../musl-${PKG_MUSL_VERSION}	\
		-t ${lz_target}			\
		-x config;
	set_build_script_done configure clean -build;
else
	cd ${PKG_BUILD_DIR};
fi;
if ! is_build_script_done clean; then
	make ${MAKEFLAGS} clean;
	set_build_script_done clean -build;
fi;
if ! is_build_script_done build; then
	./lazy	-e ${_install}			\
		-x build;
	[ "${3}" = native ] &&			\
		ln -sf ../lib/libc.so ${PREFIX_LVL}/bin/ldd;
	set_build_script_done build finish;
fi;

# vim:filetype=sh