LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-31-2009, 12:37 PM   #1
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Rep: Reputation: 94
Adapting slackbuild of SuiteSparse for Slackware 12.2 to conform to Slackware64


Hi Forum

This is a SlackBuild from Slacky.eu for Slackware 12.2 which I wish to adapt to Slackware64 13

Code:
#!/bin/sh
# Heavily based on the Slackware 12.1 SlackBuild
# http://www.cise.ufl.edu/research/sparse/SuiteSparse/
# Packager Michelino Chionchio - www.slacky.eu

CWD=`pwd`
TMP=${TMP:-/tmp/tgz}
PKG=$TMP/package-suitesparse
NAME=suitesparse
VERSION=3.1.0
CHOST=i486
ARCH=${ARCH:-i486}
BUILD=2mch
METIS=metis
METISVERSION=4.0

SOURCE=http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-$VERSION.tar.gz
SOURCEMETIS=http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/$METIS-$METISVERSION.tar.gz

if [ ! -e SuiteSparse-$VERSION.tar.gz ]; then
wget -c $SOURCE
fi

if [ ! -e $METIS-$METISVERSION.tar.gz ]; then
wget -c $SOURCEMETIS
fi

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi


if [ ! -d $TMP ]; then
 mkdir -p $TMP
fi
if [ ! -d $PKG ]; then
 mkdir -p $PKG
fi

cd $TMP

tar zxvf $CWD/SuiteSparse-$VERSION.tar.gz
cd SuiteSparse/UFconfig
sed -i s/"CFLAGS = -O"/"CFLAGS = $SLKCFLAGS -fPIC -fexceptions -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"/ UFconfig.mk
sed -i s/"-D_LARGEFILE64_SOURCE3"/"-D_LARGEFILE64_SOURCE"/ UFconfig.mk
sed -i s/"F77FLAGS = -O"/"F77FLAGS = $SLKCFLAGS"/ UFconfig.mk
sed -i s/'CHOLMOD_CONFIG ='/'CHOLMOD_CONFIG = -DNPARTITION'/ UFconfig.mk
sed -i s/'METIS = ..\/..\/metis-4.0\/libmetis.a'/'METIS = '/ UFconfig.mk
sed -i s/'METIS_PATH = ..\/..\/metis-4.0'/'METIS_PATH = '/ UFconfig.mk
cd ..

tar zxvf $CWD/$METIS-$METISVERSION.tar.gz
cd $METIS-$METISVERSION
sed -i s/"-O2"/"$SLKCFLAGS"/ Makefile.in
make || exit 1

mkdir -p $PKG/usr/bin
cp -a graphchk kmetis mesh2dual mesh2nodal oemetis onmetis partdmesh partnmesh pmetis $PKG/usr/bin


cd ..
make || exit 1

# Build shared library
AMDV=2.2
AMDM=2
cd AMD/Lib
gcc -shared -Wl,-soname,libamd.so.${AMDM} -o libamd.so.${AMDV} `ls *.o`
cd ../../

BTFV=1.0
BTFM=1
cd BTF/Lib
gcc -shared -Wl,-soname,libbtf.so.${BTFM} -o libbtf.so.${BTFV} `ls *.o`
cd ../../

CAMDV=2.2
CAMDM=2
cd CAMD/Lib
gcc -shared -Wl,-soname,libcamd.so.${CAMDM} -o libcamd.so.${CAMDV} `ls *.o`
cd ../../

CCOLAMDV=2.7
CCOLAMDM=2
cd CCOLAMD/Lib
gcc -shared -Wl,-soname,libccolamd.so.${CCOLAMDM} -o libccolamd.so.${CCOLAMDV} `ls *.o`
cd ../../

CHOLMODV=1.6
CHOLMODM=1
cd CHOLMOD/Lib
gcc -shared -Wl,-soname,libcholmod.so.${CHOLMODM} -o libcholmod.so.${CHOLMODV} `ls *.o`
cd ../../

COLAMDV=2.7
COLAMDM=2
cd COLAMD/Lib
gcc -shared -Wl,-soname,libcolamd.so.${COLAMDM} -o libcolamd.so.${COLAMDV} `ls *.o`
cd ../../

