Skip to content

Instantly share code, notes, and snippets.

@marcelhollerbach
Last active September 19, 2017 07:02
Show Gist options
  • Save marcelhollerbach/8f77cb866d3484a27302debd92662d93 to your computer and use it in GitHub Desktop.
Save marcelhollerbach/8f77cb866d3484a27302debd92662d93 to your computer and use it in GitHub Desktop.
# Maintainer: Marcel Hollerbach mail@bu5hm4n.de
_pkgname=anna
pkgname=$_pkgname
pkgdesc="Spawny with a efl greeter"
pkgver=0.1
pkgrel=1
url="http://github.com/marcelhollerbach/anna"
arch=('i686' 'x86_64')
license=('BSD')
depends=('efl' 'protobuf-c')
makedepends=('git' 'meson')
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
source=("https://github.com/marcelhollerbach/anna/archive/v0.1.tar.gz" 'spawny.sysusers' 'spawny.install' 'spawny.tmpfiles')
install=spawny.install
sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
mkdir -p build
cd build
rm -rf ./*
meson ..
ninja all
}
check() {
cd "${srcdir}/${pkgname}-${pkgver}/build"
ninja test
}
package() {
cd "${srcdir}/${pkgname}-${pkgver}/build"
DESTDIR="$pkgdir" ninja install
install -D -m644 ${srcdir}/spawny.sysusers ${pkgdir}/usr/lib/sysusers.d/spawny.conf
install -D -m644 ${srcdir}/spawny.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/spawny.conf
}
post_install() {
sp-greeter-set /usr/local/bin/anna
}
u spawny - "Spawny greeter user" /var/lib/spawny
d /var/lib/spawny - - - - -
@leiflm
Copy link

leiflm commented Apr 18, 2017

split packages. build using makepkg -d:

_pkgname=spawny-anna
pkgname=('spawny-git' $_pkgname-git)
pkgdesc="The anna greeter with spawny in the package"
pkgver=0.1
pkgrel=1
arch=('i686' 'x86_64')
license=('BSD')
#depends=('efl')
makedepends=('git' 'protobuf-c' 'spawny-git')
source=("git+https://github.com/marcelhollerbach/spawny.git" "git+https://github.com/marcelhollerbach/anna.git")
conflicts=('')

sha256sums=('SKIP' 'SKIP')

package_spawny-git() {
  conflicts=('spawny')
  provides=('spawny' 'spawny-git')
  cd spawny
  git submodule update --init --recursive
  cmake . -DCMAKE_INSTALL_PREFIX=/usr
  make all
  make DESTDIR="$pkgdir" install
}

package_spawny-anna-git() {
  provides=('spawny-anna' 'spawny-anna-git')
  conflicts=('spawny-anna')
  depends=('spawny-git')
  cd anna
  git submodule update --init --recursive
  cmake . -DCMAKE_INSTALL_PREFIX=/usr
  make all
  make DESTDIR="$pkgdir" install
}

@marcelhollerbach
Copy link
Author

Mhmm it turns out that is not how the build function is working.

if you provide more than one package per PKGBUILD you have a single build() function and multiple package_xxxxx functions ...

@marcelhollerbach
Copy link
Author

Okay, i still dont really like the fact that the same pkg build needs to be run twice, i think i am doing to add seperated pkgbuilds for spawny and anna ...

@NuLogicSystems
Copy link

NuLogicSystems commented Apr 27, 2017

Here is what I've got for you:

For spawny:

# Maintainer: James Kittsmiller (AJSlye) <james@kittsmiller.com>

_pkgname=spawny
pkgname=$_pkgname-git
pkgver=r210.4898952
pkgrel=1
pkgdesc="A filemanager build with EFL"
arch=('i686' 'x86_64')
url="http://www.enlightenment.org"
license=('BSD')
depends=('protobuf-c')
makedepends=('git'  'cmake')
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
source=("git+https://github.com/marcelhollerbach/$_pkgname")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_pkgname"

  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/$_pkgname"
 
  git submodule update --init --recursive
  cmake . -DCMAKE_INSTALL_PREFIX:PATH=/usr/ -DCMAKE_INSTALL_LIBDIR=/usr/lib

  make all
}

package() {
  cd "$srcdir/$_pkgname"

  make DESTDIR="$pkgdir" install

  # install license files
  install -Dm644 AUTHORS "$pkgdir/usr/share/licenses/$pkgname/AUTHORS"
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

@NuLogicSystems
Copy link

NuLogicSystems commented Apr 27, 2017

and for anna:

# Maintainer: James Kittsmiller (AJSlye) <james@kittsmiller.com>

_pkgname=anna
pkgname=$_pkgname-git
pkgver=r7.4107f25
pkgrel=1
pkgdesc="Anna is an EFL based greeter for spawny."
arch=('i686' 'x86_64')
license=('BSD')
depends=('efl' 'spawny-git')
makedepends=('git' 'cmake' )
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
source=("git+https://github.com/marcelhollerbach/$_pkgname")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_pkgname"

  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/$_pkgname"
 
  cmake . -DCMAKE_INSTALL_PREFIX:PATH=/usr/ -DCMAKE_INSTALL_LIBDIR=/usr/lib

  make all
}

package() {
  cd "$srcdir/$_pkgname"

  make DESTDIR="$pkgdir" install

  # install license files
  install -Dm644 AUTHORS "$pkgdir/usr/share/licenses/$pkgname/AUTHORS"
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
} 

@NuLogicSystems
Copy link

NuLogicSystems commented Apr 27, 2017

Although anna probably should have an Install file or a sed line that does this:

change the configuration file <spawny_prefix>/etc/spawny/spawny.ini, and change the property "cmd" to "<anna_prefix>/bin/anna-greeter"

@marcelhollerbach
Copy link
Author

Thank you for all the comments! I have updated now spawny and anna to build with meson. This now makes it possible to have it as one single package.

@NuLogicSystems
Copy link

NuLogicSystems commented Sep 18, 2017

Would not build for me, so I took it upon myself to fix the pkgbuild file.

# Maintainer: Marcel Hollerbach mail@bu5hm4n.de
_pkgname=anna
pkgname=$_pkgname
pkgdesc="Spawny with a efl greeter"
pkgver=0.1
pkgrel=1
url="http://github.com/marcelhollerbach/anna"
arch=('i686' 'x86_64')
license=('BSD')
depends=('efl' 'protobuf-c')
makedepends=('git' 'meson')
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
install=spawny.install
source=("https://github.com/marcelhollerbach/anna/archive/v0.1.tar.gz" 'spawny.sysusers' 'spawny.tmpfiles')
sha256sums=('SKIP' 'SKIP' 'SKIP')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  meson --buildtype=release --prefix=/usr --sysconfdir=/etc build/
  ninja -C build/
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ninja -C build/ test
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  DESTDIR="$pkgdir" ninja -C build/ install
  install -D -m644 ${srcdir}/spawny.sysusers ${pkgdir}/usr/lib/sysusers.d/spawny.conf
  install -D -m644 ${srcdir}/spawny.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/spawny.conf
}

Note: I usually build all my packages by adding CFLAGS="$CFLAGS -fvisibility=hidden", but for some reason your code dosn't like this, and fails to build at random places in subprojects/spawny-0.5.1/src/tests/test_suite@exe/test_templatereg.c.o, with ninja: build stopped: subcommand failed.

@NuLogicSystems
Copy link

NuLogicSystems commented Sep 18, 2017

It builds but I get this error installing it:

Usage: sp-greeter-set <path-to-bin>
<path-to-bin> has to exist and must be readable
error: command failed to execute correctly

Might need to fix your .install file as well.

@NuLogicSystems
Copy link

NuLogicSystems commented Sep 18, 2017

Never mind I found it, /usr/local is only used when making user built packages.
Since i added --prefix=/usr to build for distribution, I needed to change this in the install file as well.

post_install() {
  sp-greeter-set /usr/bin/anna
}

Note: You might want to add a post_remove line in this file as well.

@marcelhollerbach
Copy link
Author

Cool! Yeah the package for now just sits in /usr/local, will change that at some point, will check the error when building with visibility=hidden.

@NuLogicSystems
Copy link

NuLogicSystems commented Sep 19, 2017

You don't need to add spawny.install to the source string, it's already in the install sting.
I've updated my previous PKGBUILD above to reflect this.

Should we also have the install file enable the deamon and greater, or just have it output a massage with instructions to run?

systemctl enable sp-daemon.socket sp-greeter-start

@marcelhollerbach
Copy link
Author

Not too sure about that. enabling and starting the socket ... maybe, but really not sure about the sp-greeter-start ... maybe someone installs just to try ... and then has lightdm & spawny that will fight for the best fitting vt and who gets the attention ? :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment