Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
456 changes: 456 additions & 0 deletions .github/workflows/build-deb.yml

Large diffs are not rendered by default.

27 changes: 25 additions & 2 deletions docs/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,27 @@ exporter; only HttpBinary was ever selected.
</para>
</change>

<change type="change">
<para>
the Debian packages are rebranded to "freeunit": the package set
(freeunit, freeunit-dev, freeunit-php8.x, freeunit-python3.x,
freeunit-perl, freeunit-ruby, freeunit-go, freeunit-wasm and the
freeunit-jscNN Java modules), the
daemon binary (/usr/sbin/freeunitd), the control socket
(control.freeunit.sock), the state directory (/var/lib/freeunit), the log
(/var/log/freeunit.log) and the systemd/init service are all renamed. Each
package Provides/Conflicts/Replaces its upstream "unit" counterpart, so
installing freeunit cleanly takes over a stock "unit" install; the two are
deliberately not co-installable. The compiled-in "Unit" identity, the
unitc/setup-unit tools and the development headers keep their upstream
names by design.
</para>
</change>

</changes>


<changes apply="unit-php unit-python unit-python3.14
<changes apply="unit-php unit-php8.3 unit-php8.4 unit-php8.5 unit-python unit-python3.13 unit-python3.14
unit-go
unit-perl
unit-ruby
Expand Down Expand Up @@ -167,7 +184,7 @@ deduplication, and dry-run preview support.
</changes>


<changes apply="unit-php unit-python unit-python3.14
<changes apply="unit-php unit-php8.3 unit-php8.4 unit-php8.5 unit-python unit-python3.13 unit-python3.14
unit-go
unit-perl
unit-ruby
Expand All @@ -183,6 +200,12 @@ FreeUnit updated to 1.35.5.
</para>
</change>

<change type="feature">
<para>
Debian trixie packages are now built for php8.3, php8.4, php8.5 and python3.13.
</para>
</change>

</changes>


Expand Down
19 changes: 19 additions & 0 deletions pkg/deb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Artifacts generated by build-local.sh and the deb packaging Makefile during a
# local .deb build. They are produced inside this directory and must never be
# committed. Patterns are anchored to this directory so they cannot match
# sources elsewhere in the tree.

# Collected output packages.
/debs/

# Per-target debuild trees (core plus one per language module).
/debuild/
/debuild-*/

# Generated build-dependency check stamps.
/check-build-depends-*

# Source symlinks the Makefile creates for each debuild target
# (unit, unit-php8.4, unit-python3.13, ...).
/unit
/unit-*
159 changes: 122 additions & 37 deletions pkg/deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,55 @@ DEFAULT_RELEASE := 1
VERSION ?= $(DEFAULT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)

# BRAND — our package identity in dpkg/apt (Source/Package names, module names).
# RUNTIME — on-disk artifact naming: daemon binary ($(RUNTIME)d), state/log/pid
# paths, control socket, unix user/group, systemd unit, and the
# internal module-coupling virtual package ($(RUNTIME)-r<ver>).
# Defaults give a full rebrand (freeunitd, /var/lib/freeunit, the
# control.freeunit.sock socket, /usr/lib/freeunit/modules, the "freeunit"
# user/group and systemd unit) — the fork's own on-disk identity, still without
# touching src/. The rebrand covers the daemon and its state paths only; the
# libunit toolchain keeps upstream-stable names by design, so the unitc/setup-
# unit tools, the unitd.8 man page, the /usr/include/unit headers, libunit*
# libraries, and the compiled-in "Unit/" strings all stay "unit".
# Build a drop-in *replacement* for a stock "unit" install with
# RUNTIME=unit RUNDIR=/var/run: freeunit then adopts that runtime's config dir,
# socket path and systemd unit name so existing configs and automation keep
# working after the swap. This is a replacement, not coexistence: the packages
# declare Conflicts/Replaces against "unit" (see debian/control.in), so freeunit
# and upstream "unit" are never installed side by side.
BRAND ?= freeunit
RUNTIME ?= freeunit
# BRAND_TITLE — human-readable product name for display strings (systemd unit
# Description, init headers, install banners). dpkg/path names use
# BRAND/RUNTIME; this is the prose label a user sees.
BRAND_TITLE ?= FreeUnit
# RUNDIR — volatile runtime state dir for the control socket and pid file.
# /var/run keeps the legacy socket location (a symlink to /run); set
# RUNDIR=/run for the pure FHS path.
# HOMEPAGE — control "Homepage:" field. DOCS_URL — documentation URL shown in
# the install banners. Both default to the fork; override to retarget.
RUNDIR ?= /var/run
HOMEPAGE ?= https://freeunit.org
DOCS_URL ?= https://docs.freeunit.org

