diff --git a/Makefile b/Makefile index 83e25ab6..a7eeaa00 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +$(info mergerfs MAKEFLAGS: $(MAKEFLAGS)) + ifeq ($(shell id -u),0) FAKEROOT ?= endif @@ -188,7 +190,7 @@ $(BUILDDIR)/tests: $(BUILDDIR)/mergerfs $(TESTS_OBJS) .PHONY: libfuse $(LIBFUSE): libfuse: - $(MAKE) NDEBUG=$(NDEBUG) -C libfuse + $(MAKE) -C libfuse tests: $(BUILDDIR)/tests diff --git a/buildtools/build-release b/buildtools/build-release index 146abd61..51443b15 100755 --- a/buildtools/build-release +++ b/buildtools/build-release @@ -19,7 +19,7 @@ def build(git_repo, if os.path.exists(git_repo): git_repo = os.path.realpath(git_repo) args += ['-v',f'{git_repo}:/tmp/mergerfs.git:ro'] - args += ['--build-arg=GIT_REPO=/tmp/mergerfs.git'] + args += ['--build-arg=GIT_REPO=file:///tmp/mergerfs.git'] else: args += [f'--build-arg=GIT_REPO={git_repo}'] args += ['-o',pkgdirpath, diff --git a/buildtools/containerfiles/static.amd64 b/buildtools/containerfiles/static.amd64 index e7b50015..4f886fff 100644 --- a/buildtools/containerfiles/static.amd64 +++ b/buildtools/containerfiles/static.amd64 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/amd64 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_amd64.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_amd64.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.arm64 b/buildtools/containerfiles/static.arm64 index ad57d8e4..d2d421eb 100644 --- a/buildtools/containerfiles/static.arm64 +++ b/buildtools/containerfiles/static.arm64 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/arm64 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_arm64.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_arm64.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.armhf b/buildtools/containerfiles/static.armhf index cf418139..6f67c3fc 100644 --- a/buildtools/containerfiles/static.armhf +++ b/buildtools/containerfiles/static.armhf @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/armhf alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_armhf.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_armhf.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.i386 b/buildtools/containerfiles/static.i386 index 10ee3d71..b55c12b1 100644 --- a/buildtools/containerfiles/static.i386 +++ b/buildtools/containerfiles/static.i386 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/i386 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_i386.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_i386.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/buildtools/containerfiles/static.riscv64 b/buildtools/containerfiles/static.riscv64 index e6c5fd65..4583f55f 100644 --- a/buildtools/containerfiles/static.riscv64 +++ b/buildtools/containerfiles/static.riscv64 @@ -1,13 +1,15 @@ -ARG BUILD_TIMESTAMP=0 FROM --platform=linux/riscv64 alpine:latest as build COPY install-build-pkgs /tmp/ RUN /tmp/install-build-pkgs -ARG BRANCH=master -RUN git clone --single-branch --depth=1 https://github.com/trapexit/mergerfs /tmp/mergerfs --branch="${BRANCH}" +ARG BUILD_TIMESTAMP=0 +ARG GIT_REPO +ARG BRANCH +RUN git clone --single-branch --branch="${BRANCH}" ${GIT_REPO} /tmp/mergerfs WORKDIR /tmp/mergerfs RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN mkdir /build -RUN tar cvfz /build/mergerfs-static-linux_riscv64.tar.gz --directory=/tmp usr sbin +RUN /tmp/usr/local/bin/mergerfs --version | head -n1 | cut -c 11- | tee /tmp/version +RUN tar cvfz /build/mergerfs-$(cat /tmp/version)-static-linux_riscv64.tar.gz --directory=/tmp usr sbin FROM scratch COPY --from=build /build/ / diff --git a/libfuse/Makefile b/libfuse/Makefile index e1e6f222..85b94af4 100644 --- a/libfuse/Makefile +++ b/libfuse/Makefile @@ -12,6 +12,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +$(info libfuse MAKEFLAGS: $(MAKEFLAGS)) + AR ?= ar CHMOD ?= chmod CHOWN ?= chown @@ -88,10 +90,17 @@ OBJS += $(SRC_CXX:lib/%.cpp=$(BUILDDIR)/.objs/%.cpp.o) DEPS := $(SRC_C:lib/%.c=$(BUILDDIR)/.objs/%.c.d) DEPS += $(SRC_CXX:lib/%.cpp=$(BUILDDIR)/.objs/%.cpp.d) +ifdef STATIC +STATIC_FLAGS := -static +else +STATIC_FLAGS := +endif + CPPFLAGS ?= CFLAGS ?= \ $(OPT_FLAGS) \ $(LTO_FLAGS) \ + $(STATIC_FLAGS) \ -Wall \ -pipe override CFLAGS += \ @@ -101,6 +110,7 @@ override CFLAGS += \ CXXFLAGS ?= \ $(OPT_FLAGS) \ $(LTO_FLAGS) \ + $(STATIC_FLAGS) \ -Wall \ -pipe override CXXFLAGS += \ @@ -138,6 +148,7 @@ $(BUILDDIR)/mergerfs-fusermount: util/fusermount.c lib/mount_util.c mergerfs-fusermount: $(BUILDDIR)/mergerfs-fusermount $(BUILDDIR)/mount.mergerfs: $(BUILDDIR)/libfuse.a util/mount.mergerfs.c + echo STATIC=$(STATIC) $(STATIC_FLAGS) $(CC) $(CFLAGS) $(FUSE_FLAGS) -o $(BUILDDIR)/mount.mergerfs util/mount.mergerfs.c $(BUILDDIR)/libfuse.a $(LDFLAGS) mount.mergerfs: $(BUILDDIR)/mount.mergerfs