CSparseV=2.2.0
CSparseM=2
cd CSparse/Lib
gcc -shared -Wl,-soname,libcsparse.so.${CSparseM} -o libcsparse.so.${CSparseV} `ls *.o`
cd ../../

CXSparseV=2.2.0
CXSparseM=2
cd CXSparse/Lib
gcc -shared -Wl,-soname,libcxsparse.so.${CXSparseM} -o libcxsparse.so.${CXSparseV} `ls *.o`
cd ../../

KLUV=1.0
KLUM=1
cd KLU/Lib
gcc -shared -Wl,-soname,libklu.so.${KLUM} -o libklu.so.${KLUV} `ls *.o`
cd ../../

LDLV=2.0
LDLM=2
cd LDL/Lib
gcc -shared -Wl,-soname,libldl.so.${LDLM} -o libldl.so.${LDLV} `ls *.o`
cd ../../

UMFPACKV=5.0.2
UMFPACKM=5
cd UMFPACK/Lib
gcc -shared -Wl,-soname,libumfpack.so.${UMFPACKM} -o libumfpack.so.${UMFPACKV} `ls *.o` -lblas -lm
cd ../../

# Done !

mkdir -p $PKG/usr/doc/$NAME-$VERSION
for i in AMD/ CAMD/ CHOLMOD/ LDL/ UFcollection/ BTF/ CCOLAMD/ COLAMD/ CSparse/ CXSparse/ KLU/ RBio/ UMFPACK/;
    do mkdir -p $PKG/usr/doc/$NAME-$VERSION/$i && cp -a $i/Doc/* $i/README.txt $PKG/usr/doc/$NAME-$VERSION/$i; done
cp -a README.txt $PKG/usr/doc/$NAME-$VERSION
rm $PKG/usr/doc/$NAME-$VERSION/*/Makefile
mkdir -p $PKG/usr/doc/$METIS-$METISVERSION.1
cp -a $METIS-$METISVERSION/Doc/* $METIS-$METISVERSION/{CHANGES,FILES,INSTALL,VERSION} $PKG/usr/doc/$METIS-$METISVERSION.1

mkdir -p $PKG/usr/lib/
for i in AMD/ CAMD/ CHOLMOD/ LDL/ BTF/ CCOLAMD/ COLAMD/ CSparse/ CXSparse/ KLU/ UMFPACK/;
    do cp -a $i/Lib/{*.a,*.so.*} $PKG/usr/lib/; done
cp -a $METIS-$METISVERSION/*.a $PKG/usr/lib/

mkdir -p $PKG/usr/include/$NAME
for i in AMD/ CAMD/ CHOLMOD/ LDL/ BTF/ CCOLAMD/ COLAMD/ CXSparse/ KLU/ UMFPACK/;
    do cp -a $i/Include/*.h $PKG/usr/include/$NAME; done
cp -a UFconfig/*.h $PKG/usr/include/$NAME
cp -a $METIS-$METISVERSION/Lib/*.h $PKG/usr/include/$NAME

cd $PKG/usr/include/
ln -s ./suitesparse ./umfpack


cd $PKG/usr/doc/$NAME-$VERSION
for I in *; do mv $I $(echo $I | tr '[A-Z]' '[a-z]'); done

cd $PKG/usr/lib
ln -sf libamd.so.${AMDV} libamd.so.${AMDM}
ln -sf libamd.so.${AMDV} libamd.so
ln -sf libbtf.so.${BTFV} libbtf.so.${BTFM}
ln -sf libbtf.so.${BTFV} libbtf.so
ln -sf libcamd.so.${CAMDV} libcamd.so.${CAMDM}
ln -sf libcamd.so.${CAMDV} libcamd.so
ln -sf libccolamd.so.${CCOLAMDV} libccolamd.so.${CCOLAMDM}
ln -sf libccolamd.so.${CCOLAMDM} libccolamd.so
ln -sf libcholmod.so.${CHOLMODV} libcholmod.so.${CHOLMODM}
ln -sf libcholmod.so.${CHOLMODV} libcholmod.so
ln -sf libcolamd.so.${COLAMDV} libcolamd.so.${COLAMDM}
ln -sf libcolamd.so.${COLAMDV} libcolamd.so
ln -sf libcsparse.so.${CSparseV} libcsparse.so.${CSparseM}
ln -sf libcsparse.so.${CSparseV} libcsparse.so
ln -sf libcxsparse.so.${CXSparseV} libcxsparse.so.${CXSparseM}
ln -sf libcxsparse.so.${CXSparseV} libcxsparse.so
ln -sf libklu.so.${KLUV} libklu.so.${KLUM}
ln -sf libklu.so.${KLUV} libklu.so
ln -sf libldl.so.${LDLV} libldl.so.${LDLM}
ln -sf libldl.so.${LDLV} libldl.so
ln -sf libumfpack.so.${UMFPACKV} libumfpack.so.${UMFPACKM}
ln -sf libumfpack.so.${UMFPACKV} libumfpack.so

cd $PKG

find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;

chown -R root:root .

find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/slack-desc > $PKG/usr/doc/$NAME-$VERSION/slack-desc
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild

requiredbuilder -v -y -s $CWD $PKG
makepkg -l y -c n $CWD/../$NAME-$VERSION-$ARCH-$BUILD.tgz

if [ "$1" = "--cleanup" ]; then
 rm -rf $TMP
fi
Clearly, this does not conform to the structure of AlienBob's Slackbuilds, or the SlackBuilds from SlackBuilds.org.

This will drop libraries inside /usr/lib... which clearly does not adhere to Slackware64 13 standards.

I guess that simply changing the ARCH and CHOST variables won't be enough...

Can somebody poit to me the changes to be performed so as not to trash my system ( again ) ... ?


BRGDS

Alex
 
Old 12-31-2009, 12:54 PM   #2
manwichmakesameal
Member
 
Registered: Aug 2006
Distribution: Slackware
Posts: 804

Rep: Reputation: 110Reputation: 110
I'm no expert, but it looks like you can just change all of the /usr/lib entries to /usr/lib64.
 
1 members found this post helpful.
Old 12-31-2009, 01:10 PM   #3
Alexvader
Member
 
Registered: Oct 2009
Location: Japan
Distribution: Arch, Debian, Slackware
Posts: 994

Original Poster
Rep: Reputation: 94
Hi ManwhichMakesaMeal

At first sight yes... this should be enough...

But this is a very important cornerstone... it is a library... if it gets incorrectly built, every other standalone application I build against it will be "ill-made"...

I had a similar issue with the slackbuild of Python 2.5.2 for Slackware 12.2 under Slackware64 13...

From then on, everything I built was trash....

I mean... it worked, but not to the expectations...


BRGDS

Alex
 
Old 12-31-2009, 01:22 PM   #4
manwichmakesameal
Member
 
Registered: Aug 2006
Distribution: Slackware
Posts: 804

Rep: Reputation: 110Reputation: 110
You may be able to do something like a
Code:
 sed -i s/"/usr/lib"/"/usr/lib${LIBDIRSUFFIX}" Makefile.in
after
Code:
sed -i s/"-O2"/"$SLKCFLAGS"/ Makefile.in
and then put
Code:
LIBDIRSUFFIX="64"
after
Code:
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
This may or may not work, as I haven't dl'd the source and tried to build it.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PyQt4 module error in SlackBuild for Slackware 12.2 under Slackware64 13... Alexvader Slackware 3 12-28-2009 04:02 PM
Slackbuild of Scilab 5.1 fails under Slackware64 13... is this reproducible...?? Alexvader Slackware 21 11-29-2009 02:29 PM
Porting SlackBuild of Scilab from Slackware 12 to Slackware64 13 Alexvader Slackware 20 11-15-2009 09:20 PM
For the Krusader fans on slackware64 slackbuild ROXR Slackware 0 07-20-2009 06:03 PM
Kmymoney2 Slackware64 Sbo Slackbuild Error AlleyTrotter Slackware 4 07-05-2009 10:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration