commit 9edd4794dd467487d6f9ad7225bdd3e600b0ed2a
parent e68de0f7027ea97077a27b9ce1635af98909770e
Author: Stefan Koch <programming@stefan-koch.name>
Date: Sun, 3 May 2020 22:23:18 +0200
create a PKGBUILD file to build an arch package
Diffstat:
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/.cinderella.toml b/.cinderella.toml
@@ -6,11 +6,8 @@ commands = [
[build-master]
# Always build the latest master for usage on my server
commands = [
- "cargo build --release",
- "cp target/release/cinderella /opt/cinderella/.cinderella",
- # use -f on deletion to avoid errors if file does not exist
- "rm -f /opt/cinderella/cinderella",
- "mv /opt/cinderella/.cinderella /opt/cinderella/cinderella",
+ "make",
+ "make install",
]
when = "\"%BRANCH\" == \"master\""
@@ -19,7 +16,7 @@ commands = [
# set the tag number as tool version
"sed -i -e 's/^version = .*/version = \"%TAG\"/' Cargo.toml",
- "cargo build --release",
+ "make",
"cp target/release/cinderella \"/opt/cinderella/cinderella-%TAG\"",
]
when = "\"%REFTYPE\" == \"tag\""
diff --git a/Makefile b/Makefile
@@ -0,0 +1,22 @@
+.PHONY: build-release install package-arch
+
+build-release:
+ cargo build --release
+
+install: build-release
+ # this process allows existing processes to continue while installing
+ # a new version for all subsequent callers
+ cp target/release/cinderella /opt/cinderella/.cinderella
+ # use -f on deletion to avoid errors if file does not exist
+ rm -f /opt/cinderella/cinderella
+ mv /opt/cinderella/.cinderella /opt/cinderella/cinderella
+
+package-arch:
+ # Unfortunately, PKGBUILD has to be in the same directory as the build
+ cp packages/arch/PKGBUILD .
+ # Ensure that makepkg does not overwrite src/ folder
+ # -e: Do not try to extract any source, because we use the source in
+ # current directory
+ SRCDEST=src_makepkg makepkg -e
+ rm PKGBUILD
+ rm -r src_makepkg pkg
diff --git a/packages/arch/PKGBUILD b/packages/arch/PKGBUILD
@@ -0,0 +1,20 @@
+pkgname="cinderella"
+pkgver=${PKGVER}
+pkgrel=1
+pkgdesc="Lightweight continuous integration program"
+arch=("x86_64")
+license=("MIT")
+# Build from local source directory
+source=()
+# Options to build from Git
+#source=("${pkgname}::git+https://github.com/aufziehvogel/cinderella.git#branch=master")
+#md5sums=('SKIP')
+
+build() {
+ cd ..
+ cargo build --release --locked
+}
+
+package() {
+ install -Dm 755 ${srcdir}/../target/release/${pkgname} -t "${pkgdir}/usr/bin"
+}