From: Bastian Dehn Date: Mon, 1 Dec 2025 19:15:06 +0000 (+0100) Subject: build package with make file X-Git-Tag: v1.1.3^2~6 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=09ede8af254cf477f7644988733f00e45e82b63f;p=scantopdf.git build package with make file --- diff --git a/Makefile b/Makefile index 361d7f9..b2aafc1 100644 --- 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 index 6504da1..0000000 --- a/build-package +++ /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 diff --git a/src/control b/src/control index e2f8362..ae4745e 100644 --- a/src/control +++ b/src/control @@ -1,5 +1,5 @@ Package: scantopdf -Version: $VERSION +Version: @VERSION@ Priority: optional Section: graphics Maintainer: Bastian Dehn