From 5ec5f0b5bea345f40b8641e7c171dc8ce13e2d57 Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 5 Jul 2023 22:45:36 +0200 Subject: [PATCH] Actual initial commit --- Makefile | 39 +++++++++++++++++++++++++++++++++++++++ PKGBUILD | 33 +++++++++++++++++++++++++++++++++ my-awesome-program | 4 ++++ options.mk | 8 ++++++++ 4 files changed, 84 insertions(+) create mode 100644 Makefile create mode 100644 PKGBUILD create mode 100755 my-awesome-program create mode 100644 options.mk diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bc215b6 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ +include options.mk + +help: + @echo "${NAME} help" + @echo + @echo "make install Install ${NAME}." + @echo "make uninstall Uninstall ${NAME}." + @echo "make clean: Remove tarballs." + @echo "make dist Create distro package for ${NAME}." + @echo "make pkg_arch Create Arch package ${NAME}." + +install: clean + cp ${NAME} ${PREFIX}${DESTDIR}/bin + chmod +x ${PREFIX}${DESTDIR}/bin/${NAME} + +uninstall: + rm -rf ~/.config/${NAME} + rm -f ${PREFIX}${DESTDIR}/bin/${NAME} + +clean: + rm -f *.tar* *zst* *${NAME}-${VER}.PKGBUILD + +dist: clean + mkdir -p ${NAME}-${VER} + cp ${NAME} README.md LICENSE Makefile *.mk ${NAME}-${VER} + [ -f "PKGBUILD" ] && cp -f PKGBUILD ${NAME}-${VER} || : + tar -cf ${NAME}-${VER}.tar ${NAME}-${VER} + gzip ${NAME}-${VER}.tar + rm -rf ${NAME}-${VER}.tar ${NAME}-${VER} + gpg --detach-sign --yes --local-user $$(whoami) ${NAME}-${VER}.tar.gz || : + +pkg_arch: dist + command -v makepkg > /dev/null || exit 1 + [ -f PKGBUILD ] || exit 1 + cp -f PKGBUILD PKGBUILD.orig + sed -i "s/VERSION/${VER}/g; s/MD5SUM/$$(md5sum *.tar.gz | cut -d ' ' -f 1)/g; s/NAME/${NAME}/g; s/DESC/${DESC}/g; s/URL/${URL}/g; s/LICENSE/${LICENSE}/g; s/DEPENDENCIES/${DEPENDENCIES}/g; s/GROUPS/${GROUPS}/g" PKGBUILD + makepkg -sfr --sign || exit 1 + rm -rf src/ pkg/ + cp PKGBUILD ${NAME}-${VER}.PKGBUILD; mv PKGBUILD.orig PKGBUILD diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..d0fde96 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,33 @@ +pkgname=NAME +pkgver=VERSION +pkgrel=1 +epoch= +pkgdesc="DESC" +arch=(x86_64) +url="URL" +license=('LICENSE') +groups=(GROUPS) + +depends=( + DEPENDENCIES +) + +makedepends=() +checkdepends=() +optdepends=() +provides=(NAME) +conflicts=() +replaces=() +backup=() +options=() +install= +changelog="" +source=("$pkgname-$pkgver.tar.gz") +noextract=() +md5sums=(MD5SUM) +validpgpkeys=() + +package() { + cd "$pkgname-$pkgver" + install -Dm755 ${pkgname} "${pkgdir}"/usr/bin/${pkgname} +} diff --git a/my-awesome-program b/my-awesome-program new file mode 100755 index 0000000..ac8bd6e --- /dev/null +++ b/my-awesome-program @@ -0,0 +1,4 @@ +#!/bin/sh +# my-awesome-program + +printf "%s:The makefile works perfectly.\n" "$0" diff --git a/options.mk b/options.mk new file mode 100644 index 0000000..8c36679 --- /dev/null +++ b/options.mk @@ -0,0 +1,8 @@ +NAME = my-awesome-program # Program name here. It will be added to the PKGBUILD automatically. +DESC = "My awesome description here" # Program description here. It will be added to the PKGBUILD automatically. +URL = "https://git.example.com/me/my-awesome-program" # URL to the program here. It will be added to the PKGBUILD automatically. +LICENSE = "GPL" # License of the program. It will be added to the PKGBUILD automatically. +VER = 0.1 # The version number here. It will be added to the PKGBUILD automatically. +DEPENDENCIES = "" # Dependencies for the program. It will be added to the PKGBUILD automatically. +GROUPS = "" # Groups the program is part of. It will be added to the PKGBUILD automatically. +PREFIX = "/usr" # Prefix