]> gitweb.hhaalo.de Git - scantopdf.git/commitdiff
build package with make file
authorBastian Dehn <hhaalo@arcor.de>
Mon, 1 Dec 2025 19:15:06 +0000 (20:15 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 1 Dec 2025 19:15:06 +0000 (20:15 +0100)
Makefile
build-package [deleted file]
src/control

index 361d7f9c0de7a8c53294b5412aba2e3ffc3f7ad0..b2aafc1dde23d4522796cdb6cae3c26d2c0de4df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,63 @@
-all:
-       ./build-package
+VERSION = 1.1.2
+BUILDVERSION = 1
+ARCHITECTURE = amd64
+PACKAGENAME = scantopdf-$(VERSION)-$(BUILDVERSION)-$(ARCHITECTURE)
+
+all: test package
+
+test:
+       ./tests/scanbasic.bats
+
+build: build/$(PACKAGENAME)/usr/local/bin/scantopdf \
+       build/$(PACKAGENAME)/usr/local/bin/scantopdfgray \
+       build/$(PACKAGENAME)/usr/local/bin/scantopdfbw \
+
+build/$(PACKAGENAME)/usr/local/bin/scantopdf:
+       mkdir -p build
+       mkdir -p build/$(PACKAGENAME)/usr/local/bin
+       cat src/scantopdf \
+                       | sed "/@scanbasic.sh@/r src/scanbasic.sh" \
+                       | sed "/@scanbasic.sh@/d" \
+                       | sed "s/@VERSION@/$(VERSION)/" \
+                       > build/$(PACKAGENAME)/usr/local/bin/scantopdf
+       chmod 755 build/$(PACKAGENAME)/usr/local/bin/scantopdf
+
+build/$(PACKAGENAME)/usr/local/bin/scantopdfgray:
+       mkdir -p build
+       mkdir -p build/$(PACKAGENAME)/usr/local/bin
+       cat src/scantopdfgray \
+                       | sed "/@scanbasic.sh@/r src/scanbasic.sh" \
+                       | sed "/@scanbasic.sh@/d" \
+                       | sed "s/@VERSION@/$(VERSION)/" \
+                       > build/$(PACKAGENAME)/usr/local/bin/scantopdfgray
+       chmod 755 build/$(PACKAGENAME)/usr/local/bin/scantopdfgray
+
+build/$(PACKAGENAME)/usr/local/bin/scantopdfbw:
+       mkdir -p build
+       mkdir -p build/$(PACKAGENAME)/usr/local/bin
+       cat src/scantopdfgray \
+                       | sed "/@scanbasic.sh@/r src/scanbasic.sh" \
+                       | sed "/@scanbasic.sh@/d" \
+                       | sed "s/@VERSION@/$(VERSION)/" \
+                       > build/$(PACKAGENAME)/usr/local/bin/scantopdfbw
+       chmod 755 build/$(PACKAGENAME)/usr/local/bin/scantopdfbw
+
+build/$(PACKAGENAME)/usr/local/share/scantopdf/cutpage.html:
+       mkdir -p build/$(PACKAGENAME)/usr/local/share/scantopdf
+       cp src/cutpage.html build/$(PACKAGENAME)/usr/local/share/scantopdf/cutpage.html
+
+build/$(PACKAGENAME)/DEBIAN/control:
+       mkdir -p build/$(PACKAGENAME)/DEBIAN
+       cat src/control \
+               | sed "s/@VERSION@/$(VERSION)/" \
+               > build/$(PACKAGENAME)/DEBIAN/control
+
+build/$(PACKAGENAME).deb: build \
+       build/$(PACKAGENAME)/usr/local/share/scantopdf/cutpage.html \
+       build/$(PACKAGENAME)/DEBIAN/control
+       cd build && dpkg-deb --build --root-owner-group $(PACKAGENAME)
+
+package: build/$(PACKAGENAME).deb
 
 clean:
        rm -rf build
\ No newline at end of file
diff --git a/build-package b/build-package
deleted file mode 100755 (executable)
index 6504da1..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-
-errlog()
-{
-       local lastexit=$?
-       local msg="$1"
-
-       echo "❌ ERROR: $msg"
-       echo "🛑 EXIT $lastexit"
-       return $lastexit
-}
-
-build_package()
-{
-       local VERSION="1.1.2"
-       local BUILDVERSION="1"
-       local ARCHITECTURE="amd64"
-       local PACKAGENAME="scantopdf-$VERSION-$BUILDVERSION-$ARCHITECTURE"
-       local EXECUTABLES="scantopdf \
-               scantopdfgray \
-               scantopdfbw"
-
-       echo "â„šī¸  INFO: build package $PACKAGENAME"
-
-       mkdir -p build
-       mkdir -p build/$PACKAGENAME/usr/local/bin
-
-       local executable=
-       local buildpath=
-       for executable in $EXECUTABLES; do
-               buildpath="build/$PACKAGENAME/usr/local/bin/$executable"
-               cat src/$executable \
-                       | sed "/@scanbasic.sh@/r src/scanbasic.sh" \
-                       | sed "/@scanbasic.sh@/d" \
-                       | sed "s/@VERSION@/$VERSION/" \
-                       > $buildpath
-               chmod 755 $buildpath
-       done
-
-       mkdir -p build/$PACKAGENAME/usr/local/share/scantopdf
-       cp src/cutpage.html build/$PACKAGENAME/usr/local/share/scantopdf/cutpage.html
-
-       mkdir -p build/$PACKAGENAME/DEBIAN
-       cat src/control \
-               | sed "s/\$VERSION/$VERSION/" \
-               > build/$PACKAGENAME/DEBIAN/control
-
-       cd build
-       dpkg-deb --build --root-owner-group $PACKAGENAME
-}
-
-run_tests()
-{
-       echo "â„šī¸  INFO: run tests"
-       ./tests/scanbasic.bats
-}
-
-main()
-{
-       echo "⭐ START: build-package"
-
-       [ -n "$SKIP_TESTS" ] \
-               || run_tests \
-               || errlog "tests failed" \
-               || return $?
-       build_package
-
-       echo "✅ SUCCESS: build-package"
-}
-
-main
index e2f836245945b9124e460f55104d433664a718c0..ae4745e9ff5c323ff9e0907bae5464afa7d17d85 100644 (file)
@@ -1,5 +1,5 @@
 Package: scantopdf
-Version: $VERSION
+Version: @VERSION@
 Priority: optional
 Section: graphics
 Maintainer: Bastian Dehn <hhaalo@arcor.de>