LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Sbopkg : building a queue file with CFLAGS and CXXFLAGS set. (https://www.linuxquestions.org/questions/slackware-14/sbopkg-building-a-queue-file-with-cflags-and-cxxflags-set-933784/)

Linux.tar.gz 03-10-2012 01:30 PM

Sbopkg : building a queue file with CFLAGS and CXXFLAGS set.
 
Hi.

I wonder how to build a queue file without having to edit each slackbuild to include custom CFLAGS and CXXFLAGS.

Do i simply need to make an export ?

a4z 03-10-2012 02:52 PM

you can export your own SLKCFLAGS and export ARCH to soemthing that is not handled by default int the slackbuild files or use sed to replace SLKCFLAGS to what you want

Linux.tar.gz 03-10-2012 03:46 PM

Is SLKCFLAGS the sbo env variable ?

a4z 03-11-2012 11:07 AM

look at the build scripts

normaly you have something like this
Code:

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

and later
Code:

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
... whatever

so you may prefer sed cause as you see it is possible that there will be default values if ARCH is unknown and than you have no chance to overwrite/set your own (SLKC/C/CXX)FLAGS

this is somehow a bug in my opinion,
better would be for example
SLKCFLAGS=${SLKCFLAGS:-"-O2 -march=i486 -mtune=i686"}

but I never cared about that cause for these binaries where my own flags are important I have my own buildscripts anyway
and it is the way how slackbuilds are written, so I think this will never change, but since they are all equal, sed -i is your friend

Linux.tar.gz 03-11-2012 10:24 PM

Ok.

I wondered about this because, as you said, all Slackbuilds have not the same options.

Thank you.


All times are GMT -5. The time now is 12:54 AM.