LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 10-11-2010, 03:15 AM   #1
Holering
Member
 
Registered: Feb 2010
Distribution: Slackware
Posts: 155

Rep: Reputation: 22
SBOpkg honor's CFLAGS but then they're replaced with i486 arch flags? = :(


Ok so my entire slackware system was bootstrapped-toolchained and everything else it came with (or that I wanted installed) compiled with my own flags. I never changed my arch from i486 to prescott though thinking this would make life easier for me so that once in a while I could feel lazy and install a precompiled i486 package... I don't even think it would really matter now that I think of it lol. You can see what I mean and how I built it from source here http://www.linuxquestions.org/questi...ectory-827681/. So my system is all prescott but appears as (fake) i486.

Unfortunately SBoPKG is the coolest thing to have and it honors whatever ARCH is exported which in my case isn't working out too well. I think this is also responsible for qt4 and a couple other packages that didn't wanna honor my own flags since they kept insisting on i486 mtune=i686. SBOpkg seems to have a similar case if not the same.

Here's the section in sbopkg.conf where I set my exports:

# The following variables are used by sbopkg and by the SlackBuild scripts
# themselves. They are exported for this reason.
export TMP=${TMP:-/tmp/SBo}
export OUTPUT=${OUTPUT:-/tmp}
#export ARCH=prescott
export CFLAGS="-pipe -O2 -fomit-frame-pointer -march=prescott -msse -msse2 -msse3"
export SLKCFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"

You can see I pounded out ARCH=prescott since my system appears as i486 even though everything was compiled with my own custom flags . I'll just end up with an error couldn't find prescott-slackware-linux (or whatever).

I thought this would make life easier in the long run but it turns out not so with SBOpkg and some other stuff I had to deal with manually which wasn't fun! I would really like to use SBOpkg since it makes life so much easier.

Another thing I'd like to add is that all my packagenames-$ARCH strings are prescott. I have a script that renames all $ARCH (i486 or xx86) strings on output packages (in /tmp) from i486 to prescott. I would also like for SBOpkg to do the same but so far it seems like I screwed myself to manually man handle all packages I make no matter what for the rest of my life lol. This definately isn't cool for me!

Last edited by Holering; 10-11-2010 at 03:28 AM.
 
Old 10-11-2010, 03:41 AM   #2
ponce
Senior Member
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 2,433

Rep: Reputation: 867Reputation: 867Reputation: 867Reputation: 867Reputation: 867Reputation: 867Reputation: 867
it's looks not related to sbopkg but it's a choice of slackbuilds.org people: in the template you have
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
if you want to do your optimizations (tried something like that myself in the past but go no particular advantage) I think you have to change those lines in the slackbuilds you use (all of them) like
Code:
if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS=${SLKCFLAGS:-"-O2 -march=i486 -mtune=i686"}
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS=${SLKCFLAGS:-"-O2 -march=i686 -mtune=i686"}
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS=${SLKCFLAGS:-"-O2 -fPIC"}
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS=${SLKCFLAGS:-"-O2"}
  LIBDIRSUFFIX=""
fi
this way they should get your CFLAGS, if defined, if not it will use default (not tried it myself).
 
Old 10-11-2010, 03:44 AM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
You might as well build your own scripts as use slackbuilds.org -- check out
this section of one of their scripts:
Code:
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;; 
    arm*) ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

DOCS="COPYING Changes INSTALL README.FAQ README.configure"

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
In the time you spend re-writing their scripts you could write your own.

Eric Hameleers helped me with scripts some years ago, and perhaps out
of that experience came his Alien's SlackBuild Toolkit. It has three
types of scripts iirc ... one is just like the slackbuilds.org.

Slackware's a dinosaur in that regard, but will change eventually. If what
I've read over the years is correct, Pat believes there are many old comps,
especially servers, with older CPUs and doesn't want to leave them out.

When producing a binary distro they have to tailor the pkgs, and the distro
kernel(s), to fit the maximum number of computers to keep a user base. If all
the people running Slackware could do what you are wanting, they'd probably
be building their own systems with LFS.
 