PACKAGE_VENDOR = FreeUnit Packaging <team@freeunit.org>

SRCDIR= unit-$(VERSION)
SRCDIR= $(BRAND)-$(VERSION)

CODENAME = $(shell lsb_release -cs)

BUILD_DEPENDS_unit = build-essential debhelper devscripts fakeroot libxml2-utils lintian lsb-release xsltproc libssl-dev clang llvm
BUILD_DEPENDS_unit = build-essential debhelper devscripts fakeroot libxml2-utils lintian lsb-release xsltproc libssl-dev libpcre2-dev pkg-config clang llvm cargo rustc
BUILD_DEPENDS = $(BUILD_DEPENDS_unit)

MODULES=

# Shared install-banner command: PUT the module's example config over the
# control socket. Defined once here so the per-language Makefile.* banners stay
# in sync; the example config is installed as $(BRAND).config by the
# MODULE_PREINSTALL_* recipes, so the filename must track $(BRAND).
MODULE_CONFIG_PUT = sudo curl -X PUT --data-binary @$(BRAND).config --unix-socket $(RUNDIR)/control.$(RUNTIME).sock http://localhost/config

# Ubuntu 24.04
ifeq ($(CODENAME),noble)
include Makefile.php
Expand Down Expand Up @@ -81,6 +119,9 @@ endif
# Debian 13
ifeq ($(CODENAME),trixie)
include Makefile.php
include Makefile.php83
include Makefile.php84
include Makefile.php85
include Makefile.python312
include Makefile.python313
include Makefile.go
Expand Down Expand Up @@ -119,15 +160,15 @@ endif

CONFIGURE_ARGS_COMMON=\
--prefix=/usr \
--statedir=/var/lib/unit \
--control="unix:/var/run/control.unit.sock" \
--runstatedir=/var/run \
--pid=/var/run/unit.pid \
--statedir=/var/lib/$(RUNTIME) \
--control="unix:$(RUNDIR)/control.$(RUNTIME).sock" \
--runstatedir=$(RUNDIR) \
--pid=$(RUNDIR)/$(RUNTIME).pid \
--logdir=/var/log \
--log=/var/log/unit.log \
--log=/var/log/$(RUNTIME).log \
--tmpdir=/var/tmp \
--user=unit \
--group=unit \
--user=$(RUNTIME) \
--group=$(RUNTIME) \
--tests \
--openssl

