[Arch Linux] PKGBUILD

Support for running, installing or compiling OpenMW
Locked
User avatar
lgromanowski
Site Admin
Posts: 1143
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Github profile: https://github.com/lgromanowski
Contact:

[Arch Linux] PKGBUILD

Post by lgromanowski » 15 Aug 2011, 13:36

pvdk wrote: I finished my first PKGBUILD. It builds OpenMW for Arch Linux: it automates the retrieval of dependencies and builds a package for pacman, Arch's package manager.

It works on my machine, but I would like for it to be tested by other Arch users before submitting it to Arch User Repository (AUR). I know there are some Arch users here so any help would be greatly appreciated!

The package builds the latest Git revision from zinnschlag's repository. A PKGBUILD for a "stable" OpenMW is currently available on AUR but is hopelessly outdated and no longer maintained. (It builds OpenMW 0.0.6!)

You can find a .tar.gz containing the PKGBUILD and .install file here:

http://www.mediafire.com/file/qdqhg6bz2 ... 104.tar.gz

For the people who would like to test this PKGBUILD but do not know how to make a package (which I can't imagine ;) ) Look here:

https://wiki.archlinux.org/index.php/Makepkg


Currently OpenMW gets installed to /opt/openmw and the directory permissions are set to 777. I don't know if this is a good idea or not. Also, if the openmw executable is not started with /opt/openmw as PWD, Ogre will give an error whilst selecting a renderer. I guess this is because of plugins.cfg missing. It would be nice if OpenMW searched its installation directory for the configuration files instead of looking in the current working directory.

Regards,
pvdk

PS: I'm happy to report that OpenMW works with nouveau-dri/Gallium3D as gfx drivers!
Zini wrote: Great. I think we will address the path problems in 0.10.0 (work on it has already started).

Is there a default upload location for this kind of package (like Ubuntu ppa)? If yes, we could simply refer to it in the release posting. If not, we will include the package with the other packages.

btw. what you have pulled from github is the 0.9.0 release and it should be named as such.
pvdk wrote:
Zini wrote:Is there a default upload location for this kind of package...
Yeah, the AUR. You can find it here: http://aur.archlinux.org/
Tools like yaourt download and compile packages automagically from the AUR, really easy and saves alot of dependency downloading and configuring. Added value is the fact that you can uninstall AUR packages just like packages from the "normal" repositories.

The PKGBUILD just looks for the latest Git revision using the date specified by the pkgver variable. It happens to be the 0.9.0 release for now but I'd like to keep this package name (openmw-git) for later revisions. That way I can edit the PKGBUILD version without uploading a new package to the AUR. Just search for -git in AUR to see what I mean.

pvdk
fallenwizard wrote: I am an Arch user as well, and I have something to criticize:

These things in particular:
if [ -d ${_gitname} ] ; then
cd ${_gitname} && git pull origin && git submodule init && git submodule update
Don't use submodule init when you are updating, don't use &&. It's better to put it on a new line.
git clone ${_gitroot} ${_gitname} && git submodule init && git submodule update
It's better to use git submodule update --init instead of
git submodule init && git submodule update
Don't use &&.
cmake ../${_gitname} \
-DCMAKE_INSTALL_PREFIX=/opt
make
just use
cmake . -DCMAKE_INSTALL_PREFIX=/opt
make


It's less ugly and less error prone.

Everything else works fine for me.
Also you should claim the package at AUR before someone else does :)
pvdk wrote: Thanks fallenwizard! I didn't know you could do git submodule update and init with one command. Also, the other points you make are valid, I will edit the PKGBUILD. Happy it works for you too.

I forgot my AUR username but not my password. There's no way to retrieve your username at AUR so I have to figure something out before claiming openmw-git.

Regards.
pvdk wrote:
fallenwizard wrote:just use
cmake . -DCMAKE_INSTALL_PREFIX=/opt
make


It's less ugly and less error prone.
I use this method to create CMakeFiles etc. in the folder /build. With your method build fails with "You need to run this command from the top-level directory" etc. I saw this method in other PKGBUILDS, not my own idea :P

--Edit: New PKGBUILD:

Code: Select all

# Maintainer: Pieter van der Kloet <pvdkloet@gmail.com>
pkgname=openmw-git
pkgver=20110105
pkgrel=1
pkgdesc="OpenMW is a open-source engine reimplementation for the role-playing game Morrowind."
arch=('i686' 'x86_64')
url="http://www.openmw.com"
license=('GPL3')

depends=('openal' \
         'ogre' \
         'bullet' \
         'ffmpeg' \
         'mygui' \
         'mpg123' \
         'libsndfile')

makedepends=('git' 'cmake')
#install=${pkgname}.install # Commented out for testing
conflicts=('openmw')

_gitroot="git://github.com/zinnschlag/openmw.git"
_gitname="openmw"

