LinuxQuestions.org
Help answer threads with 0 replies.
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 04-19-2005, 08:09 PM   #1
jmdlcar
Member
 
Registered: Nov 2003
Distribution: Porteus 3.2 Mate (Slackware)
Posts: 141

Rep: Reputation: 15
How To Compile


I want to learn how to compile is there "How To" out there?
 
Old 04-19-2005, 08:51 PM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
Re: How To Compile

Quote:
Originally posted by jmdlcar
I want to learn how to compile is there "How To" out there?
There's an excellent thread in this forum about compiling. Do a search on compiling.
 
Old 04-20-2005, 05:37 AM   #3
cathectic
Member
 
Registered: Sep 2004
Location: UK, Europe
Distribution: Slackware64
Posts: 761

Rep: Reputation: 35
For compiling in Slackware, it's also reccommended that you install 'checkinstall' from /extra (from either an FTP mirror or the 3rd CD). Then where you see 'make install' in any tutorial, etc..., replace it with 'checkinstall' to generate a Slackware package that can then be installed using 'installpkg' and easily removed later using 'removepkg'.
 
Old 04-20-2005, 08:20 PM   #4
-0-
Member
 
Registered: Nov 2004
Location: London uk
Distribution: Slack 10
Posts: 67

Rep: Reputation: 15
Quote:
Originally posted by cathectic
For compiling in Slackware, it's also reccommended that you install 'checkinstall' from /extra (from either an FTP mirror or the 3rd CD). Then where you see 'make install' in any tutorial, etc..., replace it with 'checkinstall' to generate a Slackware package that can then be installed using 'installpkg' and easily removed later using 'removepkg'.
Althought TBH, although checkinstall is all well and good, you may benefit from learning to write SlackBuild scripts, just check a few on the slackware repositry (under /source).


I used to use checkinstall, but i now massively prefer this method, once you get the script sorted it's just downright better, everything in the slackapproved place, all binaries/libs stripped, docs sorted out, etc.

Give it a try, you may like it.

I'm working on a Generic script, that will work for most packages with a few tweaks, if people are interested i'll post a Work in Progress

Happy slacking!
 
Old 04-20-2005, 09:31 PM   #5
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Checkinstall is recomended? Says who? Sometimes I wonder if I'm the only person who has a problem with Checkinstall. It always corrupts my hostname after I use it and then nothing will open. It also likes to screw up symlinks in the doinst.sh.... Anyway...

I'll agree, it's much better to write your own scripts. I installed pkgtools on LFS 6.0 and wrote build scripts for every package... Damn does it run nice.... I've stopped using Slackware is has such a nice vibe to it... Anyway....

./configure
make
make install

is basically it. Most times you'll want to do a "./configure --prefix=/usr". First do a "./configure --help" and it will tell you all the options that are available... Pretty easy stuff.....
 
Old 04-20-2005, 10:20 PM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
IMHO you should stay away from checkinstall...

it's much more effective and educational to write your own build scripts...

just study the scripts in the source directories and you'll be making your own in no time...
 
Old 04-21-2005, 03:01 AM   #7
AxelFendersson
Member
 
Registered: Mar 2004
Location: Darkest Oxfordshire
Distribution: Arch, Slackware
Posts: 184

Rep: Reputation: 32
I've never really had any problems with checkinstall. That said, I often then take the package, untar it, poke around and tweak it a bit, and then put it back together with makepkg.
 
Old 04-21-2005, 03:50 AM   #8
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Quote:
Originally posted by -0-
I'm working on a Generic script, that will work for most packages with a few tweaks, if people are interested i'll post a Work in Progress
Please do! I recently created my own generic script that works for most packages out-of-the-box (as it were), and will work for others with minor tweaks (when there are unusual configure options, or no configure script at all, for example). Would be interesting to compare...
 
Old 04-21-2005, 09:30 AM   #9
-0-
Member
 
Registered: Nov 2004
Location: London uk
Distribution: Slack 10
Posts: 67

Rep: Reputation: 15
OK,


I'll post it up later on, i'll just play with it a bit.

It doesn't nessecerily work right out of the box (it has 3 make options, but the default is DESTDIR, things like that).

EDIT, here you go:
Code:
#!/bin/sh
#build script for sqlite package
#owain Ainsworth 15/04/2005
#set up env
APP=
CWD=`pwd`
PKG=/tmp/package-$APP
VERSION=9.7
#change if you don't have an athlon, default slack is 486
ARCH=athlonxp
BUILD=1
#i could put generic cflags. or the slack standard ones, but i didn't for now, these are mine
SLKCFLAGS="-march=athlon-xp -O2 -pipe -fomit-frame-pointer -Wall"
CONFIGOPTS=""
MKINSTALLAPPEND="DESTDIR=$PKG"
#MKINSTALLAPPEND="ROOT=$PKG""
#MKINSTALLAPPEND="prefix=$PKG/bin"
# clean up after old builds
rm -rf $PKG
mkdir -p "PKG"
cd /tmp
rm -rf $APP-$VERSION
if ls  $CWD/$APP-$VERSION.tar.gz &>/dev/null
        then tar xzvf $CWD/$APP-$VERSION.tar.gz
