You are not logged in.
Pages: 1
Hello everyone,
I've written a PKGBUILD for MOAI (http://getmoai.com/) but I'm not sure about a couple of things.
- I've seen in several other git-based packages that pkgver is a date (I suppose it's the packaging date). Is this a good practice?
- I'm not sure about which dependencies are really needed. I used ldd and pkgfile to discover the shared libraries which were needed but I didn't include all of them.
The full list (minus proprietary driver) is here: http://pastebin.com/4YZ7MjG2. Is there a better way?
This is the PKGBUILD (which is working fine here):
# Maintainer: Federico Rampazzo < myemail at gmail >
pkgname=moai-git
pkgver=20130208
pkgrel=1
pkgdesc=''
arch=('any')
url='https://github.com/moai/moai-dev'
license=('custom:CPAL')
depends=('freeglut' 'glu' 'libgl' 'libxmu' 'libxi' 'zlib')
makedepends=('git' 'cmake')
_gitroot='git://github.com/moai/moai-dev.git'
_gitname='moai-dev'
build() {
msg 'Connecting to GIT server...'
if [[ -d ${_gitname} ]]
then
cd ${_gitname}
git pull
else
git clone ${_gitroot}
cd ${_gitname}
fi
git checkout linux
msg 'GIT checkout done or server timeout'
cd cmake/
cmake .
make moai
}
package() {
cd ${_gitname}
install -d ${pkgdir}/usr/bin
install cmake/moai/moai \
${pkgdir}/usr/bin
}
Thanks in advance
Offline
If you want to test your package for mistakes or missing / not required dependencies, take a look at namcap (pacman -S namcap). Simply run "namcap foo.tar.xz" will show you the output.
For creating a new package, it's best to use the prototypes which are included in the package abs (pacman -S abs). Then look them up in /usr/share/pacman.
Your package looks ok so far, but include a pkgdesc! And in your package() function you can do this with a oneliner
package() {
install -Dm755 "$srcdir/$_gitname/cmake/moai/moai" "$pkgdir/usr/bin/moai"
}
edit: namcap will show you, that you have to include the license, since it's not a license which is in the license package.
Last edited by Army (2013-02-08 15:11:18)
Offline
For GIT packages, the pkgver is automatically updated by makepkg right now - and it uses the date. Pacman/makepkg 4.1 will change that, but it's still a month or more away. If you make the package tomorrow, you'll see that the pkgver automatically changes to tomorrow's date.
For the deps, I would tend to error on the side of caution and include too many, especially since there's nothing unusual in that list. You only need to include the "top level" deps; looking at it, freeglut satisfies the majority of the packages in the list.
A couple of other notes, is this really an arch=('any') package? That's for packages that are completely architecture independent like scripts or data. If this compiles to a executable binary, you need arch=('i686' 'x86_64)
The install commands should include permissions at least. Both of your install statements could be written as one, "install -Dm755 cmake/moai/moai "$pkgdir/usr/bin/moai"
The rest has some real problems, especially with the "cd" commands. Please install the abs package if you don't have it installed already and refer to /usr/share/pacman/PKGBUILD-git.proto. If you have any specific questions about it, ask.
Offline
Thank you for your suggestions!
- namcap helped me with the unused dependencies and it turned out that freeglut was the only needed dependency
- I've fixed the arch, the pkgdesc and I've added the license
- I've replaced my build function with the one from PKGBUILD-git.proto (I just removed the double-clone and added the appropriate build steps)
Thanks again, I hope this is the final version
# Maintainer: Federico Rampazzo < mymail at gmail >
pkgname=moai-git
pkgver=20130208
pkgrel=1
pkgdesc='A Open Source cross-platform LUA-based tool to develop games, focused on mobile'
arch=('x86' 'x86_64')
url='https://github.com/moai/moai-dev'
license=('custom:CPAL')
depends=('freeglut')
makedepends=('git' 'cmake')
source=('CPAL')
sha256sums=('30d53bf709e16d849116bff147c59e4dfc8091672c324fc6af9caac1881c80ac')
_gitroot='git://github.com/moai/moai-dev.git'
_gitname='moai-dev'
pkgver () {
echo $(date +%Y%m%d)
}
build() {
cd "$srcdir"
msg "Connecting to GIT server...."
if [[ -d "$_gitname" ]]; then
cd "$_gitname" && git pull origin
msg "The local files are updated."
else
git clone "$_gitroot" "$_gitname"
fi
msg "GIT checkout done or server timeout"
msg "Starting build..."
git checkout linux
cd cmake
cmake .
make moai
}
package() {
install -Dm755 "$srcdir/$_gitname/cmake/moai/moai" "$pkgdir/usr/bin/moai"
install -Dm644 "$srcdir/CPAL" "$pkgdir/usr/share/licenses/$pkgname/CPAL"
}
Offline
It's been mentioned previously, but I still suggest following the abs prototypes.
For example, this lets you build without dirtying your git source.
rm -rf "$srcdir/$_gitname-build"
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
cd "$srcdir/$_gitname-build"
Also, 'x86' won't be recognized as an arch string. Use what Scimmia wrote.
Last edited by tdy (2013-02-08 16:53:07)
Offline
The pkgver function is redundant right now, makepkg does that for you and doesn't recognize the function anyway. In 4.1, there's a better way than using the date anyway. See Allan's blog for details.
The second clone is making a copy of the original clone that you build in the copy, not in the original. Gives you a clean build dir every time you rebuild the package.
I don't see where you cd into the build dir at all, you cd cmake directly from $srcdir. That isn't going to work.
Offline
Thanks again, fixed the typos and sticked with the prototype!
# Maintainer: Federico Rampazzo < myemail at gmail >
pkgname=moai-git
pkgver=20130208
pkgrel=1
pkgdesc='A Open Source cross-platform LUA-based tool to develop games, focused on mobile'
arch=('i386' 'x86_64')
url='https://github.com/moai/moai-dev'
license=('custom:CPAL')
depends=('freeglut')
makedepends=('git' 'cmake')
source=('CPAL')
sha256sums=('30d53bf709e16d849116bff147c59e4dfc8091672c324fc6af9caac1881c80ac')
_gitroot='git://github.com/moai/moai-dev.git'
_gitname='moai-dev'
build() {
cd "$srcdir"
msg "Connecting to GIT server...."
if [[ -d "$_gitname" ]]; then
cd "$_gitname" && git pull origin
msg "The local files are updated."
else
git clone "$_gitroot" "$_gitname"
cd "$_gitname" && git checkout linux
fi
msg "GIT checkout done or server timeout"
msg "Starting build..."
rm -rf "$srcdir/$_gitname-build"
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
cd "$srcdir/$_gitname-build"
msg "GIT checkout done or server timeout"
msg "Starting build..."
cd cmake
cmake .
make moai
}
package() {
install -Dm755 "$srcdir/$_gitname-build/cmake/moai/moai" "$pkgdir/usr/bin/moai"
install -Dm644 "$srcdir/CPAL" "$pkgdir/usr/share/licenses/$pkgname/CPAL"
}
Last edited by frampone (2013-02-08 17:56:04)
Offline
just about there, arch should be i686, not i386
Grammatical issue on pkgdesc, "A Open Source ..." should be "An Open Source..."
Offline
Fixed! Thanks for your patience!
Hope you enjoy the package, MOAI is pretty interesting
Offline
Pages: 1