Expand Down Expand Up @@ -178,63 +219,99 @@ debuild/$(SRCDIR)/debian:
set -e ; \
mkdir -p debuild/$(SRCDIR) ; \
cp -pr debian debuild/$(SRCDIR) ; \
echo '11' > debuild/$(SRCDIR)/debian/compat ; \
mkdir -p debuild/$(SRCDIR)/debian/source ; \
echo '3.0 (quilt)' > debuild/$(SRCDIR)/debian/source/format ; \
D=debuild/$(SRCDIR)/debian ; \
echo '11' > $$D/compat ; \
mkdir -p $$D/source ; \
echo '3.0 (quilt)' > $$D/source/format ; \
cat debian/control.in | sed \
-e "s#%%PACKAGE%%#$(BRAND)#g" \
-e "s#%%RUNTIME%%#$(RUNTIME)#g" \
-e "s#%%HOMEPAGE%%#$(HOMEPAGE)#g" \
-e "s#%%PACKAGE_VENDOR%%#$(PACKAGE_VENDOR)#g" \
-e "s#%%UNIT_VERSION%%#$(VERSION)#g" \
> debuild/$(SRCDIR)/debian/control ; \
cat debian/rules.in | sed \
-e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \
> debuild/$(SRCDIR)/debian/rules ; \
chmod +x debuild/$(SRCDIR)/debian/rules ; \
> $$D/control ; \
cat debian/rules.in | sed \
-e "s#%%PACKAGE%%#$(BRAND)#g" \
-e "s#%%RUNTIME%%#$(RUNTIME)#g" \
-e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \
> $$D/rules ; \
chmod +x $$D/rules ; \
[ -f $$D/dirs ] && sed -i -e "s#%%RUNTIME%%#$(RUNTIME)#g" $$D/dirs || true ; \
[ -f $$D/unit.example.config ] && sed -i -e "s#%%PACKAGE%%#$(BRAND)#g" $$D/unit.example.config || true ; \
: 'package-scoped helper files: debian/<package>.<ext> (keyed on BRAND)' ; \
for f in postinst postrm preinst logrotate lintian-overrides ; do \
s=$$D/freeunit.$$f ; [ -f $$s ] || continue ; \
sed -i -e "s#%%PACKAGE%%#$(BRAND)#g" -e "s#%%RUNTIME%%#$(RUNTIME)#g" -e "s#%%RUNDIR%%#$(RUNDIR)#g" -e "s#%%DOCS_URL%%#$(DOCS_URL)#g" -e "s#%%BRAND_TITLE%%#$(BRAND_TITLE)#g" $$s ; \
[ "$(BRAND).$$f" = "freeunit.$$f" ] || mv $$s $$D/$(BRAND).$$f ; \
done ; \
: 'init/default are resolved by dh_installinit --name=$(RUNTIME); stage as debian/$(BRAND).$(RUNTIME).<ext> so drop-in mode (RUNTIME != BRAND) finds them' ; \
for f in init default ; do \
s=$$D/freeunit.$$f ; [ -f $$s ] || continue ; \
sed -i -e "s#%%PACKAGE%%#$(BRAND)#g" -e "s#%%RUNTIME%%#$(RUNTIME)#g" -e "s#%%RUNDIR%%#$(RUNDIR)#g" -e "s#%%DOCS_URL%%#$(DOCS_URL)#g" -e "s#%%BRAND_TITLE%%#$(BRAND_TITLE)#g" $$s ; \
[ "$(BRAND).$(RUNTIME).$$f" = "freeunit.$$f" ] || mv $$s $$D/$(BRAND).$(RUNTIME).$$f ; \
done ; \
: 'service templates are named freeunit.unit.service as fixed source placeholders (NOT debhelper <pkg>.<name> form); the loop rewrites them to $(BRAND).$(RUNTIME).service' ; \
for pair in "freeunit.unit.service $(BRAND).$(RUNTIME).service" \
"freeunit.unit-debug.service $(BRAND).$(RUNTIME)-debug.service" ; do \
set -- $$pair ; s=$$D/$$1 ; d=$$D/$$2 ; [ -f $$s ] || continue ; \
sed -i -e "s#%%RUNTIME%%#$(RUNTIME)#g" -e "s#%%RUNDIR%%#$(RUNDIR)#g" -e "s#%%BRAND_TITLE%%#$(BRAND_TITLE)#g" $$s ; \
[ "$$s" = "$$d" ] || mv $$s $$d ; \
done ; \
for pair in "freeunit-dev.lintian-overrides $(BRAND)-dev.lintian-overrides" ; do \
set -- $$pair ; s=$$D/$$1 ; d=$$D/$$2 ; [ -f $$s ] || continue ; \
sed -i -e "s#%%PACKAGE%%#$(BRAND)#g" -e "s#%%RUNTIME%%#$(RUNTIME)#g" $$s ; \
[ "$$s" = "$$d" ] || mv $$s $$d ; \
done ; \
}

debuild/$(SRCDIR)/debian/changelog: ../../docs/changes.xml | debuild/$(SRCDIR)/debian
cd ../../docs && make ../build/unit.deb-changelog
ifneq ($(DEFAULT_VERSION)$(DEFAULT_RELEASE), $(VERSION)$(RELEASE))
cat ../../build/unit.deb-changelog | sed \
-e "s/unit ($(DEFAULT_VERSION)-$(DEFAULT_RELEASE)~/unit ($(VERSION)-$(RELEASE)~/" \
-e "s/^unit ($(DEFAULT_VERSION)-$(DEFAULT_RELEASE)~/$(BRAND) ($(VERSION)-$(RELEASE)~/" \
-e "s/^unit (/$(BRAND) (/" \
-e "s#%%CODENAME%%#$(CODENAME)#g" \
> debuild/$(SRCDIR)/debian/changelog
else
cat ../../build/unit.deb-changelog | sed \
-e "s/^unit (/$(BRAND) (/" \
-e "s#%%CODENAME%%#$(CODENAME)#g" \
> debuild/$(SRCDIR)/debian/changelog
endif

debuild/unit_$(VERSION).orig.tar.gz: | debuild/$(SRCDIR)/debian
debuild/$(BRAND)_$(VERSION).orig.tar.gz: | debuild/$(SRCDIR)/debian
cd ../.. && tar -czf pkg/deb/debuild/$(SRCDIR).tar.gz \
--transform "s#^#$(SRCDIR)/#" \
LICENSE NOTICE CHANGES README.md CONTRIBUTING.md configure auto src \
test tools version go pkg/contrib docs/man/man8/unitd.8.in
mv debuild/$(SRCDIR).tar.gz debuild/unit_$(VERSION).orig.tar.gz
cd debuild && tar zxf unit_$(VERSION).orig.tar.gz
mv debuild/$(SRCDIR).tar.gz debuild/$(BRAND)_$(VERSION).orig.tar.gz
cd debuild && tar zxf $(BRAND)_$(VERSION).orig.tar.gz

