Diff

Differences From Artifact [46b4f35d88]:

To Artifact [e99d758cfd]:


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

# Compile everything, all at once
idx=-1
for tryCompilerDir in "$(readlink -f ~/root/cross-compilers)" "$(readlink -f ~/devel/build-cc/TMP)"; do
	setup_cc="${tryCompilerDir}/setup-cc"

	platforms=(
		$("${setup_cc}" | tail -n +2)
	)

	for platform in "${platforms[@]}"; do
		idx=$[$idx + 1]
		(
			workdir="workdir-buildPrecompiled-${idx}-$(openssl rand 20 -hex)-platform-${platform}" || exit 1
			mkdir "${workdir}" || exit 1
			cd "${workdir}" || exit 1

			eval $("${setup_cc}" "${platform}")
			make_extra=(
				-f ../Makefile
				srcdir=..
				CC="${CC}"
			)


			case "${platform}" in
				*-musl-*|*-musl)
					make_extra=("${make_extra[@]}" FILED_EXTRA_LDFLAGS="-static")





					;;
			esac

















































			make "${make_extra[@]}"
		) &

	done
done

# Wait for that to get done
wait

# Rename the files into place
mkdir -p compiled
for binary in workdir-buildPrecompiled-*/filed; do
	platform="$(echo "${binary}" | sed 's@^.*-platform-@@;s@/.*$@@')"
	mv "${binary}" "compiled/filed-${version}-${platform}"
done





# Cleanup
rm -rf workdir-buildPrecompiled-*

exit 0







|


|
<
<
<
<
<
|
|
<
<
<
<
<
|
>
|
|
<
>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>












>
>
>
>





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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

# Compile everything, all at once
idx=-1
for tryCompilerDir in "$(readlink -f ~/root/cross-compilers)" "$(readlink -f ~/devel/build-cc/TMP)"; do
	setup_cc="${tryCompilerDir}/setup-cc"

	platforms=(
		$("${setup_cc}" 2>/dev/null | tail -n +2)
	)

	for platformBase in "${platforms[@]}"; do





		for platformAdditional in "" ".seccomp" ".fakechroot" ".internaldirhandle"; do
			case "${platformAdditional}" in





				*.seccomp|*.seccomp.*)
					# seccomp only works on i386/x86_64 for now
					case "${platformBase}" in
						i?86-*|x86_64-*)

							;;
						*)
							continue
							;;
					esac
					;;
			esac

			platform="${platformBase}${platformAdditional}"
			echo "-- ${platform}"

			idx=$[$idx + 1]
			(
				workdir="workdir-buildPrecompiled-${idx}-$(openssl rand 20 -hex)-platform-${platform}" || exit 1
				mkdir "${workdir}" || exit 1
				cd "${workdir}" || exit 1

				make_extra=(
					-f ../Makefile
					srcdir=..
				)

				extra_cflags=""
				while true; do
					case "${platform}" in
						*.seccomp|*.seccomp.*)
							platform="$(echo "${platform}" | sed 's@\.seccomp@@')"
							make_extra+=(FILED_DO_SECCOMP=1)
							;;
						*.fakechroot|*.fakechroot.*)
							platform="$(echo "${platform}" | sed 's@\.fakechroot@@')"
							extra_cflags="${extra_cflags} -DFILED_FAKE_CHROOT=1"
							;;
						*.internaldirhandle|*.internaldirhandle.*)
							platform="$(echo "${platform}" | sed 's@\.internaldirhandle@@')"
							extra_cflags="${extra_cflags} -DFILED_DONT_REDIRECT_DIRECTORIES=1"
							;;
						*)
							break
							;;
					esac
				done

				case "${platform}" in
					*-musl-*|*-musl)
						make_extra+=(FILED_EXTRA_LDFLAGS="-static")
						;;
				esac

				eval $("${setup_cc}" "${platform}")

				make_extra+=("CC=${CC}")
				if [ -n "${extra_cflags}" ]; then
					make_extra+=(FILED_EXTRA_CFLAGS="${extra_cflags}")
				fi

				make "${make_extra[@]}" > filed.log 2>&1 </dev/null || mv filed.log filed-failed.log
			) &
		done
	done
done

# Wait for that to get done
wait

# Rename the files into place
mkdir -p compiled
for binary in workdir-buildPrecompiled-*/filed; do
	platform="$(echo "${binary}" | sed 's@^.*-platform-@@;s@/.*$@@')"
	mv "${binary}" "compiled/filed-${version}-${platform}"
done
for errorLog in workdir-buildPrecompiled-*/filed-failed.log; do
	platform="$(echo "${errorLog}" | sed 's@^.*-platform-@@;s@/.*$@@')"
	mv "${errorLog}" "compiled/filed-${version}-${platform}-error.log"
done

# Cleanup
rm -rf workdir-buildPrecompiled-*

exit 0