1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

renames folder and adds support for reproducible builds

This commit is contained in:
nosamad 2019-03-23 03:48:15 +01:00
parent d4487d2e28
commit 3acf2ceecf
4 changed files with 36 additions and 2 deletions

View File

@ -3,15 +3,22 @@ default: all
# Overridable defaults # Overridable defaults
export SOURCE_DATE_EPOCH ?= $(shell $(PROJECT_ROOT)/build/get_source_date_epoch.sh)
export BUILDTIME ?= $(shell date -u -d '@$(SOURCE_DATE_EPOCH)' --rfc-3339 ns 2>/dev/null | sed -e 's/ /T/')
VERBOSE ?= VERBOSE ?=
PROJECT_NAME ?= webfs PROJECT_NAME ?= webfs
PROJECT_ROOT ?= . PROJECT_ROOT ?= .
OUT ?= $(PROJECT_ROOT)/.build
VERSION ?= $(shell cat $(PROJECT_ROOT)/VERSION) VERSION ?= $(shell cat $(PROJECT_ROOT)/VERSION)
OUT ?= $(PROJECT_ROOT)/.build
PARALLELMFLAGS ?= -j$(shell nproc) PARALLELMFLAGS ?= -j$(shell nproc)
UID ?= $(shell id -u) UID ?= $(shell id -u)
DOCKER ?= docker DOCKER ?= docker
DOCKER_BUILDKIT ?= DOCKER_BUILDKIT ?=
CONTAINER_USER ?= $(UID) CONTAINER_USER ?= $(UID)
CONTAINER_GROUP ?= $(shell id -g) CONTAINER_GROUP ?= $(shell id -g)
CONTAINER_WORKSPACE ?= /workspace CONTAINER_WORKSPACE ?= /workspace
@ -56,6 +63,7 @@ DOCKER_RUNFLAGS += --init
DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP) DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
DOCKER_RUNFLAGS += --env BUILDTIME
DOCKER_BUILDARGS += CODENAME=$(CODENAME) DOCKER_BUILDARGS += CODENAME=$(CODENAME)
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS) DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
@ -148,7 +156,7 @@ $(OUT)/docker/qemu-arm-static-$(QEMU_VERSION):
&& curl -fsSL -o $@ $(URL) \ && curl -fsSL -o $@ $(URL) \
&& chmod +x $@ && chmod +x $@
$(OUT)/% : $(PROJECT_ROOT)/% | $(OUT_DIRS) $(OUT)/docker/% : $(PROJECT_ROOT)/build/% | $(OUT_DIRS)
cp $< $@ cp $< $@
$(OUT)/docker/%: $(OUT)/docker/%.dockerfile $(EXTRACT_TARGETS) $(PROJECT_ROOT)/Makefile | $(OUT_DIRS) $(OUT)/docker/%: $(OUT)/docker/%.dockerfile $(EXTRACT_TARGETS) $(PROJECT_ROOT)/Makefile | $(OUT_DIRS)

26
build/get_source_date_epoch.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
export LANG=C
export LC_ALL=C
[ -n "$TOPDIR" ] && cd "$TOPDIR"
try_git() {
[ -e .git ] || return 1
SOURCE_DATE_EPOCH="$(git log -1 --format=format:%ct)"
[ -n "$SOURCE_DATE_EPOCH" ]
}
try_hg() {
[ -d .hg ] || return 1
SOURCE_DATE_EPOCH="$(hg log --template '{date}' -l 1 | cut -d. -f1)"
[ -n "$SOURCE_DATE_EPOCH" ]
}
try_mtime() {
perl -e 'print((stat $ARGV[0])[9])' "$0"
[ -n "$SOURCE_DATE_EPOCH" ]
}
try_git || try_hg || try_mtime || SOURCE_DATE_EPOCH=""
echo "$SOURCE_DATE_EPOCH"