You are not logged in.

#1 2023-03-11 18:03:07

heidegger
Member
Registered: 2013-04-24
Posts: 69

JICMP - Please help with my very first PKGBUILD

This is the first step to accomplishing my goal as mentioned here: https://bbs.archlinux.org/viewtopic.php?id=283673.

The contents of the my PKGBUILD are as follows:

# Maintainer: Stephen Cenkner <scenkner at gmail>
pkgname=JICMP
pkgver=3.0.5
pkgrel=1
pkgdesc="A small library to allow the use of IPv4 ICMP (raw) packets in Java"
arch=('any')
url="https://github.com/OpenNMS/jicmp"
license=('GPL3')
depends=('git' 'jdk8-openjdk')
provides=(JICMP)
source=("https://github.com/OpenNMS/jicmp.git")
sha256sums=('8b22af6aec90ed0faf1634094d80612657dff1836225d83ef77b2f89f3ba1eeb')

build() {
  cd "$pkgname-$pkgver"
  git submodule update --init --recursive
  autoreconf -fvi
  ./configure
  make
}
 
package() {
  cd "$pkgname-$pkgver"

  make DESTDIR="$pkgdir/" install
}

I used updpkgsums to get the above checksum, however when I run makepkg, I get an error that it did not pass validity check.

Any help is appreciated.

I'm also confused as to referencing $pkgdir when it isn't defined at the top.

Thank you!

Offline

#2 2023-03-11 18:10:50

loqs
Member
Registered: 2014-03-06
Posts: 15,845

Re: JICMP - Please help with my very first PKGBUILD

See https://wiki.archlinux.org/title/VCS_pa … CS_sources so

source=("https://github.com/OpenNMS/jicmp.git")

to

source=("git+https://github.com/OpenNMS/jicmp.git")

pkgname must be lower case.
If you are not intending the package to track upstream git then pin the checkout.
The source is in $pkgname not $pkgname-$pkgver so the cd commands will fail.

Last edited by loqs (2023-03-11 18:11:13)

Offline

#3 2023-03-11 18:30:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 28,044
Website

Re: JICMP - Please help with my very first PKGBUILD

$pkgdir is defined by makepkg itself, so it is not specified in the PKGBUILD, just used (the same goes for $srcdir).

I suspect git is not a runtime dependency, is it?  It should likely be in makedepends, not depends.  And remove the "provides"; every package provides itself, that's a given.  Of course if you properly name the package with a -git suffix (which you either must add or instead use a pinned release as noted above), then you could keep the provides if you want.

EDIT: and the license is LGPL3 not GPL3.

EDIT 2: the submodule bits should be in prepare() not build() [and see comment below].  I believe autoreconf also belongs in prepare(), though I'm crap with autotools.

Last edited by Trilby (2023-03-11 18:37:05)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2023-03-11 18:32:54

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 10,773

Re: JICMP - Please help with my very first PKGBUILD

git submodule update --init --recursive

git submodules require a special tweak in a PKGBUILD, see https://wiki.archlinux.org/title/VCS_pa … submodules


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Online

#5 2023-03-11 19:33:56

heidegger
Member
Registered: 2013-04-24
Posts: 69

Re: JICMP - Please help with my very first PKGBUILD

Thank you all for your help!

I believe jdk8 is also required for the build only.
Once installed, JICMP is a dependency of openNMS which requires jdk11.

Considering this, should both be indicated as makedepends?
Should I include anything under depends?
I don't think JICMP is useful without any java so it may need depends=('java-environment-openjdk') or something similar.

Last edited by heidegger (2023-03-11 19:35:52)

Offline

#6 2023-03-11 20:42:40

loqs
Member
Registered: 2014-03-06
Posts: 15,845

Re: JICMP - Please help with my very first PKGBUILD

If it is a dependency of a package needing Java 11 then I would suggest makedepends include jdk11-openjdk and depends include jre11-openjdk.
From a brief inspection of the Makefile maven is required at build time so should also be in makedepends.

Offline

#7 2023-03-11 20:51:07

heidegger
Member
Registered: 2013-04-24
Posts: 69

Re: JICMP - Please help with my very first PKGBUILD

OK, I've successfully built the package using the following:

# Maintainer: Stephen Cenkner <scenkner at gmail>
pkgname=jicmp
pkgver=3.0.5
pkgrel=1
pkgdesc="A small library to allow the use of IPv4 ICMP (raw) packets in Java"
arch=('any')
url="https://github.com/OpenNMS/jicmp"
license=('LGPL3')
makedepends=('git' 'jdk8-openjdk')
provides=('jicmp')
conflicts=('jicmp')
source=("jicmp::git+https://github.com/OpenNMS/jicmp.git")
sha256sums=('SKIP')

prepare() {
  cd "$pkgname"
  git submodule update --init --recursive
}

build() {
  cd "$pkgname"
  autoreconf -fvi
  ./configure
  make
}

package() {
  cd "$pkgname"
  make DESTDIR="$pkgdir/" install
}

When I change the package name to jicmp-git, I get errors from cd as it's trying to change into the jicmp-git directory per the $pkgname, but the folder being created is dropping the -git.

I'm not sure why.

Offline

#8 2023-03-11 20:57:10

loqs
Member
Registered: 2014-03-06
Posts: 15,845

Re: JICMP - Please help with my very first PKGBUILD

heidegger wrote:

When I change the package name to jicmp-git, I get errors from cd as it's trying to change into the jicmp-git directory per the $pkgname, but the folder being created is dropping the -git.

