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. 39
      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

39
Makefile

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

9
buildtools/build-mergerfs

@ -2,8 +2,15 @@
BRANCH="${1:-master}" BRANCH="${1:-master}"
SRCDIR="/tmp/mergerfs" 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}" cd "${SRCDIR}"

15
buildtools/build-release

@ -20,8 +20,21 @@ def build(containerfile,
f'--build-arg=BRANCH={branch}', f'--build-arg=BRANCH={branch}',
f'--build-arg=BUILD_TIMESTAMP={timestamp}', f'--build-arg=BUILD_TIMESTAMP={timestamp}',
'buildtools/'] 'buildtools/']
# TODO: Capture output and write to log
print(args) 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(): def setup():

2
buildtools/containerfiles/static.amd64

@ -3,7 +3,7 @@ FROM --platform=linux/amd64 alpine:latest as build
COPY install-build-pkgs /tmp/ COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs RUN /tmp/install-build-pkgs
ARG BRANCH=master 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 WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build 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/ COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs RUN /tmp/install-build-pkgs
ARG BRANCH=master 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 WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build 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/ COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs RUN /tmp/install-build-pkgs
ARG BRANCH=master 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 WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build 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/ COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs RUN /tmp/install-build-pkgs
ARG BRANCH=master 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 WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build 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/ COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs RUN /tmp/install-build-pkgs
ARG BRANCH=master 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 WORKDIR /tmp/mergerfs
RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install RUN make NDEBUG=1 LTO=1 STATIC=1 DESTDIR=/tmp -j$(nproc) install
RUN mkdir /build 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/ COPY install-build-pkgs /tmp/
RUN /tmp/install-build-pkgs RUN /tmp/install-build-pkgs
ARG BUILD_TIMESTAMP=0
ARG BRANCH=master 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 cd /tmp/mergerfs && make version tarball
RUN mkdir /build RUN mkdir /build
RUN cp -v /tmp/mergerfs/*.tar.gz /build/ RUN cp -v /tmp/mergerfs/*.tar.gz /build/

Loading…
Cancel
Save