You are not logged in.
Hello all,
I'm hoping to submit my first PKGBUILD to the AUR. It's based on a small package that enables the use of an Apple Superdrive on alternative hardware, and includes a udev rule to automatically run the binary when a superdrive is plugged in. The original code is not mine, I've only written the PKGBUILD and included a udev rule.
My repo: https://github.com/n8henrie/superdrive-enabler-git
Direct link to my PKGBUILD: https://github.com/n8henrie/superdrive- … r/PKGBUILD
Source repo: https://github.com/onmomo/superdrive-enabler
It seems to build, install, and work as expected, the only namcap error I see is: `lacks FULL RELRO, check LDFLAGS` -- I'm not sure if this is okay to ignore.
As it's my first PKGBUILD, I just wanted to see if it seemed read to submit or if there were any concerns -- thanks in advance.
EDIT: For easier access, I've copied the text of the PKGBUILD below.
# Maintainer: Nathan Henrie <nate@n8henrie.com>
pkgname="superdrive-enabler-git"
_pkgname="superdrive-enabler"
pkgver=r9.809e81e
pkgrel=1
pkgdesc="Hack for Apple's Superdrive to work with other systems than OSX and MBA"
arch=("x86_64")
url="https://github.com/onmomo/superdrive-enabler"
license=("unknown")
makedepends=("git")
depends=("glibc")
source=(
"${_pkgname}-${pkgver}::git+https://github.com/onmomo/superdrive-enabler.git"
"50-apple-superdrive.rules"
)
sha256sums=(
"SKIP"
"5c0e6d95cc38c10111af59097a24dd36ee3789d0dceeef50355f3b293e129b95"
)
backup=("usr/lib/udev/rules.d/50-apple-superdrive.rules")
provides=("superdrive-enabler")
build() {
cd "${_pkgname}-$pkgver"
gcc -o "${_pkgname}" src/superdriveEnabler.c
}
package() {
mkdir -p "$pkgdir/usr/lib/udev/rules.d/"
cp 50-apple-superdrive.rules "$pkgdir/usr/lib/udev/rules.d/50-apple-superdrive.rules"
cd "${_pkgname}-$pkgver"
install -D -m755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
}
pkgver() {
cd "${_pkgname}-$pkgver"
echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}
Last edited by n8henrie (2019-04-11 17:15:35)
Offline
I hope you find the following constructive n8henrie.
license=("unknown")
Please ask upstream to clarify what license it is distributed under.
"${_pkgname}-${pkgver}::git+https://github.com/onmomo/superdrive-enabler.git"
Minor but I do not see the reason to extract to "${_pkgname}-${pkgver} and I am not sure if it would break if ${pkgver} was changed by the pkgver() function meaning the path would not match.
backup=("usr/lib/udev/rules.d/50-apple-superdrive.rules")
udev rules can be modified by users by providing an overriding rule in /etc/udev/rules.d without modifying the package provide rule in usr/lib/udev/rules.d/ so it does not need to be a backup
gcc -o "${_pkgname}" src/superdriveEnabler.c
If you use the Makefile that links with LDFLAGS does that add FULL RELRO?
mkdir -p "$pkgdir/usr/lib/udev/rules.d/"
cp 50-apple-superdrive.rules "$pkgdir/usr/lib/udev/rules.d/50-apple-superdrive.rules"
Very minor point install can be used to create the directory and copy the udev rule and is preferred to copy unless in such cases.
pkgver() {
Very minor point pkgver is normally placed after checksums/validpgpkeys before prepare()/build()
Last edited by loqs (2019-04-11 17:57:26)
Offline
I hope you find the following constructive n8henrie.
I do, thanks so much.
Please ask upstream to clarify what license it is distributed under.
I should have mentioned that I did this before posting: https://github.com/onmomo/superdrive-enabler/issues/1
Minor but I do not see the reason to extract to "${_pkgname}-${pkgver} and I am not sure if it would break if ${pkgver} was changed by the pkgver() function meaning the path would not match.
I was following one of the few examples I found, but you're right that it does break when version is updated -- I'll change this.
udev rules can be modified by users by providing an overriding rule in /etc/udev/rules.d without modifying the package provide rule in usr/lib/udev/rules.d/ so it does not need to be a backup
Good point, fixed.
If you use the Makefile that links with LDFLAGS does that add FULL RELRO?
Unclear -- the Makefile that comes with the project is full of a bunch of seemingly unnecessary stuff, so I have just built directly with gcc (as per the repo's README).
Very minor point install can be used to create the directory and copy the udev rule and is preferred to copy unless in such cases.
I'm not accustomed to using the install command, but this seems like a good opportunity to learn. Updated.
Very minor point pkgver is normally placed after checksums/validpgpkeys before prepare()/build()
Updated, thanks.
I'll have a new version up shortly.
Offline
compile and link in one step so pass in $CPPFLAGS $CFLAGS $LDFLAGS
gcc $CPPFLAGS $CFLAGS $LDFLAGS -o "${_pkgname}" src/superdriveEnabler.c
compile in first step passing in $CPPFLAGS $CFLAGS then link in second passing in $LDFLAGS
gcc $CPPFLAGS $CFLAGS -o src/superdriveEnabler.o "${_pkgname}" src/superdriveEnabler.c
gcc $LDFLAGS -o "${_pkgname}" src/superdriveEnabler.o
Offline
Thanks again. New version (no namcap messages):
# Maintainer: Nathan Henrie <nate@n8henrie.com>
pkgname="superdrive-enabler-git"
_pkgname="superdrive-enabler"
pkgver=r9.809e81e
pkgrel=1
pkgdesc="Hack for Apple's Superdrive to work with other systems than OSX and MBA"
arch=("x86_64")
url="https://github.com/onmomo/superdrive-enabler"
license=("unknown")
makedepends=("git")
depends=("glibc")
source=(
"${_pkgname}::git+https://github.com/onmomo/superdrive-enabler.git"
"50-apple-superdrive.rules"
)
sha256sums=(
"SKIP"
"5c0e6d95cc38c10111af59097a24dd36ee3789d0dceeef50355f3b293e129b95"
)
provides=("superdrive-enabler")
pkgver() {
cd "${_pkgname}"
echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}
build() {
cd "${_pkgname}"
gcc $CPPFLAGS $CFLAGS $LDFLAGS -o "${_pkgname}" src/superdriveEnabler.c
}
package() {
install -D 50-apple-superdrive.rules -t "$pkgdir/usr/lib/udev/rules.d/"
cd "${_pkgname}"
install -D -m755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
}
Offline
Thanks a ton, pushed! https://aur.archlinux.org/packages/supe … abler-git/
Had to run `git filter-branch --tree-filter 'makepkg --printsrcinfo > .SRCINFO' HEAD` was the only other glitch.
Should I mark this thread as [SOLVED]? Or is that not appropriate for here?
Offline