Debian packages are failing to build

Error seen on GitHub Actions:

```
-buildmode=pie requires external (cgo) linking, but cgo is not enabled
```
This commit is contained in:
Frédéric Guillot 2024-02-07 19:44:05 -08:00
parent 5ce5c47499
commit bd573957e0
3 changed files with 33 additions and 24 deletions

View file

@ -12,6 +12,7 @@ export PGPASSWORD := postgres
.PHONY: \ .PHONY: \
miniflux \ miniflux \
miniflux-no-pie \
linux-amd64 \ linux-amd64 \
linux-arm64 \ linux-arm64 \
linux-armv7 \ linux-armv7 \
@ -45,6 +46,9 @@ export PGPASSWORD := postgres
miniflux: miniflux:
@ CGO_ENABLED=0 go build -buildmode=pie -ldflags=$(LD_FLAGS) -o $(APP) main.go @ CGO_ENABLED=0 go build -buildmode=pie -ldflags=$(LD_FLAGS) -o $(APP) main.go
miniflux-no-pie:
@ go build -ldflags=$(LD_FLAGS) -o $(APP) main.go
linux-amd64: linux-amd64:
@ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go @ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=$(LD_FLAGS) -o $(APP)-$@ main.go

View file

@ -1,9 +1,8 @@
ARG BASE_IMAGE_ARCH="amd64" ARG BASE_IMAGE_ARCH="amd64"
FROM ${BASE_IMAGE_ARCH}/golang:bookworm AS build FROM ${BASE_IMAGE_ARCH}/golang:1.22-bookworm AS build
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ENV CGO_ENABLED=0
RUN apt-get update -q && \ RUN apt-get update -q && \
apt-get install -y -qq build-essential devscripts dh-make debhelper && \ apt-get install -y -qq build-essential devscripts dh-make debhelper && \

View file

@ -8,25 +8,31 @@ echo "PKG_VERSION=$PKG_VERSION"
echo "PKG_ARCH=$PKG_ARCH" echo "PKG_ARCH=$PKG_ARCH"
echo "PKG_DATE=$PKG_DATE" echo "PKG_DATE=$PKG_DATE"
cd /src && \ cd /src
make miniflux && \
mkdir -p /build/debian && \ if [ "$PKG_ARCH" = "armhf" ]; then
cd /build && \ make miniflux-no-pie
cp /src/miniflux /build/ && \ else
cp /src/miniflux.1 /build/ && \ make miniflux
cp /src/LICENSE /build/ && \ fi
cp /src/packaging/miniflux.conf /build/ && \
cp /src/packaging/systemd/miniflux.service /build/debian/ && \ mkdir -p /build/debian && \
cp /src/packaging/debian/compat /build/debian/compat && \ cd /build && \
cp /src/packaging/debian/copyright /build/debian/copyright && \ cp /src/miniflux /build/ && \
cp /src/packaging/debian/miniflux.manpages /build/debian/miniflux.manpages && \ cp /src/miniflux.1 /build/ && \
cp /src/packaging/debian/miniflux.postinst /build/debian/miniflux.postinst && \ cp /src/LICENSE /build/ && \
cp /src/packaging/debian/rules /build/debian/rules && \ cp /src/packaging/miniflux.conf /build/ && \
cp /src/packaging/debian/miniflux.dirs /build/debian/miniflux.dirs && \ cp /src/packaging/systemd/miniflux.service /build/debian/ && \
echo "miniflux ($PKG_VERSION) experimental; urgency=low" > /build/debian/changelog && \ cp /src/packaging/debian/compat /build/debian/compat && \
echo " * Miniflux version $PKG_VERSION" >> /build/debian/changelog && \ cp /src/packaging/debian/copyright /build/debian/copyright && \
echo " -- Frédéric Guillot <f@miniflux.net> $PKG_DATE" >> /build/debian/changelog && \ cp /src/packaging/debian/miniflux.manpages /build/debian/miniflux.manpages && \
sed "s/__PKG_ARCH__/${PKG_ARCH}/g" /src/packaging/debian/control > /build/debian/control && \ cp /src/packaging/debian/miniflux.postinst /build/debian/miniflux.postinst && \
dpkg-buildpackage -us -uc -b && \ cp /src/packaging/debian/rules /build/debian/rules && \
lintian --check --color always ../*.deb && \ cp /src/packaging/debian/miniflux.dirs /build/debian/miniflux.dirs && \
cp ../*.deb /pkg/ echo "miniflux ($PKG_VERSION) experimental; urgency=low" > /build/debian/changelog && \
echo " * Miniflux version $PKG_VERSION" >> /build/debian/changelog && \
echo " -- Frédéric Guillot <f@miniflux.net> $PKG_DATE" >> /build/debian/changelog && \
sed "s/__PKG_ARCH__/${PKG_ARCH}/g" /src/packaging/debian/control > /build/debian/control && \
dpkg-buildpackage -us -uc -b && \
lintian --check --color always ../*.deb && \
cp ../*.deb /pkg/