1 members found this post helpful.
Old 10-11-2010, 04:08 AM   #4
Holering
Member
 
Registered: Feb 2010
Distribution: Slackware
Posts: 155

Original Poster
Rep: Reputation: 22
yeah well I guess I'll be on my own. I've basically been doing what you guys suggested.

I was hoping to be able to use SBopkg and make things easier and automated but oh well... I'll be on my own man handling with this http://slackware.ponce.cc/blog/2010/...e-with-sbopkg/

I really like the way lxde seems to be. Very much like xfce but even faster and lighter. Adding menu items is the same deal too (maybe even better) with adding .desktop files to /usr/share/applications/. Much like windows but simple and to the point.

I was actually considering compiling SalixOS from source but I already got my current slackware built up from latest stable glibc and kernel 2.6.35.5 headers (too much other things to mention).

I'd be using gentoo but one day it blew up on me and I had no way to fix it. Plus if you wanna do a disc backup you gotta do the whole install! Correct me if I'm wrong. On slackware there's no problem making your packages (customizing em') and burning em on different discs! The old freakin' dinosaur just keeps on movin' along I guess... lol

Last edited by Holering; 10-11-2010 at 04:12 AM.
 
Old 10-11-2010, 02:05 PM   #5
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,251

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
You could always create a file that you can later source from any SlackBuild that you use. You wouldn't need to rewrite the script, but you would have to add one line in a particular spot for each script that you use. You could probably automate this using a quick script or a complex command, assuming all SlackBuilds follow the same general format...

Code:
#!/bin/sh
ARCH=prescott
SLKCFLAGS="-pipe -O2 -fomit-frame-pointer -march=prescott -msse -msse2 -msse3"
LIBDIRSUFFIX=""
Save that as /root/sbopkginsert.sh and source it from each SlackBuild you use. For example:
Code:
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;; 
    arm*) ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

DOCS="COPYING Changes INSTALL README.FAQ README.configure"

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

. /root/sbopkginsert.sh
Code:
find /path/to/sbopkg/repository -name "*.SlackBuild" | while read line; do cat "$line" | perl -0777 -pe "s|LIBDIRSUFFIX.*\nfi|$&\n\n. /root/sbopkginsert.sh|" > "$line".sbopkg; done
That command should create custom SlackBuilds for every SlackBuild in the specified repository, all accessible via sbopkg, which all now source your /root/sbopkginsert.sh file. Thus, your CFLAGS should be working properly, and packages will be named with the prescott arch instead of i486.

This is untested so it may not work as advertised but I believe the idea is sound.
 
1 members found this post helpful.
Old 10-11-2010, 05:05 PM   #6
Holering
Member
 
Registered: Feb 2010
Distribution: Slackware
Posts: 155

Original Poster
Rep: Reputation: 22
Great idea! I didn't know you could do that with SBopkg.

I think . /root/sbopkginsert.sh should be inserted right after the SLKCFLAGS strings for i486 and i686. Also it looks like I might have to get rid of the arch=prescott in your script. If arch=prescott then most things that are being configured will error since they can only see my arch as i486-slackware-linux, even though it's really not...

I'm gonna play around with this when I get around to it (and if I feel like it lol. I am human).

I'm wondering if I could issue sed commands some way since I already have my own scripts for replacing flags and renaming the $ARCH string in the package names. My scripts are basically what are in that link I posted above and then some.

SBopkg is great but it could be a bit better. Someone should make a gui frontend for it and make it easy to customize slackbuilds automagically!

Last edited by Holering; 10-11-2010 at 05:09 PM.
 