unit: check-build-depends-unit debuild/unit_$(VERSION).orig.tar.gz debuild/$(SRCDIR)/debian/changelog
unit: check-build-depends-unit debuild/$(BRAND)_$(VERSION).orig.tar.gz debuild/$(SRCDIR)/debian/changelog
@echo "===> Building $@ package"
cd debuild/$(SRCDIR) && debuild --preserve-envvar PATH --preserve-envvar RUSTUP_HOME -us -uc
mkdir -p debs
find debuild/ -maxdepth 1 -type f -exec cp {} debs/ \;
ln -s debuild/$(SRCDIR)/build $@

debuild-%: debuild/unit_$(VERSION).orig.tar.gz ../../docs/changes.xml
debuild-%: debuild/$(BRAND)_$(VERSION).orig.tar.gz ../../docs/changes.xml
mkdir $@
cp debuild/unit_$(VERSION).orig.tar.gz debuild-$*/unit-$(MODULE_SUFFIX_$*)_$(VERSION).orig.tar.gz
cd $@ && tar zxf unit-$(MODULE_SUFFIX_$*)_$(VERSION).orig.tar.gz
cp debuild/$(BRAND)_$(VERSION).orig.tar.gz debuild-$*/$(BRAND)-$(MODULE_SUFFIX_$*)_$(VERSION).orig.tar.gz
cd $@ && tar zxf $(BRAND)-$(MODULE_SUFFIX_$*)_$(VERSION).orig.tar.gz
mkdir $@/$(SRCDIR)/debian
echo '11' > $@/$(SRCDIR)/debian/compat
mkdir $@/$(SRCDIR)/debian/source
echo '3.0 (quilt)' > $@/$(SRCDIR)/debian/source/format
cd ../../docs && make ../build/unit-$(MODULE_SUFFIX_$*).deb-changelog
ifneq ($(DEFAULT_VERSION)$(DEFAULT_RELEASE), $(VERSION)$(RELEASE))
cat ../../build/unit-$(MODULE_SUFFIX_$*).deb-changelog | sed \
-e "s/unit-$* ($(DEFAULT_VERSION)-$(DEFAULT_RELEASE)~/unit-$* ($(VERSION)-$(RELEASE)~/" \
-e "s/^unit-$(MODULE_SUFFIX_$*) ($(DEFAULT_VERSION)-$(DEFAULT_RELEASE)~/$(BRAND)-$(MODULE_SUFFIX_$*) ($(VERSION)-$(RELEASE)~/" \
-e "s/^unit-$(MODULE_SUFFIX_$*) (/$(BRAND)-$(MODULE_SUFFIX_$*) (/" \
-e "s#%%CODENAME%%#$(CODENAME)#g" \
> $@/$(SRCDIR)/debian/changelog
else
cat ../../build/unit-$(MODULE_SUFFIX_$*).deb-changelog | sed \
-e "s/^unit-$(MODULE_SUFFIX_$*) (/$(BRAND)-$(MODULE_SUFFIX_$*) (/" \
-e "s#%%CODENAME%%#$(CODENAME)#g" \
> $@/$(SRCDIR)/debian/changelog
endif
Expand All @@ -246,27 +323,35 @@ endif
@{ \
set -e ; \
for src in $(MODULE_SOURCES_$*); do \
cp debian.module/$${src} $@/$(SRCDIR)/debian/ ; \
sed -e "s#%%NAME%%#$(BRAND)-$(MODULE_SUFFIX_$*)#g" \
-e "s#%%PACKAGE%%#$(BRAND)#g" \
-e "s#%%RUNTIME%%#$(RUNTIME)#g" \
debian.module/$${src} > $@/$(SRCDIR)/debian/$${src} ; \
done ; \
definitions=`echo "$$MODULE_DEFINITIONS_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
prebuild=`echo "$$MODULE_PREBUILD_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
preinstall=`echo "$$MODULE_PREINSTALL_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
postinstall=`echo "$$MODULE_POSTINSTALL_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
post=`echo "$$MODULE_POST_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
cat debian.module/$(if $(MODULE_NOARCH_$*),control-noarch.in,control.in) | sed \
-e "s#%%NAME%%#unit-$(MODULE_SUFFIX_$*)#g" \
-e "s#%%NAME%%#$(BRAND)-$(MODULE_SUFFIX_$*)#g" \
-e "s#%%OLDNAME%%#unit-$(MODULE_SUFFIX_$*)#g" \
-e "s#%%PACKAGE%%#$(BRAND)#g" \
-e "s#%%RUNTIME%%#$(RUNTIME)#g" \
-e "s#%%SUMMARY%%#$(MODULE_SUMMARY_$*)#g" \
-e "s#%%CODENAME%%#$(CODENAME)#g" \
-e "s#%%UNIT_VERSION%%#$(VERSION)#g" \
-e "s#%%UNIT_RELEASE%%#$(RELEASE)#g" \
-e "s#%%VERSION%%#$(MODULE_VERSION_$*)#g" \
-e "s#%%RELEASE%%#$(MODULE_RELEASE_$*)#g" \
-e "s#%%HOMEPAGE%%#$(HOMEPAGE)#g" \
-e "s#%%PACKAGE_VENDOR%%#$(PACKAGE_VENDOR)#g" \
-e "s#%%MODULE_BUILD_DEPENDS%%#$(MODULE_BUILD_DEPENDS_$*)#g" \
-e "s#%%MODULE_DEPENDS%%#$(MODULE_DEPENDS_$*)#g" \
> $@/$(SRCDIR)/debian/control ; \
cat debian.module/$(if $(MODULE_NOARCH_$*),rules-noarch.in,rules.in) | sed \
-e "s#%%NAME%%#unit-$(MODULE_SUFFIX_$*)#g" \
-e "s#%%NAME%%#$(BRAND)-$(MODULE_SUFFIX_$*)#g" \
-e "s#%%RUNTIME%%#$(RUNTIME)#g" \
-e "s#%%CODENAME%%#$(CODENAME)#g" \
-e "s#%%UNIT_VERSION%%#$(VERSION)#g" \
-e "s#%%UNIT_RELEASE%%#$(RELEASE)#g" \
Expand Down Expand Up @@ -294,24 +379,24 @@ unit-%: check-build-depends-% | debuild-%

test: unit modules
@{ \
for so in `find debuild-*/unit-$(VERSION)/debian/build-unit/ -type f \( -name "*.so" -o -name "*.jar" \)`; do \
for so in `find debuild-*/$(SRCDIR)/debian/build-unit/ -type f \( -name "*.so" -o -name "*.jar" \)`; do \
soname=`basename $${so}` ; \
test "$${soname}" = "java.unit.so" && continue ; \
test -h debuild/unit-$(VERSION)/debian/build-unit/build/lib/$${soname} || \
ln -fs `pwd`/$${so} debuild/unit-$(VERSION)/debian/build-unit/build/lib/$${soname} ; \
test -h debuild/$(SRCDIR)/debian/build-unit/build/lib/$${soname} || \
ln -fs `pwd`/$${so} debuild/$(SRCDIR)/debian/build-unit/build/lib/$${soname} ; \
done ; \
( cd debuild/unit-$(VERSION)/debian/build-unit && env python3 -m pytest --user=nobody $(PYTEST_ARGS) ) ; \
( cd debuild/$(SRCDIR)/debian/build-unit && env python3 -m pytest --user=nobody $(PYTEST_ARGS) ) ; \
}

test-debug: unit modules
@{ \
for so in `find debuild-*/unit-$(VERSION)/debian/build-unit-debug/ -type f \( -name "*.so" -o -name "*.jar" \)`; do \
for so in `find debuild-*/$(SRCDIR)/debian/build-unit-debug/ -type f \( -name "*.so" -o -name "*.jar" \)`; do \
soname=`basename $${so}` ; \
test "$${soname}" = "java.unit.so" && continue ; \
test -h debuild/unit-$(VERSION)/debian/build-unit-debug/build/lib/$${soname} || \
ln -fs `pwd`/$${so} debuild/unit-$(VERSION)/debian/build-unit-debug/build/lib/$${soname} ; \
test -h debuild/$(SRCDIR)/debian/build-unit-debug/build/lib/$${soname} || \
ln -fs `pwd`/$${so} debuild/$(SRCDIR)/debian/build-unit-debug/build/lib/$${soname} ; \
done ; \
( cd debuild/unit-$(VERSION)/debian/build-unit-debug && env python3 -m pytest --user=nobody $(PYTEST_ARGS) ) ; \
( cd debuild/$(SRCDIR)/debian/build-unit-debug && env python3 -m pytest --user=nobody $(PYTEST_ARGS) ) ; \
}

clean:
Expand Down
Loading