You are not logged in.

#1 2020-06-29 18:48:49

TheSheepGuy
Member
Registered: 2020-04-13
Posts: 15

PKGBUILD review request: famistudio-bin

FamiStudio (GitHub repo) is an NES music creation software. I chose to use the provided binary since their compilation method requires opening the solution in MonoDevelop and then compiling it that way (I don't know of an alternative way to do it using bash though I guess it isn't impossible). There are a couple of things that I'd like to have some help with.

* How can I include the MIT license if it isn't provided in the ZIP source? It's available in the git repo, but it isn't in the ZIP binary.
* Should I include the two lines of comments or remove them when I upload it to the AUR?

PKGBUILD:

# Maintainer: Patrick Ausel <TheSheepGuy1@gmail.com>
pkgname=famistudio-bin
pkgver=2.1.0
pkgrel=1
pkgdesc="An NES Music Editor"
arch=("x86_64")
url="https://famistudio.org/"
license=("MIT")
depends=(mono gtk-sharp-2)
makedepends=(gendesk)
source=("$pkgname-$pkgver.zip::https://github.com/BleuBleu/FamiStudio/releases/download/2.1.0/FamiStudio210-LinuxAMD64.zip")
sha256sums=("4e7396ee3d0986eeb929b0a9683a63007abed9ecb5a8d42b90d4c6643eff63a5")

prepare() {
	gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc" --name="FamiStudio" --exec="/usr/bin/FamiStudio"
}

package() {
	mkdir -p $pkgdir/usr/lib
	echo $srcdir
	install -dm755 $pkgdir/usr/{bin,lib/FamiStudio/}
	rm $srcdir/$pkgname-$pkgver.zip
	cp -r $srcdir/* $pkgdir/usr/lib/FamiStudio

	# Include a little script which will avoid the user from typing "mono FamiStudio.exe".
	# This is the recommended approach, as per https://www.mono-project.com/docs/getting-started/application-deployment/ .
	touch $pkgdir/usr/bin/FamiStudio
	echo '#!/bin/sh
	exec /usr/bin/mono /usr/lib/FamiStudio/FamiStudio.exe "$@"' > $pkgdir/usr/bin/FamiStudio
	chmod +x $pkgdir/usr/bin/FamiStudio

	install -Dm644 "$srcdir/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
}

Offline

#2 2020-06-30 11:12:23

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

Re: PKGBUILD review request: famistudio-bin

Download the LICENSE file from the repo and add it to the source array.
You could also raise an issue upstream to discuss adding licenses to binary releases.

I'd probably put the wrapper in a separate file that gets added to source array , but still add a comment describing it .
Without such comments many people checking the PKGBUILD will wonder why you're adding something to upstream code."

Yes, keep the comments.

rm $srcdir/$pkgname-$pkgver.zip
cp -r $srcdir/* $pkgdir/usr/lib/FamiStudio

I guess the sourcefile doesn't extract to a separate directory ?

Personally I prefer separate commands to make clear what is copied/installed .

Last edited by Lone_Wolf (2020-06-30 11:13:30)


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#3 2020-06-30 14:48:00

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,537

Re: PKGBUILD review request: famistudio-bin

TheSheepGuy wrote:

FamiStudio (GitHub repo) is an NES music creation software. I chose to use the provided binary since their compilation method requires opening the solution in MonoDevelop and then compiling it that way (I don't know of an alternative way to do it using bash though I guess it isn't impossible). There are a couple of things that I'd like to have some help with.

* How can I include the MIT license if it isn't provided in the ZIP source? It's available in the git repo, but it isn't in the ZIP binary.
* Should I include the two lines of comments or remove them when I upload it to the AUR?

PKGBUILD:

# Maintainer: Patrick Ausel <TheSheepGuy1@gmail.com>
pkgname=famistudio-bin
pkgver=2.1.0
pkgrel=1
pkgdesc="An NES Music Editor"
arch=("x86_64")
url="https://famistudio.org/"
license=("MIT")
depends=(mono gtk-sharp-2)
makedepends=(gendesk)
source=("$pkgname-$pkgver.zip::https://github.com/BleuBleu/FamiStudio/releases/download/2.1.0/FamiStudio210-LinuxAMD64.zip")
source+=("LICENSE-$pkgname-$pkgver::https://github.com/BleuBleu/FamiStudio/blob/$pkgver/LICENSE")
TheSheepGuy wrote:
sha256sums=("4e7396ee3d0986eeb929b0a9683a63007abed9ecb5a8d42b90d4c6643eff63a5")

prepare() {
	gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc" --name="FamiStudio" --exec="/usr/bin/FamiStudio"
}

Why depend on gendesk, which gets information wrong:

[Desktop Entry]
Version=1.0
Type=Application
Name=FamiStudio
Comment=An NES Music Editor
Exec=/usr/bin/FamiStudio
Icon=famistudio-bin
Terminal=false
StartupNotify=false
Categories=Application;Development;TextEditor;

When instead you could ship your own and not waste CPU time heuristically guessing one?

[Desktop Entry]
Version=1.1
Type=Application
Name=FamiStudio
Comment=NES Music Editor
TryExec=FamiStudio
Exec=FamiStudio

Note the gendesk categories are wrong, the icon is wrong because no such icon is installed (and the software will not have any menu icon, period), the optional-but-useful TryExec field is missing, StartupNotify was randomly guessed as false in blatant violation of the .destop file spec (unspecified means the implementation should guess a reasonable default, false means it is known to break), etc.

TheSheepGuy wrote:
package() {
	mkdir -p $pkgdir/usr/lib
	echo $srcdir
	install -dm755 $pkgdir/usr/{bin,lib/FamiStudio/}
	rm $srcdir/$pkgname-$pkgver.zip
	cp -r $srcdir/* $pkgdir/usr/lib/FamiStudio

	# Include a little script which will avoid the user from typing "mono FamiStudio.exe".
	# This is the recommended approach, as per https://www.mono-project.com/docs/getting-started/application-deployment/ .
	touch $pkgdir/usr/bin/FamiStudio
	echo '#!/bin/sh
	exec /usr/bin/mono /usr/lib/FamiStudio/FamiStudio.exe "$@"' > $pkgdir/usr/bin/FamiStudio
	chmod +x $pkgdir/usr/bin/FamiStudio

	install -Dm644 "$srcdir/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
}

Every instance of srcdir/pkgdir must be quoted.

Rather than deleting files (which fails in package() if you try using makepkg --repackage), I recommend using noextract=("$pkgname-$pkgver.zip") to prevent it from being extracted; you may then extract it manually in prepare() to its own directory, or straight to "$pkgdir"/usr/lib/FamiStudio in package().

I recommend adding the FamiStudio script in source=() as FamiStudio.sh, then using

install -Dm755 "$srcdir"/FamiStudio.sh "$pkgdir"/usr/bin/FamiStudio

Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2020-07-01 16:38:08

TheSheepGuy
Member
Registered: 2020-04-13
Posts: 15

Re: PKGBUILD review request: famistudio-bin

Should I host the FamiStudio.sh myself on my own repo? It's a file that's detailed on the Mono project website. The reason why I didn't have it in the sources is because it's not in the FamiStudio repo. Same question with the desktop entry. Should I host it myself or how should I go about including it?

Also, there is an icon for FamiStudio, but I think it's hidden in the .exe file. If I'm hosting the desktop entry myself then I might as well get the icon and host it too and include those two files in the sources array.

Here is the updated PKGBUILD with the license added and the source extracted manually using bsdtar.

# Maintainer: Patrick Ausel <TheSheepGuy1@gmail.com>
pkgname=famistudio-bin
pkgver=2.1.0
pkgrel=1
pkgdesc="An NES Music Editor"
arch=("x86_64")
url="https://famistudio.org/"
license=("MIT")
depends=(mono gtk-sharp-2)
source=("$pkgname-$pkgver.zip::https://github.com/BleuBleu/FamiStudio/releases/download/2.1.0/FamiStudio210-LinuxAMD64.zip"
        "$pkgname-$pkgver-LICENSE::https://raw.githubusercontent.com/BleuBleu/FamiStudio/master/LICENSE")
noextract=("$pkgname-$pkgver.zip")
sha256sums=("4e7396ee3d0986eeb929b0a9683a63007abed9ecb5a8d42b90d4c6643eff63a5" "5e3b4767eb00d525a783f678d7a8cf3c71a7fc33de218bbcfd84abf76a2b8106")

package() {
	install -dm755 "$pkgdir"/usr/{bin,lib/FamiStudio}
	bsdtar -x -C "$pkgdir"/usr/lib/FamiStudio -f "$pkgname-$pkgver.zip"
	install -Dm644 "$pkgname-$pkgver-LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

	# Include a little script which will avoid the user from typing "mono FamiStudio.exe".
	# This is the recommended approach, as per https://www.mono-project.com/docs/getting-started/application-deployment/ .
	echo '#!/bin/sh
	exec /usr/bin/mono /usr/lib/FamiStudio/FamiStudio.exe "$@"' > "$pkgdir"/usr/bin/famistudio
	chmod +x "$pkgdir"/usr/bin/famistudio
}

Last edited by TheSheepGuy (2020-07-01 16:41:56)

Offline

#5 2020-07-01 17:12:54

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,537

Re: PKGBUILD review request: famistudio-bin

TheSheepGuy wrote:

Should I host the FamiStudio.sh myself on my own repo? It's a file that's detailed on the Mono project website. The reason why I didn't have it in the sources is because it's not in the FamiStudio repo. Same question with the desktop entry. Should I host it myself or how should I go about including it?

Also, there is an icon for FamiStudio, but I think it's hidden in the .exe file. If I'm hosting the desktop entry myself then I might as well get the icon and host it too and include those two files in the sources array.

Simply include the source lines:

"FamiStudio.sh"
"FamiStudio.desktop"

and git commit them to the AUR alongside the PKGBUILD. This is a common method for storing *small* files which are needed for packaging, but not available upstream.

Regarding the icon hidden in the executable, there is probably some program you could makedepend on to extract it from the executable during package(). But I'm not knowledgeable about mono software or Windows executables. So you'd need to look this up yourself.

Last edited by eschwartz (2020-07-01 17:14:05)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2020-07-01 23:19:32

TheSheepGuy
Member
Registered: 2020-04-13
Posts: 15

Re: PKGBUILD review request: famistudio-bin

Thank you very much! I think this is now finished. Let me know if it works fine, I'll upload it to the AUR if someone confirms or I don't get a reply in the next few days.

PKGBUILD

# Maintainer: Patrick Ausel <TheSheepGuy1@gmail.com>
pkgname=famistudio-bin
pkgver=2.1.0
pkgrel=1
pkgdesc="An NES Music Editor"
arch=("x86_64")
url="https://famistudio.org/"
license=("MIT")
depends=(mono gtk-sharp-2)
makedepends=(icoutils)
source=("$pkgname-$pkgver.zip::https://github.com/BleuBleu/FamiStudio/releases/download/2.1.0/FamiStudio210-LinuxAMD64.zip"
        "$pkgname-$pkgver-LICENSE::https://raw.githubusercontent.com/BleuBleu/FamiStudio/master/LICENSE"
        "famistudio-bin.desktop"
        "famistudio")
noextract=("$pkgname-$pkgver.zip")
sha256sums=("4e7396ee3d0986eeb929b0a9683a63007abed9ecb5a8d42b90d4c6643eff63a5" "5e3b4767eb00d525a783f678d7a8cf3c71a7fc33de218bbcfd84abf76a2b8106" "97f0b99e09c674a9e04c8a475f500e74d1c3b4bafe5a55bdc0153e79d0d2a6b5" "10c26fdcfcbc1ee33e81af503c0603c68e6df48ac038fa4dcff037b51478d7c9")

package() {
	cd "$srcdir"
	install -dm755 "$pkgdir"/usr/{bin,lib/FamiStudio}
	bsdtar -x -C "$pkgdir"/usr/lib/FamiStudio -f "$pkgname-$pkgver.zip"

	# Get the icon for the application and copy it to the appropriate location.
	wrestool -x --output=famistudioicon.ico -t14 "$pkgdir"/usr/lib/FamiStudio/FamiStudio.exe
	icotool -x famistudioicon.ico
	install -Dm644 famistudioicon_1_128x128x32.png "$pkgdir"/usr/share/pixmaps/famistudio.png

	# Include a little script which will avoid the user from typing "mono FamiStudio.exe".
	# This is the recommended approach, as per https://www.mono-project.com/docs/getting-started/application-deployment/ .
	install -Dm755 famistudio "$pkgdir"/usr/bin/famistudio

	install -Dm644 "$pkgname".desktop "$pkgdir"/usr/share/applications/$pkgname.desktop
	install -Dm644 "$pkgname"-$pkgver-LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

famistudio-bin.desktop

[Desktop Entry]
Type=Application
Version=1.1
Name=FamiStudio
Comment=NES Music Editor
TryExec=FamiStudio
Exec=FamiStudio
Icon=famistudio
Terminal=false
Categories=AudioVideo;Audio;Music;Midi;

famistudio

#!/bin/sh
exec /usr/bin/mono /usr/lib/FamiStudio/FamiStudio.exe "$@"

Offline

#7 2020-07-02 00:28:22

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,537

Re: PKGBUILD review request: famistudio-bin

Some small tweaks:

  • you should use $pkgver instead of hardcoding 2.1.0 in the .zip url, otherwise updating the package will require changing the version in two places and you might forget one of them. wink

  • the LICENSE file should be downloaded from https://raw.githubusercontent.com/BleuB … .0/LICENSE since it might change. One obvious thing which might change is the year listed in the copyright line. In fact, use $pkgver here too.

  • the file famistudioicon_1_128x128x32.png seems to be a 128 x 128 image. You can install it to the modern equivalent of pixmaps: /usr/share/icons/hicolor/128x128/apps/${pkgname}.png and likewise install other sizes to the relevant directory replacing "128x128" in the destination filename. This gives menu software and the like, a better chance to find icons in the right size for their use (rather than being forced to use the only size available). You could also install an SVG icon to /usr/share/icons/hicolor/scalable/apps/${pkgname}.svg but that depends on there being an SVG version of the icon which I'm betting not. Many things provide PNG icons only.

Other than that it's looking good. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2020-07-02 09:13:52

TheSheepGuy
Member
Registered: 2020-04-13
Posts: 15

Re: PKGBUILD review request: famistudio-bin

I'm having a different issue now. The desktop entry isn't valid, even though desktop-file-validate says it is. I cannot figure out what is wrong with it, maybe you guys can help a bit. The file is still the same,

[Desktop Entry]
Type=Application
Version=1.1
Name=FamiStudio
Comment=NES Music Editor
TryExec=FamiStudio
Exec=FamiStudio
Icon=famistudio
Terminal=false
Categories=AudioVideo;Audio;Music;Midi;

Offline

#9 2020-07-02 13:59:44

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,537

Re: PKGBUILD review request: famistudio-bin

TheSheepGuy wrote:

I'm having a different issue now. The desktop entry isn't valid, even though desktop-file-validate says it is.

What software is saying it isn't valid?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#10 2020-07-02 14:09:42

TheSheepGuy
Member
Registered: 2020-04-13
Posts: 15

Re: PKGBUILD review request: famistudio-bin

eschwartz wrote:

What software is saying it isn't valid?

Dolphin is when I try to launch it in /usr/share/applications.

Offline

#11 2020-07-02 14:21:56

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,537

Re: PKGBUILD review request: famistudio-bin

Is there an error message?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#12 2020-07-02 15:33:33

TheSheepGuy
Member
Registered: 2020-04-13
Posts: 15

Re: PKGBUILD review request: famistudio-bin

eschwartz wrote:

Is there an error message?

An unhelpful one.
FamiStudio desktop entry error message

Offline

#13 2020-07-02 21:14:09

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,537

Re: PKGBUILD review request: famistudio-bin

Well, they did ask you to submit a bug report. big_smile

I dunno, that looks broken in a way I'm not sure what to do about. It would seem to be dolphin's fault.

Last edited by eschwartz (2020-07-02 21:14:54)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB