Browse Source

More makefile tweaks, build log, smaller git clones (#1503)

pull/1504/head
trapexit 2 months ago
committed by GitHub
parent
commit
9872710720
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 51
      Makefile
  2. 9
      buildtools/build-mergerfs
  3. 15
      buildtools/build-release
  4. 2
      buildtools/containerfiles/static.amd64
  5. 2
      buildtools/containerfiles/static.arm64
  6. 2
      buildtools/containerfiles/static.armhf
  7. 2
      buildtools/containerfiles/static.i386
  8. 2
      buildtools/containerfiles/static.riscv64
  9. 6
      buildtools/containerfiles/tarball

51
Makefile

@ -30,7 +30,7 @@ TOUCH ?= touch
BUILDDIR := build
ifneq ($(GIT_REPO),0)
ifndef GIT_REPO
ifneq ($(shell $(GIT) --version 2> /dev/null),)
ifeq ($(shell test -e .git; echo $$?),0)
GIT_REPO = 1
@ -41,32 +41,32 @@ endif
USE_XATTR ?= 1
UGID_USE_RWLOCK ?= 0
ifeq ($(NDEBUG),1)
ifdef NDEBUG
OPT_FLAGS := -O2 -DNDEBUG
else
OPT_FLAGS := -O0 -g -fno-omit-frame-pointer -DDEBUG
endif
ifeq ($(STATIC),1)
ifdef STATIC
STATIC_FLAGS := -static
else
STATIC_FLAGS :=
endif
ifeq ($(LTO),1)
ifdef LTO
LTO_FLAGS := -flto
else
LTO_FLAGS :=
endif
SRC := $(wildcard src/*.cpp)
OBJS := $(SRC:src/%.cpp=build/.src/%.o)
DEPS := $(SRC:src/%.cpp=build/.src/%.d)
SRC := $(wildcard src/*.cpp)
OBJS := $(SRC:src/%.cpp=build/.src/%.o)
DEPS := $(SRC:src/%.cpp=build/.src/%.d)
TESTS := $(wildcard tests/*.cpp)
TESTS_OBJS := $(filter-out build/.src/mergerfs.o,$(OBJS))
TESTS := $(wildcard tests/*.cpp)
TESTS_OBJS := $(filter-out build/.src/mergerfs.o,$(OBJS))
TESTS_OBJS += $(TESTS:tests/%.cpp=build/.tests/%.o)
TESTS_DEPS := $(TESTS:tests/%.cpp=build/.tests/%.d)
TESTS_DEPS := $(TESTS:tests/%.cpp=build/.tests/%.d)
TESTS_DEPS += $(DEPS)
MANPAGE := mergerfs.1
@ -161,7 +161,7 @@ libfuse:
tests: $(BUILDDIR)/tests
changelog:
ifeq ($(GIT_REPO),1)
ifdef GIT_REPO
$(GIT2DEBCL) --name mergerfs > ChangeLog
else
@echo "WARNING: need git repo to generate ChangeLog"
@ -195,7 +195,7 @@ clean: rpm-clean
$(MAKE) -C libfuse clean
distclean: clean
ifeq ($(GIT_REPO),1)
ifdef GIT_REPO
$(GIT) clean -xfd
endif
@ -253,7 +253,7 @@ tarball: changelog version
.PHONY: debian-changelog
debian-changelog:
ifeq ($(GIT_REPO),1)
ifdef GIT_REPO
$(GIT2DEBCL) --name mergerfs > debian/changelog
else
$(CP) -v ChangeLog debian/changelog
@ -293,54 +293,67 @@ rpm: tarball
install-build-pkgs:
./buildtools/install-build-pkgs
.PHONY: install-build-tools
install-build-tools:
./bulidtools/install-build-tools
.PHONY: release
release:
./buildtools/build-release \
--target=all \
--cleanup \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-sample
release-sample:
./buildtools/build-release \
--target=debian.12.amd64 \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-amd64
release-amd64:
./buildtools/build-release \
--target=amd64 \
--cleanup \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-arm64
release-arm64:
./buildtools/build-release \
--target=arm64 \
--cleanup \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-riscv64
release-riscv64:
./buildtools/build-release \
--target=riscv64 \
--cleanup \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-armhf
release-armhf:
./buildtools/build-release \
--target=armhf \
--cleanup \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-static
release-static:
./buildtools/build-release \
--target=static \
--cleanup \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: release-tarball
release-tarball:
./buildtools/build-release \
--target=tarball \
$(if $(CLEANUP),--cleanup) \
--branch=$(shell git branch --show-current)
.PHONY: tags
tags:
rm -fv TAGS

9
buildtools/build-mergerfs

@ -2,8 +2,15 @@
BRANCH="${1:-master}"
SRCDIR="/tmp/mergerfs"
REPO_URL="https://github.com/trapexit/mergerfs"
git clone https://github.com/trapexit/mergerfs "${SRCDIR}" -b "${BRANCH}"
git \
clone \
--single-branch \
--branch="${BRANCH}" \
--depth=1 \
"${REPO_URL}" \
"${SRCDIR}"
cd "${SRCDIR}"

15
buildtools/build-release

@ -20,8 +20,21 @@ def build(containerfile,
f'--build-arg=BRANCH={branch}',
f'--build-arg=BUILD_TIMESTAMP={timestamp}',
'buildtools/']
# TODO: Capture output and write to log
print(args)
subprocess.run(args)
rv = subprocess.run(args)
report_filepath = os.path.join(pkgdirpath,"build-report.txt")
with open(report_filepath,"a+") as f:
build = os.path.basename(containerfile)
f.write(build + ": ")
f.write(f"branch={branch}; ")
f.write(f"timestamp={timestamp}; ")
f.write("rv=")
if rv.returncode == 0:
f.write("success;")
else:
f.write("fail;")
f.write("\n")
def setup():

2
buildtools/containerfiles/static.amd64

@ -3,7 +3,7 @@ FROM --platform=linux/amd64 alpine:latest as build
COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs
ARG BRANCH=master
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}"
WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build

2
buildtools/containerfiles/static.arm64

@ -3,7 +3,7 @@ FROM --platform=linux/arm64 alpine:latest as build
COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs
ARG BRANCH=master
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}"
WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build

2
buildtools/containerfiles/static.armhf

@ -3,7 +3,7 @@ FROM --platform=linux/armhf alpine:latest as build
COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs
ARG BRANCH=master
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}"
WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build

2
buildtools/containerfiles/static.i386

@ -3,7 +3,7 @@ FROM --platform=linux/i386 alpine:latest as build
COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs
ARG BRANCH=master
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}"
WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build

2
buildtools/containerfiles/static.riscv64

@ -3,7 +3,7 @@ FROM --platform=linux/riscv64 alpine:latest as build
COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs
ARG BRANCH=master
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}"
WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build

6
buildtools/containerfiles/tarball

@ -1,9 +1,9 @@
FROM debian:buster as tarball
ARG BUILD_TIMESTAMP=0
FROM alpine:latest as tarball
COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs
ARG BUILD_TIMESTAMP=0
ARG BRANCH=master
RUN git clone https://github.com/trapexit/mergerfs /tmp/mergerfs -b "${BRANCH}"
RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}"
RUN cd /tmp/mergerfs && make version tarball
RUN mkdir /build
RUN cp -v /tmp/mergerfs/*.tar.gz /build/

Loading…
Cancel
Save