From 897a36e8e07d900111d50e46009b7b673096f489 Mon Sep 17 00:00:00 2001 From: Er2 Date: Tue, 9 Nov 2021 21:24:13 +0300 Subject: [PATCH] may be working packaging for arch and alpine --- .gitignore | 2 +- Makefile | 28 ++++++++++---------- data/gresource.xml | 13 ---------- data/meson.build | 2 +- meson.build | 8 +++--- tools/APKBUILD | 34 ++++++++++++++++++++++++ {DEBIAN => tools/DEBIAN}/control | 4 +-- tools/DEBIAN/postinst | 4 +++ tools/PKGBUILD | 44 ++++++++++++++++++++++++++++++++ tools/er2cord.install | 9 +++++++ tools/er2cord.post-deinstall | 1 + tools/er2cord.post-install | 5 ++++ 12 files changed, 120 insertions(+), 34 deletions(-) create mode 100644 tools/APKBUILD rename {DEBIAN => tools/DEBIAN}/control (79%) create mode 100644 tools/DEBIAN/postinst create mode 100644 tools/PKGBUILD create mode 100644 tools/er2cord.install create mode 120000 tools/er2cord.post-deinstall create mode 100644 tools/er2cord.post-install diff --git a/.gitignore b/.gitignore index 01321a1..60c834d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ *~ build/ -dist/ +dist/*er2cord* # may be in fatpak, maybe not .flatpak-builder diff --git a/Makefile b/Makefile index 520227f..3c4bbc1 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,22 @@ -# FOR JUST BUILD USE MESON -# THIS IS A PACKAGING TOOL +# You can still use meson, but can make NAME = er2cord -BDIR = /tmp/$(NAME) +DESTDIR ?= / -all: tar deb clean +all: build +build: build/$(NAME) -base: - mkdir -p dist - meson build --prefix=$(BDIR) +build/$(NAME): + meson build + ninja -C build + +install: build ninja -C build install -tar: base - tar -C $(BDIR) -cvzf dist/$(NAME).tar.gz ./ - -deb: base - cp -r DEBIAN/ $(BDIR) - -dpkg-deb -b $(BDIR) dist/$(NAME).deb +docs: build + mkdir -p "$(DESTDIR)" + find dist/ ! -name '*er2cord*' -exec cp -f "{}" "$(DESTDIR)" \; clean: - rm -rf build $(BDIR) + rm -rf build + diff --git a/data/gresource.xml b/data/gresource.xml index 237bb92..04ea058 100644 --- a/data/gresource.xml +++ b/data/gresource.xml @@ -2,18 +2,5 @@ style.css - diff --git a/data/meson.build b/data/meson.build index f8ce9a0..f2aa97d 100644 --- a/data/meson.build +++ b/data/meson.build @@ -18,4 +18,4 @@ install_data( install_dir: schemas_dir, rename: [meson.project_name() + '.gschema.xml'] ) -meson.add_install_script('glib-compile-schemas', schemas_dir) +#meson.add_install_script('glib-compile-schemas', schemas_dir) diff --git a/meson.build b/meson.build index 3e89df1..6cf2dc9 100644 --- a/meson.build +++ b/meson.build @@ -1,9 +1,11 @@ -project('org.er2.cord', ['vala', 'c'], version: '1.0') +project('org.er2.cord', ['vala', 'c'], version: '0.1.0') datadir = get_option('prefix') / get_option('datadir') +name = 'er2cord' + conf = configuration_data() -conf.set_quoted('ID', 'org.er2.cord') # meson.project_name()) +conf.set_quoted('ID', meson.project_name()) conf.set_quoted('VERSION', meson.project_version()) conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) conf.set_quoted('DATADIR', get_option('prefix') / get_option('datadir')) @@ -44,7 +46,7 @@ subdir('data') subdir('po') executable( - 'er2cord', + name, source, dependencies: deps, diff --git a/tools/APKBUILD b/tools/APKBUILD new file mode 100644 index 0000000..a57c790 --- /dev/null +++ b/tools/APKBUILD @@ -0,0 +1,34 @@ +# Maintainer: Er2 +pkgname=er2cord +pkgver=0.1.0 +pkgrel=0 +pkgdesc="WIP GTK4 Chat" +url="https://gitdab.com/er2/er2cord" +arch="all" +options="!check" +license="Zlib" +makedepends="gtk4.0-dev vala meson" +depends="gtk4.0" +install="$pkgname.post-install $pkgname.post-deinstall" +source="$pkgname.tar.gz" +subpackages="$pkgname-doc" + +builddir="$srcdir/$pkgname" + +prepare() { + default_prepare +} + +build() { + make +} + +package() { + DESTDIR="$pkgdir" make install +} + +doc() { + pkgdesc="$pkgdesc (docs)" + DESTDIR="$subpkgdir" make docs +} + diff --git a/DEBIAN/control b/tools/DEBIAN/control similarity index 79% rename from DEBIAN/control rename to tools/DEBIAN/control index 5d96bc9..2881013 100644 --- a/DEBIAN/control +++ b/tools/DEBIAN/control @@ -1,9 +1,9 @@ Package: er2cord -Version: 1.0 +Version: 0.1.0 Section: development Priority: optional Architecture: amd64 Maintainer: Er2 -Depends: +Depends: libgtk-4-1 (>= 4.1.0) Homepage: https://gitdab.com/er2/er2cord Description: WIP GTK4 chat. diff --git a/tools/DEBIAN/postinst b/tools/DEBIAN/postinst new file mode 100644 index 0000000..de1e9a1 --- /dev/null +++ b/tools/DEBIAN/postinst @@ -0,0 +1,4 @@ +#!/bin/sh +chmod +x /usr/bin/er2cord +glib-compile-schemas /usr/share/glib-2.0/schemas +exit 0 diff --git a/tools/PKGBUILD b/tools/PKGBUILD new file mode 100644 index 0000000..331a8bc --- /dev/null +++ b/tools/PKGBUILD @@ -0,0 +1,44 @@ +# Maintainer: Er2 +pkgname=er2cord +pkgver=0.1.0 +pkgrel=1 +epoch= +pkgdesc="WIP GTK4 Chat" +arch=('any') +url="https://gitdab.com/er2/er2cord" +license=('Zlib') +groups=() +depends=('gtk4>=4.0') +makedepends=('vala>=0.54' 'meson>=0.60') +checkdepends=() +optdepends=() +provides=() +conflicts=() +replaces=() +backup=() +options=() +install=('er2cord.install') +changelog= +source=("$pkgname.tar.gz") +noextract=() +md5sums=() +validpgpkeys=() + +prepare() { + cd "$pkgname" +} + +build() { + cd "$pkgname" + make +} + +check() { + # no checks ;) +} + +package() { + cd "$pkgname" + make install +} + diff --git a/tools/er2cord.install b/tools/er2cord.install new file mode 100644 index 0000000..d1227bd --- /dev/null +++ b/tools/er2cord.install @@ -0,0 +1,9 @@ +# Go to PKGBUILD + +post_install() { + glib-compile-schemas /usr/share/glib-2.0/schemas +} + +post_remove() { + glib-compile-schemas /usr/share/glib-2.0/schemas +} diff --git a/tools/er2cord.post-deinstall b/tools/er2cord.post-deinstall new file mode 120000 index 0000000..154761a --- /dev/null +++ b/tools/er2cord.post-deinstall @@ -0,0 +1 @@ +/home/er2/proj/erc/tools/er2cord.post-install \ No newline at end of file diff --git a/tools/er2cord.post-install b/tools/er2cord.post-install new file mode 100644 index 0000000..883cf13 --- /dev/null +++ b/tools/er2cord.post-install @@ -0,0 +1,5 @@ +#!/bin/sh + +glib-compile-schemas /usr/share/glib-2.0/schemas + +exit 0 \ No newline at end of file