You are not logged in.

#1 2010-07-24 20:37:05

mikeym
Member
Registered: 2009-01-30
Posts: 56

Help with first PKGBUILD

Hi there,

I'm fairly new to Arch but I've been using linux for a good few years now. I'm trying to patch a version of Wine to fix some of the issues with source games. It's complicated a bit by the fact I'm on a 64 bit install of Arch.

I've build myself a 32 bit chroot of the arch system and installed the required packages and compiled my nice new patched version of Wine. I've even managed to test it as Wine is good at running in situe and was pleased to get a good 20% framerate increase.

So now I'm wanting to install the result but I'm not sure how best to go about creating a PKGBUILD or how the 64 bit / 32 bit thing will effect it.

Any advice would be welcome.

Offline

#2 2010-07-24 20:53:35

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Help with first PKGBUILD

This should be a good start. It will help you in understanding the different variables in the PKGBUILD

http://wiki.archlinux.org/index.php/PKGBUILD


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2010-07-24 23:40:38

mikeym
Member
Registered: 2009-01-30
Posts: 56

Re: Help with first PKGBUILD

# Maintainer:  Michael Green <abc.mikey@googlemail.com>

pkgname=bin32-wine-source
_pkgname32=wine-source
pkgver=1.2
pkgrel=1
_pkgrel32=1
pkgdesc="Windows API implementation and interpreter, enabling the use of Windows apps in other OSes. Contains rgb<->srgb patch for source games."
arch=('x86_64')
url="http://www.winehq.org/"
license=('LGPL')

depends=('lib32-fontconfig' 'lib32-freetype2' 'lib32-libjpeg' 'lib32-libtiff' 'lib32-libldap' 'lib32-libxslt' 'lib32-mesa' 'lib32-zlib')
optdepends=('lib32-alsa-lib: ALSA audio driver'
        'lib32-openal: OpenAL native driver'
            'lib32-esound: EsounD audio driver'
            'lib32-nvidia-utils: Accelerated 3D with the NVIDIA binary blob video driver'
            'lib32-catalyst-utils: Accelerated 3D with the AMD/ATI binary blob video driver')
provides=("bin32-wine=$pkgver" "bin32-wine")
conflicts=("bin32-wine")

source=("/chroot/home/mikey/src/wine-$pkgver/$_pkgname32-$pkgver-$_pkgrel32-i686.pkg.tar.gz")
md5sums=(6717c23b1bee9812de57c71f2f1810a0)

# Don't strip the package, that was already decided on packaging of the original package
options=('!strip')
build() {
    rm "$_pkgname32-$pkgver-$_pkgrel32-i686.pkg.tar.gz" || return 1  # Delete symbolic link to the now-extracted source that we don't want to copy
    cp -rfpP * "$pkgdir" || return 1        # Copy 32-bit files
    install -d "$pkgdir"/opt/lib32/usr/lib/
    mv "$pkgdir"/usr/lib/libwine.so* "$pkgdir"/opt/lib32/usr/lib/ || return 1
    cd "$pkgdir"/usr/bin/

    # DIRTY PKGBUILD TOUCHING YOUR /bin (force loading old LD_LIBRARY_PATH without moving wine binaries, as they seem to break)
    install -d "$pkgdir"/opt/wine/bin/ "$srcdir"/tmpscripts/
    for binfile in ${_binnames[*]}; do
        echo -e \
            '#!/bin/sh\n#wrapper for replacename\nPATH="/opt/wine/bin/:$PATH"\nLD_LIBRARY_PATH="/opt/lib32/usr/lib/:/opt/lib32/lib/:$LD_LIBRARY_PATH" linux32 /usr/bin/replacename "$@"' \
            > "$srcdir/tmpscripts/$binfile" || return 1
        sed -re "s/replacename/$binfile/" -i "$srcdir/tmpscripts/$binfile" || return 1
        install -m755 "$srcdir/tmpscripts/$binfile" "$pkgdir/opt/wine/bin/$binfile" || return 1
    done
    rm -rf "$srcdir"/tmpscripts

    # PPD fix
    mkdir -p "$pkgdir"/opt/lib32/usr/share/
    ln -s /usr/share/wine "$pkgdir"/opt/lib32/usr/share/wine || return 1

    echo "export WINELOADER=/opt/wine/bin/wine" > "$srcdir"/wine.sh || return 1
    echo '#export LD_LIBRARY_PATH="/opt/lib32/lib/:/opt/lib32/usr/lib/:$LD_LIBRARY_PATH"' >> "$srcdir"/wine.sh || return 1
    echo 'export PATH="/opt/wine/bin:$PATH"' >> "$srcdir"/wine.sh || return 1
    install -Dm755 "$srcdir"/wine.sh "$pkgdir"/etc/profile.d/wine.sh || return 1
}

This is my best shot. It's based on the PKGBUILDs for the other bin32-wine variants. I've tried to make my source as similar to the one they use as possible by as chroot:

$./configure --prefix=/usr
$make 
$make DESTDIR=/home/mikey/src/wine-1.2/package/ install
$cd /home/mikey/src/wine-1.2/package/
$tar zcvf ../wine-source-1.2-1-i686.pkg.tar.gz *

Then exiting chroot and trying makepkg on my PKGBUILD. It installs but it's giving me an error when I try to run wine:

wine: failed to initialize: /usr/local/lib/wine/ntdll.dll.so: cannot open shared object file: No such file or directory

I'm not sure why  this is but I suspect it's got something to do with the fact I did ./configure --prefix=/usr

Does anyone know what it'll be?

(edit) I've just noticed that it seems to be a more fundamental problem as it's looking for /usr/local which I didn't give it.
(edit) OK a bit more digging around and as it turned out there were direct references to /usr/local in some of the Wine scripts that were getting installed. A find and replace with sed during the install sorted it. smile

Last edited by mikeym (2010-07-25 03:11:12)

Offline

Board footer

Powered by FluxBB