ci : update + packages (#146)

* Add simple Debian package

* Update CI configuration

* Add cpack Deb package for libggwave-dev

* Add `make deb` top level target and CI job

* Ensure `make deb` packages are deterministic

Update CMakeLists.txt to make cpack generated Debian packages
deterministic build outputs by:
- Setting SOURCE_DATE_EPOCH to 0
- Executing `git log -1 --pretty=%ct` and storing the result in
  SOURCE_DATE_EPOCH, overriding 0
- Export SOURCE_DATE_EPOCH to the environment
- Explicitly prefix the execution of the cpack command in the custom
  target `deb_c_library` with SOURCE_DATE_EPOCH

Update `README.md-tmpl.md` and `README.md` to document new `make deb`
target.

The Makefile for the Python bindings already handle deterministic
building with the same strategy.

* libc6, not libc
This commit is contained in:
Jacob Appelbaum
2025-03-16 18:54:17 +01:00
committed by GitHub
parent 2bf3d677bc
commit cf1af4d3a3
12 changed files with 353 additions and 52 deletions

View File

@@ -1,12 +1,29 @@
default: build
PKG_NAME := ggwave
DEST := dist/
VER := $(shell cat setup.py | grep version |cut -d\" -f2)
VERSION := $(strip $(VER))
ORIG_TGZ := $(PKG_NAME)_$(VERSION).orig.tar.gz
ARCH := $(shell dpkg --print-architecture)
DEB_BUILD_OPTIONS := nocheck
DEB_BUILD_DIR := $(DEST)$(PKG_NAME)-$(VERSION)
DEB_VER := 0
DEB := python3-$(PKG_NAME)_$(VERSION)-$(DEB_VER)_$(ARCH).deb
SOURCE_DATE_EPOCH := $(shell git log -1 --pretty=%ct)
SOURCE_PKG_CMD := python -m build --sdist
DEB_BUILD_CMD := dpkg-buildpackage -rfakeroot -uc -us
COGAPP ?= $(shell which cog || which cogapp)
.PHONY:
ggwave:
# create a clean (maybe updated) copy of ggwave src
rm -rf ggwave && mkdir ggwave && cp -r ../../include ggwave/ && cp -r ../../src ggwave/
deps:
echo python -m pip install cogapp cython twine
pyggwave.bycython.cpp: ggwave.pyx cggwave.pxd
python -m pip install cython
cython --cleanup=3 --cplus ggwave.pyx -o ggwave.bycython.cpp
# To build package, README.rst is needed, because it goes into long description of package,
@@ -17,12 +34,30 @@ pyggwave.bycython.cpp: ggwave.pyx cggwave.pxd
BUILD_SOURCE_FILES=ggwave pyggwave.bycython.cpp setup.py
$(DEST)$(DEB): $(DEST)$(ORIG_TGZ)
-rm -r $(DEB_BUILD_DIR)
tar -C $(DEST) -xf $(DEST)$(ORIG_TGZ)
cp -arp debian $(DEB_BUILD_DIR)
cd $(DEB_BUILD_DIR) && \
DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS) $(DEB_BUILD_CMD)
deb_sdist: $(BUILD_SOURCE_FILES) README.rst
SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) $(SOURCE_PKG_CMD)
mv $(DEST)$(PKG_NAME)-$(VERSION).tar.gz $(DEST)$(ORIG_TGZ)
_deb:
@$(eval COGAPP=cogapp)
deb: _deb deb_sdist $(DEST)$(DEB)
dpkg --contents $(DEST)$(DEB)
ls -alh $(DEST)*$(PKG_NAME)*
sha256sum $(DEST)$(DEB)
buildWithoutREADME.rst: ${BUILD_SOURCE_FILES}
GGWAVE_OMIT_README_RST=1 python setup.py build_ext -i
README.rst: buildWithoutREADME.rst README-tmpl.rst
python -m pip install cogapp
cog -d -o README.rst README-tmpl.rst
$(COGAPP) -d -o README.rst README-tmpl.rst
BUILD_FILES=${BUILD_SOURCE_FILES} README.rst