You are not logged in.

#1 2011-03-12 22:11:43

sportscliche
Member
From: Albuquerque, NM
Registered: 2010-11-30
Posts: 43

[SOLVED] help with PKGBUILD-svn

I am able to build a python-based package from svn using bash, but am having a problem writing the PKGBUILD.  The bash commands are as follows:

svn co http://svn.berlios.de/svnroot/repos/wsjt/branches/wspr
cd wspr
export PYTHON="/usr/bin/python2"
export F2PY="/usr/bin/python2 f2py.py"
./configure --enable-gfortran --prefix=/usr
make

and this works fine.  Following the ABS PKGBUILD-svn.proto template, I came up with the following PKGBUILD:

pkgname=wspr-svn
pkgver=1
pkgrel=1
pkgdesc="Weak Signal Propagation Reporter"
arch=('any')
url="http://physics.princeton.edu/pulsar/K1JT/wsjt.html"
license=('GPL')
optdepends=('g95')
depends=('python2' 'python-imaging' 'python2-numpy' 'libsamplerate' 'portaudio' 'fftw')
makedepends=('subversion')

_svntrunk="http://svn.berlios.de/svnroot/repos/wsjt/branches/wspr"
_svnmod="wspr"

build() {
 export PYTHON="/usr/bin/python2"
 export F2PY="/usr/bin/python2 f2py.py"
  
 cd "$srcdir"

 if [ -d $_svnmod/.svn ]; then
    (cd $_svnmod && svn up -r $pkgver)
  else
    svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -rf "$srcdir/$_svnmod-build"
  cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
  cd "$srcdir/$_svnmod-build"
  
  ./configure --prefix=/usr --enable-gfortran
  make
}

but get stuck with the following error:

Found executable /usr/bin/gfortran
error: unknown file type '' (from '-Wl,--hash-style=gnu')
make: *** [WsprMod/w.so] Error 1
    Aborting...

I've been googling for hours, but feel like I might be getting in over my head.  I suspect I'm missing something trivial since everything is in place for a successful build.

Last edited by sportscliche (2011-03-14 11:03:38)

Offline

#2 2011-03-13 03:23:12

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: [SOLVED] help with PKGBUILD-svn

I'm guessing it doesn't like the LDFLAGS variable defined in your makepkg.conf.

Try putting:
LDFLAGS=""
before the make command.

Offline

#3 2011-03-13 13:02:44

sportscliche
Member
From: Albuquerque, NM
Registered: 2010-11-30
Posts: 43

Re: [SOLVED] help with PKGBUILD-svn

Thanks for the fast reply Snowman.  You had the right idea.  Although your suggested edit did not work, the following line did:

unset LDFLAGS

I got this from the discussion here:

https://bbs.archlinux.org/viewtopic.php?pid=668971

(Note: in that thread there is an alternative approach suggested by Ranguvar:

export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
export LDFLAGS="${LDFLAGS//,--as-needed}"
export LDFLAGS="${LDFLAGS//--as-needed}"

which did not work for me.) 

The PKGBUILD concludes with:

package() {
  cd "$srcdir/$_svnmod-build"
  sudo make DESTDIR="$pkgdir/" install
}

This runs makepkg -s to completion although I get a warning about a reference to $srcdir.  Performing pacman -U on the tarball installs python files in /usr/lib/python2.7/site-packages/WsprMod and adds wspr.py in /usr/bin/.  Launching the program with python2 wspr.py leads to an immediate segmentation fault.  After the manual build, all the files were in the same directory.  I tried moving everything into the same python directory and still got the seg fault.

When I built manually, I did not have to do a sudo make install.  If I leave out this step in PKGBUILD, however, setup.py does not run and the package doesn't install anything.  So I tried this instead

package() {
cd "$srcdir/$_svnmod-build"
python2 setup.py install --root=$pkgdir/ --optimize=1
}

which aborts makepkg because of file conflicts.

Can anyone see what I'm doing wrong?

Offline

#4 2011-03-13 21:26:25

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,849

Re: [SOLVED] help with PKGBUILD-svn

I maintain an aur package that doesn't build correctly if i put stuff in the package() section, but does build if i put everything in the build() function.

that package uses a 'dummy' package section like this :

package() {
true
}

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2011-03-14 09:09:12

sportscliche
Member
From: Albuquerque, NM
Registered: 2010-11-30
Posts: 43

Re: [SOLVED] help with PKGBUILD-svn

I have a working PKGBUILD now.  As was the case in manual install, it was not necessary to "make install" or "python2 setup.py" as I had thought.  Once the make command runs to completion, all the required files are available and they only have to placed in the desired directory.  The seg faults I was experiencing were caused by my failure to recognize root ownership of the new package, which I fixed with chown.  I decided to place all files together in  /opt.  For completeness, the relevant portion of PKGBUILD follows.  Criticism is welcome...as you can probably guess, I'm really new at this.

_svntrunk="http://svn.berlios.de/svnroot/repos/wsjt/branches/wspr"
_svnmod="wspr"

build() {
 export PYTHON="/usr/bin/python2"
 export F2PY="/usr/bin/python2 f2py.py"
 unset LDFLAGS
 cd "$srcdir"

 if [ -d $_svnmod/.svn ]; then
    (cd $_svnmod && svn up -r $pkgver)
  else
    svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -rf "$srcdir/$_svnmod-build"
  cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
  cd "$srcdir/$_svnmod-build"
  
  ./configure --prefix=/usr --enable-gfortran
  make
}

package(){
    mkdir -p $pkgdir/opt/$pkgname
    mv $srcdir/$_svnmod-build $pkgdir/opt/$pkgname
    chown -R $USER:  $pkgdir/opt/$pkgname
    find "$pkgdir/opt/$pkgname/" -type f  | xargs chmod 644
    find "$pkgdir/opt/$pkgname/" -type d | xargs chmod 755
}

Offline

Board footer

Powered by FluxBB