You are not logged in.

#1 2015-11-30 10:20:44

nivata
Member
Registered: 2014-05-30
Posts: 20

Help creating a PKGBUILD

Hi everyone,


I'm trying to install the profiler Zoom from RotateRight on my computer. It's a free but proprietary software, and it comes with a crappy install.sh script that tries to compile and install its own kernel modules. I'm trying to create a PKGBUILD to install it properly but it's giving me a hard time, so I'd need some help doing so.

So far here is the PKGBUILD I'v come up with:

pkgname=rotateright-zoom
pkgver=3.3.3
pkgrel=1
pkgdesc="Zoom is a performance analysis tool for applications running on the Linux and Mac OS X operating systems from RotateRight"
arch=('x86_64')
url="http://www.rotateright.com/"
license=('proprietary')
source=("${url}download/Zoom-${pkgver}/Zoom_${pkgver}_Linux-${arch}.tar.gz")
md5sums=('2a92ecc973ec94f6c4801e686d0b2e3b') # 64-bit version

PKGEXT=".pkg.tar"

package() {
	cd ${srcdir}/Zoom_${pkgver}_Linux-${arch}

	# patch insall script
	patch install.sh ${startdir}/install.patch

	# run install script
	./install.sh --install_path ${pkgdir}
}

And the `install.patch` file I used (disclaimer: my ${pkgdir} is currently hardcoded as /tmp/makepkg)

321a322,328
> pkgdir=/tmp/makepkg/rotateright-zoom/pkg/rotateright-zoom
> find . -name "*.sh" -exec sed -i "s|/var|${pkgdir}/var|g" {} \;
> find . -name "*.sh" -exec sed -i "s|/usr|${pkgdir}/usr|g" {} \;
> mkdir -p ${pkgdir}/var/log
> mkdir -p ${pkgdir}/{bin,etc,usr/{bin,lib,local/lib},tmp}
> mkdir -p ${pkgdir}/usr/share/{applications,pixmaps,mime}
> 

So I got 2 questions right now:
1) How to deal with the drivers/kernel modules Zoom wants to install?
2) Is it possible to make the install.sh script non-interactive? (By feeding it fake user-input.)

Offline

#2 2015-11-30 13:16:57

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

Re: Help creating a PKGBUILD

You don't need to use the install script, check Zoom_ReleaseNotes.html ,   install > linux > manual override .


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)

Offline

#3 2015-11-30 14:13:19

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

Re: Help creating a PKGBUILD

This might be rendered unnecessary based on Lone_Wolf's comment, but if you keep the patch for the install script, you should apply it in the prepare function, definitely not in the package function.

Also why are you trying to override the PKGEXT?  This seems like a very bad idea to me - though I've seen it a couple times recently, so perhaps I'm missing some relevant motivation to do so.

EDIT: also, unless I'm missing something else, there is something wrong with your source links.  All I get is the EULA, a release notes html file, and the installation script.  There is nothing actually to be installed [1] other than the license file ... which looks like it might not actually be installed.

I just tried it out to confirm, and first there is a missing dependency for chrpath, then, the whole installation is interactive, which would not be allowed in a PKGBUILD, and even then when I went through the interactive process if failed with a long string of these

./setup.sh: line 88: /var/log/Zoom-install.log: Permission denied

Apparently it tried to install to the root directory directly rather than to the pkg directory.

EDIT 2: note [1]: Oh f**** *** ***, that's stupid.  They have "hidden" tar archives within the tarballed download.  That is perhaps the dumbest thing I've ever seen.  Use with caution - a precompiled binary from someone that would do something that abnoxious and stupid should definitely not be trusted.


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

Offline

#4 2015-11-30 15:35:13

nivata
Member
Registered: 2014-05-30
Posts: 20

Re: Help creating a PKGBUILD

Thanks for your comments !

@Lone_Wolf: I didn't see that. Seems that it would be a better option indeed. I'll look into it and give an update.