Old 10-11-2010, 06:30 PM   #7
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,251

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
Quote:
Originally Posted by Holering View Post
Also it looks like I might have to get rid of the arch=prescott in your script. If arch=prescott then most things that are being configured will error since they can only see my arch as i486-slackware-linux, even though it's really not...
Fair point -- I hadn't thought of that.
Quote:
Originally Posted by Holering View Post
I'm wondering if I could issue sed commands some way since I already have my own scripts for replacing flags and renaming the $ARCH string in the package names. My scripts are basically what are in that link I posted above and then some.
I am much better with sed than I am with perl/awk, but sed is line-based and thus I went with perl here (awk would have worked as well). If you can properly (and uniquely) match the proper line with sed you can use 'a \' or 'i \' to insert/append in the proper place in the file, but it is difficult to uniquely match a single line in the correct position that is consistent across all SlackBuilds.
Quote:
Originally Posted by Holering View Post
SBopkg is great but it could be a bit better. Someone should make a gui frontend for it and make it easy to customize slackbuilds automagically!
An ncurses interface is still a GUI frontend in my book.
 
1 members found this post helpful.
Old 10-11-2010, 09:02 PM   #8
Holering
Member
 
Registered: Feb 2010
Distribution: Slackware
Posts: 155

Original Poster
Rep: Reputation: 22
Well I found a semi decent way of doing things and yeah ncurses isn't bad (don't know what I was thinking).

After I open sbopkg I can run a script to edit all slackbuilds in the /var/lib/sbopkg/SBo-git/ folder with proper Cflags (or whatever settings). I build up my queue list without installing any packages. Then I run another script to rename all the packages with $ARCH=prescott (I'm sure I can fix this by editing the slackbuilds directly with the first script I run). After that I'm finally good to go with installing all built packages.

The sad part is that I have to run the script every time after I open SBopkg or else all the slackbuilds go back to their stock form (weird).

So it is easier using SBopkg vs browsing slackbuilds.org and clicking everywhere one at a time and I'll just keep on doing things this way for now. I'll try and contact the developer and see if there's any improvements he's willing to do to make things better in this regard.

Thanks for your help!
 
Old 10-11-2010, 11:08 PM   #9
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,251

Rep: Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630Reputation: 630
Quote:
Originally Posted by Holering View Post
The sad part is that I have to run the script every time after I open SBopkg or else all the slackbuilds go back to their stock form (weird).
You should create a new SlackBuild with the .SlackBuild.sbopkg suffix instead of modifying the actual SlackBuild. Then when you build the package choose the local SlackBuild instead and it should be persistent. Go to "Custom" for the desired app and then diff the SlackBuild -- you should see the proper changes. As for your renaming problem, you could always run another sed command to modify the .SlackBuild.sbopkg files, or combine my earlier command.
Code:
sed 's/-$ARCH\(-$BUILD\)/-prescott\1/'
Combined:
Code:
find /path/to/sbopkg/repository -name "*.SlackBuild" | while read line; do cat "$line" | perl -0777 -pe "s|LIBDIRSUFFIX.*\nfi|$&\n\n. /root/sbopkginsert.sh|" | sed 's/-$ARCH\(-$BUILD\)/-prescott\1/' > "$line".sbopkg; done
I just tested that line (instead of using find I just echoed the name of a SlackBuild in my SBo repository) and it worked as it should, and sbopkg picked up the custom SlackBuild. The only time you would have to rerun that line would be if you resync with the slackbuilds.org repository and it pulls in new SlackBuilds. There is a flaw with this quick approach, where legitimate custom SlackBuilds will be overwritten...so you would have to script a check to see if the file exists (and possibly the date on the file) or backup any custom SlackBuilds so you can replace them if they are overwritten.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Sbopkg... Alexvader Slackware 24 11-23-2009 11:38 AM
Trying to install Arch with 2.6.30-ARCH kernel but uname -r keeps showing 2.6.28.7 PaulFXH Arch 0 08-20-2009 07:58 AM
Arch user wanted to help padawan learner install arch and use it thomas-linuxing Linux - Software 9 10-18-2006 04:02 PM
./configure, CFLAGS, checkinstall, and kernel arch type rgiggs Slackware 3 12-28-2004 01:39 AM
machine arch and cpu (i486/i686) abs Slackware 6 08-22-2004 08:28 AM


All times are GMT -5. The time now is 04:06 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration