You are not logged in.

#1 2021-11-11 00:23:56

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 244

PKGBUILD help - crawley

I have this PKGBUILD almost working:

# Maintainer: Ícar N. S. <icar.nin@protonmail.com>
_name=crawley
pkgname=$_name-bin
pkgver=1.1.4
pkgrel=1
pkgdesc="The unix-way web crawler"
arch=(x86_64 aarch64)
url="https://github.com/s0rg/crawley"
license=('MIT')
#depends=()
#makedepends=()
provides=($_name)
conflicts=($_name $_name-git)
source_x86_64=("$pkgname-$pkgver-x86_64.tar.gz::$url/releases/download/v${pkgver}/crawley_${pkgver}_linux_x86_64.tar.gz")
source_aarch64=("$pkgname-$pkgver-aarch64.tar.gz::$url/releases/download/v${pkgver}/crawley_${pkgver}_linux_arm64.tar.gz")
sha256sums_x86_64=('a6f468289141a63060d1fb08c6784f50514c1d804b79f283e320afc7ba87ace0')
sha256sums_aarch64=('be0b71d656971d12140010a262de6b7b7ff9568e3921658bbb77f1936e3b84f6')

package_x86_64() {
	cd "$pkgname-$pkgver-x86_64"
    install -Dm551 $_name "$pkgdir"/usr/bin/$_name
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_aarch64() {
	cd "$pkgname-$pkgver-aarch64"
    install -Dm551 $_name "$pkgdir"/usr/bin/$_name
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

The issue I'm facing is that the generated pkg doesn't contain the binary that should be installed with the "install -Dm551 ..." command.

Any help would be appreciated.

Last edited by icar (2021-11-11 00:45:37)

Offline

#2 2021-11-11 00:36:41

loqs
Member
Registered: 2014-03-06
Posts: 14,282

Re: PKGBUILD help - crawley

package_x86_64()

Will never be called,  hence the empty package.  What if you replace $pkgname-$pkgver-x86_64 with $pkgname-$pkgver-$CARCH ?
Edit:
Minor niggles

conflicts=($_name $_name-git $_name-bin)

Conflicting with itself and missing license file.
Edit2:
The archive does not contain any directories so crawley is extracted to $srcdir no need to cd or use any path

    install -Dm551 $_name "$pkgdir"/usr/bin/$_name

Edit3:
Why is the mode not 755?

Last edited by loqs (2021-11-11 00:44:33)

Offline

#3 2021-11-11 00:45:10

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 244

Re: PKGBUILD help - crawley

- Updated with license included
- Updated conflicts
- $CARCH change produced same output

EDIT: Oops, missed the edits!

loqs wrote:

Why is the mode not 755?

I don't know, this seemed alright: no need for writing to a binary. Is it needed? Is there any convention?

Thanks for pointing out the directory issue - I'd expect that makepkg would complain! Unfortunately, it still is producing an empty pkg.

Last edited by icar (2021-11-11 00:51:44)

Offline

#4 2021-11-11 00:46:48

loqs
Member
Registered: 2014-03-06
Posts: 14,282

Re: PKGBUILD help - crawley

You changed to using package() instead of package_x86_64() ?

package() {
    install -Dm551 $_name "$pkgdir"/usr/bin/$_name
}

Last edited by loqs (2021-11-11 00:47:00)

Offline

#5 2021-11-11 00:55:28

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 244

Re: PKGBUILD help - crawley

Alright, final PKGBUILD that works! (I haven't tested it in a aarch64 computer)

# Maintainer: Ícar N. S. <icar.nin@protonmail.com>
_name=crawley
pkgname=$_name-bin
pkgver=1.1.4
pkgrel=1
pkgdesc="The unix-way web crawler"
arch=(x86_64 aarch64)
url="https://github.com/s0rg/crawley"
license=('MIT')
provides=($_name)
conflicts=($_name $_name-git)
source_x86_64=("$pkgname-$pkgver-x86_64.tar.gz::$url/releases/download/v${pkgver}/crawley_${pkgver}_linux_x86_64.tar.gz")
source_aarch64=("$pkgname-$pkgver-aarch64.tar.gz::$url/releases/download/v${pkgver}/crawley_${pkgver}_linux_arm64.tar.gz")
sha256sums_x86_64=('a6f468289141a63060d1fb08c6784f50514c1d804b79f283e320afc7ba87ace0')
sha256sums_aarch64=('be0b71d656971d12140010a262de6b7b7ff9568e3921658bbb77f1936e3b84f6')

package() {
    install -Dm775 $_name "$pkgdir"/usr/bin/$_name
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

https://aur.archlinux.org/packages/crawley-bin/

Thanks loqs, much appreciated!

Last edited by icar (2021-11-11 01:30:13)

Offline

#6 2021-11-11 01:26:19

loqs
Member
Registered: 2014-03-06
Posts: 14,282

Re: PKGBUILD help - crawley

In case you wanted to build it from source

pkgname=crawley
pkgver=1.1.4
pkgrel=1
pkgdesc="The unix-way web crawler"
arch=(x86_64 aarch64)
url="https://github.com/s0rg/crawley"
license=('MIT')
depends=('glibc')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('008d240fa3ee4bac11aac3dade8af8df5c57f6d2d68abfb82802306167f6d9c1')

prepare(){
  cd "$pkgname-$pkgver"
  mkdir -p build/
}

build() {
  cd "$pkgname-$pkgver"
  go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-X main.gitVersion=$pkgver -linkmode external -extldflags \"${LDFLAGS}\"" \
    -o build ./cmd/...
}

package() {
  cd "$pkgname-$pkgver"
  install -Dm755 build/$pkgname -t "$pkgdir"/usr/bin
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}

Last edited by loqs (2021-11-11 01:34:24)

Offline

#7 2021-11-11 01:29:18

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 244

Re: PKGBUILD help - crawley

Maybe you are interested in maintaining that crawley pkgbuild smile
I'm fine with the -bin one, thanks for your effort! I'll save it just in case.

Offline

Board footer

Powered by FluxBB