@Trilby:

if you keep the patch for the install script, you should apply it in the prepare function, definitely not in the package function.

The script wants to be run as root. So I'm running the ./install.sh in the package() function because it's the only part that is launched with fakeroot.


Also why are you trying to override the PKGEXT?

No idea tbh. This is a leftover from a PKGBUILD I used as a base, and I agree I should probably remove it.


Btw Tthe error you get:

./setup.sh: line 88: /var/log/Zoom-install.log: Permission denied

Is because the install script tries to write in a log file directly under /var/log. The patch I made for the install script should take care of that (but other issues persist).


I haven't checked the dependencies yet. I tried to get rid of the interactive part by having a `< input_cmd` where `input_cmd` is a file containing the expected answers ("y\nnqy", stuff like that — I don't remember the exact sequence). But it doesn't work and I don't know why.

Also I agree that this hidden .tar business is pretty stupid, but the soft itself is quite nice from what my Ubuntu friend showed me.

Offline

#5 2015-11-30 16:14:53

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

Re: Help creating a PKGBUILD

nivata wrote:

The script wants to be run as root. So I'm running the ./install.sh in the package() function because it's the only part that is launched with fakeroot.

Oh, absolutely, the install.sh should be run from the package function.  But the patch itself should be applied in the prepare function.

nivata wrote:

I haven't checked the dependencies yet. I tried to get rid of the interactive part by having a `< input_cmd` where `input_cmd` is a file containing the expected answers ("y\nnqy", stuff like that — I don't remember the exact sequence). But it doesn't work and I don't know why.

I don't really have experience with it myself, but I beleive [extra]/expect is designed exactly for these types of situations - that could be used, and listed as a build-dep.

nivata wrote:

Also I agree that this hidden .tar business is pretty stupid, but the soft itself is quite nice from what my Ubuntu friend showed me.