build() {
  msg "Connecting to GIT server...."

  if [ -d ${_gitname} ] ; then
    cd ${_gitname} && git pull origin
    git submodule update
    msg "The local files are updated."
  else
    cd ${srcdir}
    git clone ${_gitroot} ${_gitname}
    git submodule update --init

  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."
  
  if [ ! -d ${srcdir}/build ]; then
      mkdir ${srcdir}/build
  fi

  # Create Makefiles in build dir
  cd ${srcdir}/build
  cmake ../${_gitname} \
         -DCMAKE_INSTALL_PREFIX=/opt
  make
  
  # Install
  sed -i 's,/usr/local/lib/OGRE,/usr/lib/OGRE,' plugins.cfg
  
  # There is currently no make install so we do this manually
  mkdir -p ${pkgdir}/opt/openmw
  cp openmw ${pkgdir}/opt/openmw
  cp esmtool ${pkgdir}/opt/openmw
  cp *.cfg ${pkgdir}/opt/openmw
  cp -r resources ${pkgdir}/opt/openmw
  chmod 0777 ${pkgdir}/opt/openmw  
}

package() {
  # For makepkg package creation 
  cd ${srcdir}/build
    
  mkdir -p ${pkgdir}/opt/openmw
  cp openmw ${pkgdir}/opt/openmw
  cp esmtool ${pkgdir}/opt/openmw
  cp *.cfg ${pkgdir}/opt/openmw
  cp -r resources ${pkgdir}/opt/openmw
  chmod 0777 ${pkgdir}/opt/openmw
}
Could you please test this one fallenwizard? I removed some of the dependencies and modified the git commands.
Hircine wrote: now you two have gotten me into ArchLinux...

;)

will test out your script when i play around with my setup.
Guest wrote: Ah yes, I forgot about the build folder. Then your cmake solution was fine.
fallenwizard wrote: Forgot to log in :/

Ok. You did a little mistake with the git submodule update --init command.
It doesn't work because you were not inside the openmw folder. I fixed that with this:
cd ${_gitname}
git submodule update --init
cd ${srcdir}
Everything else worked perfectly.
pvdk wrote:
Hircine wrote:will test out your script when i play around with my setup.
Thanks. Do you have a fresh install of Arch? If that's the case it would be ideal for testing. You can test my package by installing yaourt and typing this:

Code: Select all

yaourt -Sy openmw-git
I've recovered my username and claimed openmw-git: it is now in AUR. You can find it here:
http://aur.archlinux.org/packages.php?ID=45102

Please vote for it there.

Happy to have another Arch user around!

Regards,
pvdk.
Hircine wrote: i tried using a virtual machine but it doesn't like me at all. :(

will have to do a freshy on my (old)laptop.

wish me luck lol
pvdk wrote:
fallenwizard wrote:Ok. You did a little mistake with the git submodule update
Forgot to refresh this page before posting, missed your message.
Is this correct now? Can't test it because I'm working on a PKGBUILD for openmw 0.08 and that one needs an older version of Ogre.

Code: Select all

  else
    cd ${srcdir}
    git clone ${_gitroot} ${_gitname}
    cd ${_gitname}
    git submodule update --init
    cd ${srcdir}
  fi
ezzetabi wrote: You should put commas around variables name that might contain spaces; the curly brackets do not help in this context.

In an empty directory try:
$ A='a b c'
$ mkdir "$A"
$ ls -F
a b c/
$ rmdir a\ b\ c/
$ mkdir ${A}
$ ls -F
a/ b/ c/
$
The latter is not what you intended.

Personally I think the {} should not be used if you do not need any of their features (e.g., array indexing, string replace,...) instead if you are not desperate for space you always should use "".
pvdk wrote: Thanks ezzetabi, I was in doubt if I should use brackets or commas but you convinced me :) I will edit the PKGBUILD. Should I use single quotes or double?
Hircine wrote: had a go at installing Arch Linux on my Laptop and i have run into a bit of a snag. I am running it over ethernet and i can ping to google. but whenever i try to wget something it can't(say waiting for http request or whatever until i terminate the process). so i can't use pacman to update or to get new packages.

i have looked all over every forum for this problem but to can't find anything.
perhaps i should stick to ubuntu...
ap0 wrote:

Code: Select all

--   includes  : /usr/include/OGRE
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1123 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:216 (find_package)
Look's like we've got some issues with boost

Code: Select all

-- Found Freetype: /usr/lib/libfreetype.so 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Boost_INCLUDE_DIR (ADVANCED)
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw/extern/caelum
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw/extern/mygui_3.0.1
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw/extern/mygui_3.0.1/MyGUIEngine
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw/extern/mygui_3.0.1/OgrePlatform
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw/apps/openmw
   used as include directory in directory /tmp/yaourt-tmp-ap0/aur-openmw-git/src/openmw/apps/esmtool

-- Configuring incomplete, errors occurred!
and with myGui
pvdk wrote: MyGUI fails because of boost not found. Could you do this and try again?:

Code: Select all

