Check-in [64fcd6f371]
Overview
Comment:More Makefile cleanup and build more precompiled builds
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | seccomp
Files: files | file ages | folders
SHA1: 64fcd6f371115e34f2da82a854ffe3796dbb4318
User & Date: rkeene on 2020-03-31 16:50:37
Other Links: branch diff | manifest | tags
Context
2020-03-31
16:50
More Makefile cleanup and build more precompiled builds Leaf check-in: 64fcd6f371 user: rkeene tags: seccomp
16:25
Updated to not try to build seccomp dependencies unless seccomp is being used check-in: 0a04450d6f user: rkeene tags: seccomp
Changes

Modified Makefile from [453d3ea362] to [104b67b0fa].






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23





CC        := gcc
CFLAGS    := -I. -Wall -W -pthread -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $(FILED_EXTRA_CFLAGS)
LDFLAGS   := -pthread $(FILED_EXTRA_LDFLAGS)
LIBS      := -lpthread $(FILED_EXTRA_LIBS)
MIMETYPES := /etc/httpd/mime.types
FILED_ADDITIONAL_DEPS = 

PREFIX := /usr/local
prefix := $(PREFIX)
bindir = $(prefix)/bin
mandir = $(prefix)/share/man
srcdir = .
vpath %.c $(srcdir)

ifeq ($(FILED_DO_SECCOMP),1)
CFLAGS += -DFILED_DO_SECCOMP=1
FILED_ADDTIONAL_DEPS += filed.seccomp.h
endif

all: filed

filed: filed.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^ $(LIBS)
>
>
>
>
>
|
|
|
|
|
<









|







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
FILED_EXTRA_CFLAGS    := 
FILED_EXTRA_LDLAGS    := 
FILED_EXTRA_LIBS      := 
FILED_ADDITIONAL_DEPS := 

CC         = gcc
CFLAGS     = -I. -Wall -W -pthread -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $(FILED_EXTRA_CFLAGS)
LDFLAGS    = -pthread $(FILED_EXTRA_LDFLAGS)
LIBS       = -lpthread $(FILED_EXTRA_LIBS)
MIMETYPES  = /etc/httpd/mime.types


PREFIX := /usr/local
prefix := $(PREFIX)
bindir = $(prefix)/bin
mandir = $(prefix)/share/man
srcdir = .
vpath %.c $(srcdir)

ifeq ($(FILED_DO_SECCOMP),1)
FILED_EXTRA_CFLAGS += -DFILED_DO_SECCOMP=1
FILED_ADDTIONAL_DEPS += filed.seccomp.h
endif

all: filed

filed: filed.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^ $(LIBS)

Modified build/build-precompiled from [bda883498c] to [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

# 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[@]}" > filed.log 2>&1 </dev/null || mv filed.log filed-failed.log
		) &

	done
done

# Wait for that to get done
wait

# Rename the files into place







|


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



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







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

# 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