source=("$pkgname::git+https://github.com/OpenNMS/jicmp.git")

Offline

#9 2023-03-11 21:00:43

Scimmia
Fellow
Registered: 2012-09-01
Posts: 10,193

Re: JICMP - Please help with my very first PKGBUILD

Or just cd to jicmp instead of using the variable. It really doesn't do anything for you and there's no reason to rename the source dir.

I'm seeing a lot of C in the upstream repo, are you sure this is arch=('any')? If there are any architecture-specific binaries, it can't be.

You didn't fix the submodule handling.

Last edited by Scimmia (2023-03-11 21:03:34)

Offline

#10 2023-03-11 21:00:59

heidegger
Member
Registered: 2013-04-24
Posts: 69

Re: JICMP - Please help with my very first PKGBUILD

loqs wrote:

If it is a dependency of a package needing Java 11 then I would suggest makedepends include jdk11-openjdk and depends include jre11-openjdk.
From a brief inspection of the Makefile maven is required at build time so should also be in makedepends.

JICMP uses some deprecated code (no backwards compatibility) so it must be built against jdk8.
However, once it's built openNMS requires jdk11, so it's really only a build time dependency. (I think.)

Eventually I hope to put together a PKGBUILD for openNMS, and I would plan to include the jdk11 dependency there.

I'll look into maven as a dependency.

Thank you!

Offline

#11 2023-03-11 21:04:14

loqs
Member
Registered: 2014-03-06
Posts: 15,845

Re: JICMP - Please help with my very first PKGBUILD

arch=('any')

The package includes the architecture specific libjicmp.so

  ./configure

missing --prefix=/usr so the default prefix /usr/local is used.

As a git package it should have a pkgver function.
Edit:
I checked building in a clean chroot without maven.  It was not used,  must not be being called by the default make target.
Edit2:

# Maintainer: Stephen Cenkner <scenkner at gmail>
pkgname=jicmp-git
pkgver=jicmp.3.0.4.1.r5.g8af53d1
pkgrel=1
pkgdesc="A small library to allow the use of IPv4 ICMP (raw) packets in Java"
arch=('x86_64')
url="https://github.com/OpenNMS/jicmp"
license=('LGPL3')
makedepends=('git' 'jdk8-openjdk')
provides=('jicmp')
conflicts=('jicmp')
source=(git+https://github.com/OpenNMS/jicmp.git
        git+https://github.com/OpenNMS/autotools.git)
sha256sums=('SKIP'
            'SKIP')

prepare() {
  cd "${pkgname%%-git}"
  git submodule init
  git config submodule.libs/m4.url "$srcdir/autotools"
  git -c protocol.file.allow=always submodule update
  autoreconf -fvi
}

pkgver() {
  cd "${pkgname%%-git}"
  git describe --long --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "${pkgname%%-git}"
  ./configure --prefix=/usr
  make
}

package() {
  cd "${pkgname%%-git}"
  make DESTDIR="$pkgdir/" install
}

Last edited by loqs (2023-03-11 21:31:56)

Offline

#12 2023-03-11 21:34:51

heidegger
Member
Registered: 2013-04-24
Posts: 69

Re: JICMP - Please help with my very first PKGBUILD

Happy I made it this far!

[camus@daftpunk AUR_jicmp]$ sudo pacman -Qi jicmp
Name            : jicmp-git
Version         : 3.0.5-1
Description     : A small library to allow the use of IPv4 ICMP (raw) packets in Java
Architecture    : x86_64
URL             : https://github.com/OpenNMS/jicmp
Licenses        : LGPL3
Groups          : None
Provides        : jicmp
Depends On      : None
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : jicmp
Replaces        : None
Installed Size  : 44.96 KiB
Packager        : Unknown Packager
Build Date      : Sat 11 Mar 2023 01:22:34 PM PST
Install Date    : Sat 11 Mar 2023 01:24:57 PM PST
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None
# Maintainer: Stephen Cenkner <scenkner at gmail>
pkgname=jicmp-git
pkgver=3.0.5
pkgrel=1
pkgdesc="A small library to allow the use of IPv4 ICMP (raw) packets in Java"
arch=('x86_64')
url="https://github.com/OpenNMS/jicmp"
license=('LGPL3')
depends=()
makedepends=('git' 'jdk8-openjdk')
provides=('jicmp')
conflicts=('jicmp')
source=("jicmp::git+https://github.com/OpenNMS/jicmp.git")
sha256sums=('SKIP')

prepare() {
  cd "jicmp"
  git submodule update --init --recursive
}

build() {
  cd "jicmp"
  autoreconf -fvi
  ./configure --prefix=/usr
  make
}

package() {
  cd "jicmp"
  make DESTDIR="$pkgdir/" install
}

To Do:
Fix the submodule handling.
Include the pkgver function.

I appreciate any more notes you may have!
Stepping away for a while.

Offline

#13 2023-03-11 21:50:51

loqs
Member
Registered: 2014-03-06
Posts: 15,845

Re: JICMP - Please help with my very first PKGBUILD

pkgver function and possibly changing how you handle the submodule see my edit2 to post #11
In the todo list.
If I understand correctly java 11 compatibility is broken by javah being dropped in java 10+,  the replacement being javac -h which is available from java 8 but not supported by OpenNMS.

Last edited by loqs (2023-03-11 21:51:37)

Offline

Board footer

Powered by FluxBB