sudo pacman -Sy boost
Thanks in advance!
pvdk wrote:
Hircine wrote:...so i can't use pacman to update or to get new packages.
Maybe you're suffering from the TCP window scaling issue, as ICMP (ping) works but TCP/UDP does not. Please look here:
https://wiki.archlinux.org/index.php/Co ... ling_issue
ap0 wrote: Compiling...
(intel atom powered, yay !)
pvdk wrote: It's compiling, that means that CMake found Boost this time. I shall add boost to the dependencies, obviously Ogre's boost-libs dependency is not enough.
fallenwizard wrote: Your PKGBUILD worked without problems now. I used community/ogre, community/mygui and extra/boost.
ap0 wrote: Iirc, Ogre use boost, didn't he ?
fallenwizard wrote:
ap0 wrote:Iirc, Ogre use boost, didn't he ?
No. Only boost-libs but afaik boost-libs depends on boost.
depends=('boost-libs' 'freeimage' 'freetype2' 'libxaw' 'libxrandr'
'nvidia-cg-toolkit' 'mesa' 'zziplib' 'ois')
pvdk wrote:
fallenwizard wrote:No. Only boost-libs but afaik boost-libs depends on boost.
Boost-libs does not depend on Boost, so I will change my PKGBUILD.

Another thing: I'm the maintainer of openmw in AUR now and I updated it to version 0.08. Thanks Andrew M. (whoever you are) for disowning the package. That package can use some testing too. (hint, hint ;) )
fallenwizard wrote: Ok. I was wrong. Again...
That package can use some testing too. (hint, hint )
On the way :)

EDIT:
package works fine
pvdk wrote: Nice! :D
Hircine wrote:

Code: Select all

==> Starting make...
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /var/abs/local/yaourtbuild/openmw-git/src/build/CMakeFiles/CMakeTmp

  

  Run Build Command:/usr/bin/make "cmTryCompileExec/fast"

  /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make
  CMakeFiles/cmTryCompileExec.dir/build

  make[1]: Entering directory
  `/var/abs/local/yaourtbuild/openmw-git/src/build/CMakeFiles/CMakeTmp'

  /usr/bin/cmake -E cmake_progress_report
  /var/abs/local/yaourtbuild/openmw-git/src/build/CMakeFiles/CMakeTmp/CMakeFiles
  1

  Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o

  /usr/bin/gcc -march=i686 -mtune=generic -O2 -pipe -o
  CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
  /var/abs/local/yaourtbuild/openmw-git/src/build/CMakeFiles/CMakeTmp/testCCompiler.c


  /usr/lib/gcc/i686-pc-linux-gnu/4.5.2/cc1: error while loading shared
  libraries: libmpfr.so.4: cannot open shared object file: No such file or
  directory

  make[1]: Leaving directory
  `/var/abs/local/yaourtbuild/openmw-git/src/build/CMakeFiles/CMakeTmp'

  make[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o] Error 1

  make: *** [cmTryCompileExec/fast] Error 2

  

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)



with a fresh install of Arch + GDM + Nvidia. and base-devel is installed.
thoughts?

it was my router would you believe that was causing the problem before. windows machine was working perfectly. graaa.
ap0 wrote: You've got a problem with gcc :/
pvdk wrote: Hmm strange, it seems your compiler is not working. Can you build other packages from aur?

Edit:
ap0 beat me to it :) Have a look here: should not happen on a fresh install but who knows:
https://bbs.archlinux.org/viewtopic.php?id=107372

Hmm you're also missing some libraries which are required by gcc. Somehow something got messed up. Try installing gcc manually.
fallenwizard wrote:
Hircine wrote:snip
Did you mess around with the core packages at the installer? mpfr is in core so it should install automatically. Try to install base and base-devel again:

pacman -S base base-devel
Hircine wrote: i selected both base/base-devel at teh installer.
it should have installed everything on the disc.

i ran that command. then re-ran the build
same result.
pvdk wrote: Well try a full system update and see what happens:

Code: Select all

sudo pacman -Syu
Hircine wrote: that fixed it, got it compiled and it runs :D
ezzetabi wrote:
pvdk wrote:Thanks ezzetabi, I was in doubt if I should use brackets or commas but you convinced me :) I will edit the PKGBUILD. Should I use single quotes or double?
It is not the whole story, but it is a good starting point that covers most cases:
- use 'abc' (single quotes) when you DO NOT want any special meaning from the quoted characters. You should use this one in any string where you do not expect any transformation or changing. (e.g., '$A' is indeed $A even if A is a variable.)

- use "abc" (double quotes) when you need to protect the spaces, but you also need the meaning of $ for variables, `` for replacing or {} for their special meaning. (e.g., a way to put a full path in a variable is A="`readlink -e relative/path`")

- use {abc} (curly brackets) when you need one of their special meaning; see man bash. Most often you also need also the double quotes to protect spaces. (e.g., A='aa bb cc' /bin/echo "${A//a/d}" will output dd bb cc.)
pvdk wrote: Thanks for clarifying ezzetabi!
best regards,
Lukasz

Locked

Who is online

Users browsing this forum: No registered users and 1 guest