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: 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         -CC        := gcc
     2         -CFLAGS    := -I. -Wall -W -pthread -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $(FILED_EXTRA_CFLAGS)
     3         -LDFLAGS   := -pthread $(FILED_EXTRA_LDFLAGS)
     4         -LIBS      := -lpthread $(FILED_EXTRA_LIBS)
     5         -MIMETYPES := /etc/httpd/mime.types
     6         -FILED_ADDITIONAL_DEPS = 
            1  +FILED_EXTRA_CFLAGS    := 
            2  +FILED_EXTRA_LDLAGS    := 
            3  +FILED_EXTRA_LIBS      := 
            4  +FILED_ADDITIONAL_DEPS := 
            5  +
            6  +CC         = gcc
            7  +CFLAGS     = -I. -Wall -W -pthread -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $(FILED_EXTRA_CFLAGS)
            8  +LDFLAGS    = -pthread $(FILED_EXTRA_LDFLAGS)
            9  +LIBS       = -lpthread $(FILED_EXTRA_LIBS)
           10  +MIMETYPES  = /etc/httpd/mime.types
     7     11   
     8     12   PREFIX := /usr/local
     9     13   prefix := $(PREFIX)
    10     14   bindir = $(prefix)/bin
    11     15   mandir = $(prefix)/share/man
    12     16   srcdir = .
    13     17   vpath %.c $(srcdir)
    14     18   
    15     19   ifeq ($(FILED_DO_SECCOMP),1)
    16         -CFLAGS += -DFILED_DO_SECCOMP=1
           20  +FILED_EXTRA_CFLAGS += -DFILED_DO_SECCOMP=1
    17     21   FILED_ADDTIONAL_DEPS += filed.seccomp.h
    18     22   endif
    19     23   
    20     24   all: filed
    21     25   
    22     26   filed: filed.o
    23     27   	$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" $^ $(LIBS)

Modified build/build-precompiled from [bda883498c] to [e99d758cfd].

    17     17   
    18     18   # Compile everything, all at once
    19     19   idx=-1
    20     20   for tryCompilerDir in "$(readlink -f ~/root/cross-compilers)" "$(readlink -f ~/devel/build-cc/TMP)"; do
    21     21   	setup_cc="${tryCompilerDir}/setup-cc"
    22     22   
    23     23   	platforms=(
    24         -		$("${setup_cc}" | tail -n +2)
           24  +		$("${setup_cc}" 2>/dev/null | tail -n +2)
    25     25   	)
    26     26   
    27         -	for platform in "${platforms[@]}"; do
           27  +	for platformBase in "${platforms[@]}"; do
           28  +		for platformAdditional in "" ".seccomp" ".fakechroot" ".internaldirhandle"; do
           29  +			case "${platformAdditional}" in
           30  +				*.seccomp|*.seccomp.*)
           31  +					# seccomp only works on i386/x86_64 for now
           32  +					case "${platformBase}" in
           33  +						i?86-*|x86_64-*)
           34  +							;;
           35  +						*)
           36  +							continue
           37  +							;;
           38  +					esac
           39  +					;;
           40  +			esac
           41  +
           42  +			platform="${platformBase}${platformAdditional}"
           43  +			echo "-- ${platform}"
           44  +
    28     45   		idx=$[$idx + 1]
    29     46   		(
    30     47   			workdir="workdir-buildPrecompiled-${idx}-$(openssl rand 20 -hex)-platform-${platform}" || exit 1
    31     48   			mkdir "${workdir}" || exit 1
    32     49   			cd "${workdir}" || exit 1
    33     50   
    34         -			eval $("${setup_cc}" "${platform}")
    35     51   			make_extra=(
    36     52   				-f ../Makefile
    37     53   				srcdir=..
    38         -				CC="${CC}"
    39     54   			)
           55  +
           56  +				extra_cflags=""
           57  +				while true; do
           58  +					case "${platform}" in
           59  +						*.seccomp|*.seccomp.*)
           60  +							platform="$(echo "${platform}" | sed 's@\.seccomp@@')"
           61  +							make_extra+=(FILED_DO_SECCOMP=1)
           62  +							;;
           63  +						*.fakechroot|*.fakechroot.*)
           64  +							platform="$(echo "${platform}" | sed 's@\.fakechroot@@')"
           65  +							extra_cflags="${extra_cflags} -DFILED_FAKE_CHROOT=1"
           66  +							;;
           67  +						*.internaldirhandle|*.internaldirhandle.*)
           68  +							platform="$(echo "${platform}" | sed 's@\.internaldirhandle@@')"
           69  +							extra_cflags="${extra_cflags} -DFILED_DONT_REDIRECT_DIRECTORIES=1"
           70  +							;;
           71  +						*)
           72  +							break
           73  +							;;
           74  +					esac
           75  +				done
    40     76   
    41     77   			case "${platform}" in
    42     78   				*-musl-*|*-musl)
    43         -					make_extra=("${make_extra[@]}" FILED_EXTRA_LDFLAGS="-static")
           79  +						make_extra+=(FILED_EXTRA_LDFLAGS="-static")
    44     80   					;;
    45     81   			esac
           82  +
           83  +				eval $("${setup_cc}" "${platform}")
           84  +
           85  +				make_extra+=("CC=${CC}")
           86  +				if [ -n "${extra_cflags}" ]; then
           87  +					make_extra+=(FILED_EXTRA_CFLAGS="${extra_cflags}")
           88  +				fi
    46     89   
    47     90   			make "${make_extra[@]}" > filed.log 2>&1 </dev/null || mv filed.log filed-failed.log
    48     91   		) &
    49     92   	done
    50     93   done
           94  +done
    51     95   
    52     96   # Wait for that to get done
    53     97   wait
    54     98   
    55     99   # Rename the files into place
    56    100   mkdir -p compiled
    57    101   for binary in workdir-buildPrecompiled-*/filed; do