elif ls $CWD/$APP-$VERSION.tar.bz2 &>/dev/null
        then tar xjvf $CWD/$APP-$VERSION.tar.bz2
else echo "source tarball not found"
fi
if [ ! -e  $APP-$VERSION]
        then echo "cannot find directory, quitting"
        exit
fi
cd $APP-$VERSION
#fix perms of source so docs etc are correctly permissioned when copied
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 555 -exec chmod 755 {} \;
find . -perm 444 -exec chmod 644 {} \;
#configure and make the package
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var $CONFIGOPTS
make
make install $MKINSTALLAPPEND
#set owners of bin directories
if ls $PKG/usr/bin &> /dev/null
        then chown -R root.bin $PKG/usr/bin
fi
if ls $PKG/bin &> /dev/null
        then chown -R root.bin ~$PKG/bin
fi
if ls $PKG/sbin &> /dev/null
        then chown -R root.bin ~$PKG/sbin
fi
if ls $PKG/usr/sbin &> /dev/null
        then chown -R root.bin $PKG/usr/sbin
fi
#strip binaries and libs
( cd $PKG
  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
)
#sort docs out
# if any docs in your tarball are missing add them to the list below, and email them to me too
mkdir -p $PKG/usr/doc/$APP-$VERSION
cp -a \
  ANNOUNCE AUTHORS BUGS COPYING* INSTALL NEWS README README.boot THANKS TODO VERSION \
    $PKG/usr/doc/$APP-$VERSION
#gzip man and info pages
gzip -9 $PKG/usr/man/man?/*.?
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/info/*
#make the install dir
mkdir -p $PKG/install
#create slack-desc
cat << _EOF_ > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

#   |-----handy-ruler------------------------------------------------------|
$APP: $APP-$VERSION
$APP:
$APP: 
$APP: 
$APP:  
$APP:
$APP:
$APP:
$APP: 
$APP:
$APP:

_EOF_
#make doinst.sh add any special modifications to do when installed between the cat
#line and the _EOF_ and uncomment the aforementioned
#cat << _EOF_ > $PKG/install/doinst.sh 
#_EOF_
#Create the package
cd $PKG
makepkg -l y -c n ../$APP-$VERSION-$ARCH-$BUILD.tgz

Last edited by -0-; 04-21-2005 at 10:22 AM.
 
Old 04-21-2005, 10:07 AM   #10
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Just a note :
Code:
if [ -e ! $APP-$VERSION] ...
should be:
Code:
if [ ! -e $APP-$VERSION ] ...
 
Old 04-21-2005, 10:22 AM   #11
-0-
Member
 
Registered: Nov 2004
Location: London uk
Distribution: Slack 10
Posts: 67

Rep: Reputation: 15
Changed, Ta!
 
Old 04-21-2005, 10:34 AM   #12
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Interesting!

It reminds me that I haven't yet bothered doing "strip binaries" and "chown -R root.bin blah" stuff yet in my script. I was concentrating on making it generic enough to compile and package anything with the minimum amount of tweaking first. Time for me to get scripting again...
 
Old 04-21-2005, 04:09 PM   #13
dx0r515t
Member
 
Registered: Jan 2005
Location: USA
Distribution: Slackware 10.2 & 11.0
Posts: 155

Rep: Reputation: 30
Basically all you need to do to compile is:
Quote:
1.)./configure
2.)make
3.)make install
 
Old 04-21-2005, 04:21 PM   #14
xushi
Senior Member
 
Registered: Jun 2003
Location: UK
Distribution: Gentoo
Posts: 1,288

Rep: Reputation: 45
or
Code:
./configure
make
checkinstall
here we go again
 
Old 04-21-2005, 04:34 PM   #15
-0-
Member
 
Registered: Nov 2004
Location: London uk
Distribution: Slack 10
Posts: 67

Rep: Reputation: 15
Quote:
Originally posted by Nobber
Interesting!

It reminds me that I haven't yet bothered doing "strip binaries" and "chown -R root.bin blah" stuff yet in my script. I was concentrating on making it generic enough to compile and package anything with the minimum amount of tweaking first. Time for me to get scripting again...

I think i started with the script for SED, or similar, and edited it, made it more general, added bits, etc.

Mind posting yours for comparison?

-0-
 
  


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
ntop compile/post-compile problem? tjb Linux - Software 3 12-28-2004 04:22 PM
What does 'compile' mean? Iain1974 Linux - Newbie 15 08-25-2004 08:38 PM
c/c++ compile zdos Linux - Software 2 05-16-2004 03:22 PM
how to compile x for use on another pc??? markkreuzz Red Hat 1 03-03-2004 10:06 AM
compile jakublgz Programming 8 09-05-2002 05:30 AM

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

All times are GMT -5. The time now is 11:19 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