Yeah, sorry, my reaction may have been out of proportion - but it was my honest reaction.  Personally I wouldn't trust a provider that does something like that - but this shouldn't get in the way of helping you put together a PKGBUILD for it (except to the extent that I'll be cautious in testing it).


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

Offline

#6 2015-11-30 16:19:41

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Help creating a PKGBUILD

Just a very minor point (and it's probably not a violation of any rule) but don't think the name of the app should be in the pkgdesc.

Offline

#7 2015-11-30 16:46:47

nivata
Member
Registered: 2014-05-30
Posts: 20

Re: Help creating a PKGBUILD

@Trilby:

Oh, absolutely, the install.sh should be run from the package function.  But the patch itself should be applied in the prepare function.

Oh, I see your point, that's right. Tbh I made up this patch without much thinking, just to get a minimal not-so-running example.

Personally I wouldn't trust a provider that does something like that - but this shouldn't get in the way of helping you put together a PKGBUILD for it (except to the extent that I'll be cautious in testing it).

Well, there's a reason I want to install it via pacman/PKGBUILD instead of running the install.sh as root directly big_smile


@oliver: What do you mean? The package name (rotateright-zoom) is different from the actual program name (Which is only 'Zoom'). So how would you do it?


Either way, thanks to the point raised by Lone_Wolf, my PKGBUILD now looks like that:

pkgname=rotateright-zoom
pkgver=3.3.3
pkgrel=1
pkgdesc="Zoom is a performance analysis tool for applications running on the Linux and Mac OS X operating systems from RotateRight"
arch=('x86_64')
url="http://www.rotateright.com/"
license=('proprietary')
source=("${url}download/Zoom-${pkgver}/Zoom_${pkgver}_Linux-${arch}.tar.gz")
md5sums=('2a92ecc973ec94f6c4801e686d0b2e3b') # 64-bit
makedepends=('linux-headers')
optdepends=('perf')

unpack() {
	dir_name=`dirname $1`
	base_name_pack=`basename $1`
	base_name_jar=${base_name_pack%.pack}
	unpack200 ${dir_name}/${base_name_pack} ${dir_name}/${base_name_jar}
	rm -f ${dir_name}/${base_name_pack}
}

package() {
	cd ${srcdir}/Zoom_${pkgver}_Linux-${arch}

	# Unpack the Zoom archive
	mkdir -p ${pkgdir}/opt/rotateright
	tar -xf .rotateright.tar -C ${pkgdir}/opt/rotateright

	# Unpack the jar archives
	cd ${pkgdir}/opt/rotateright/Zoom/plugins
	find . -name "*.jar.pack" | while read file; do unpack "$file"; done

	# Compile and install the rrnotify kernel module
	cd ${pkgdir}/opt/rotateright/Zoom/setup/kmod
	tar -xvf rrnotify.tar
	pushd rrnotify
	make
	./install.sh
	popd
}

The last step right now doesn't work, I'm getting an error:

/tmp/makepkg/rotateright-zoom/pkg/rotateright-zoom/opt/rotateright/Zoom/setup/kmod/rrnotify/buffer_sync.c:140:2: error: implicit declaration of function ‘do_posix_clock_monotonic_gettime’ [-Werror=implicit-function-declaration]
  do_posix_clock_monotonic_gettime(&end_time);

I'm not sure exactly where this comes from, still investigating the issue.

Last edited by nivata (2015-11-30 17:28:47)

Offline

#8 2015-12-01 16:44:05

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: Help creating a PKGBUILD

nivata wrote:

@oliver: What do you mean? The package name (rotateright-zoom) is different from the actual program name (Which is only 'Zoom'). So how would you do it?

Like I said, probably not violating any rule but...

Zoom is a performance analysis tool...
versus
A performance analysis tool...

I just think putting the name in the description (even if it differs from the pkgname) is redundant

Offline

#9 2015-12-01 17:30:29

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Help creating a PKGBUILD

https://wiki.archlinux.org/index.php/PKGBUILD#pkgdesc

pkgdesc

The description of the package. This is recommended to be 80 characters or less and should not include the package name in a self-referencing way, unless the application name differs from the package name. For example, use pkgdesc="Text editor for X11" instead of pkgdesc="Nedit is a text editor for X11".

So according to the Wiki, this package should include the name in the description, because it is different from the $pkgname. tongue

Last edited by eschwartz (2015-12-01 17:30:47)


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

Offline

#10 2015-12-01 20:08:10

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

Re: Help creating a PKGBUILD

Erm, no.  The wiki certainly does not say the name should be included.  Saying "do not do X, at least not unless Y" is not the same as saying "If Y you should do X".

Leave out the binary/package/whatever name if it is used in a self-referential way, which in this case it was.


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

Offline

#11 2015-12-02 08:30:02

nivata
Member
Registered: 2014-05-30
Posts: 20

Re: Help creating a PKGBUILD

Hum, from what I understand of the quoted sentence, the name could be included in the pkgdesc, precisely because the app name differs from the pkgname. Not to say that it should, but at the same time, it doesn't say it should not be in the pgkdesc (again because the app name differs from the pkgname). Also, clearly the current pkgdesc (which I copied mindlessly from the official website) is more than 80 characters long. Leaving out the app name in the description makes it easier to fit under the character limit:

pkgdesc="A performance analysis tool for applications running on Linux and Mac OS X."

Anyway, for the compile error I reported earlier, it seems it indicates incompatible kernel versions. But I'm no linux kernel expert, so this issue might be a tad tricky to solve =/

Offline

#12 2015-12-02 13:41:01

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

Re: Help creating a PKGBUILD

Also if you want to shorten that desciption you can drop all the OS support stuff.  The PKGBUILD is not for something to run on OSX.  And that it will run on linux is a given seeing that there is a PKGBUILD.

pkgdesc="A perfomance analysis tool for applications"

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

Offline

Board footer

Powered by FluxBB