URL: https://linuxfr.org/forums/astucesdivers/posts/slackware-comment-compiler-sans-se-casser-la-t%C3%AAte Title: Slackware: comment compiler sans se casser la tête Authors: FreeB5D Date: 2008年07月03日T22:07:17+02:00 Tags: slackware Score: 0 J'ai fait moi-même deux scripts pour faciliter la compilation des codes sources sous Slackware . Le premier, slackmerge, permet de télécharger, compiler et installer un SlackBuild ([http://www.slackbuilds.org)](http://www.slackbuilds.org)) automagiquement en une commande : "slackmerge nom_du_logiciel" . Son code : #!/bin/sh SLACKVER="12.0" SB_REPO="http://www.slackbuilds.org/ports/12.0/" # Usage : slackmerge # For example : slackmerge icewm mkdir /tmp/SmGE cd /tmp/SmGE wget -c $SB_REPO1ドル.tar.gz tar xvf 1ドル.tar.gz cd 1ドル cp 1ドル.info download echo "\ wget -c \$DOWNLOAD">> download sh download sh 1ドル.SlackBuild installpkg /tmp/*1ドル*.tgz Bien sûr, adaptez le script à votre version de la Slackware (même si déclarer une version plus récente ne pose en général que peu de problèmes) . Le deuxième, expérimental, s'appelle buildpkg et compile un paquet standard en un paquet Slackware . Il doit être utilisé en tant que root . Un paquet standard signifie ici : -que c'est un paquet du type logiciel-version.tar.bz2 ou logiciel-version.tar.gz qui se décompresse en un dossier nommé logiciel-version -qu'il utilise ./configure, make et make install . Son code : #!/bin/sh # Slackware build script for # Written by (your name) (your contact information) # (add license information here if you desire; otherwise, # all submissions are considered to be in the public domain) # Some licenses may incorporate the "Written by" information # above, and if so, that line can be omitted # We strongly suggest *not* using GPL for scripts, as it requires # a copy of the GPL to be distributed with it. Since the GPL # itself is longer than any build script will be, this just doesn't # make good sense... # |-----------------------------------------------------------------| # # REMOVE THIS ENTIRE BLOCK OF TEXT # # $Id: template.SlackBuild,v 1.4 2008年04月05日 20:51:58 slackbuilds Exp slackbuilds $ # This template is not meant to be a 'cut and paste' script to # enable any random user to make a working package. While # we're certainly not discouraging use of this template, if # you haven't manually gone through each step of the process # without the build script (typically as a normal user, as this # will reveal problems that you won't see as root), then there's # a good chance that something important is missing from your # submission. # When using this template script, please remove as many of # these unnecessary comments as possible. Commented code is # a good thing, but if it's obvious, there's no need to comment it. # |-----------------------------------------------------------------| # PRGNAM=$(echo 1ドル | sed 's/.tar.gz//' | sed 's/.tar.bz2//') # replace with name of program #VERSION=${VERSION:-1.4.1} # replace with version of program ARCH=${ARCH:-i486} # this should not change BUILD=${BUILD:-1} TAG=${TAG:-_SBo} # the "_SBo" is required CWD=$(pwd) TMP=${TMP:-/tmp/SBo} # For consistency's sake, use this PKG=$TMP/package-$PRGNAM #OUTPUT=${OUTPUT:-$CWD}# Drop the package in /tmp OUTPUT=$(pwd) JOBS=${JOBS:-3} # Might not be wanted or needed in some cases if [ "$ARCH" = "i486" ]; then £spaces£ £/spaces£SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then £spaces£ £/spaces£SLKCFLAGS="-O2 -march=i686 -mtune=i686" elif [ "$ARCH" = "x86_64" ]; then £spaces£ £/spaces£SLKCFLAGS="-O2 -fPIC" fi #set -e # Exit on most errors rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM tar xvf $CWD/$PRGNAM.tar.* cd $PRGNAM chown -R root:root . find . \ £spaces£ £/spaces£\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ £spaces£ £/spaces£-exec chmod 755 {} \; -o \ £spaces£ £/spaces£\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ £spaces£ £/spaces£-exec chmod 644 {} \; CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ £spaces£ £/spaces£--prefix=/usr \ £spaces£ £/spaces£--sysconfdir=/etc \ £spaces£ £/spaces£--localstatedir=/var \ £spaces£ £/spaces£--mandir=/usr/man # Compile the application and install it into the $PKG directory make -j $JOBS make install DESTDIR=$PKG ( cd $PKG £spaces£ £/spaces£find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true £spaces£ £/spaces£find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) if [-a $PKG/usr/man]; then \ ( cd $PKG/usr/man £spaces£ £/spaces£find . -type f -exec gzip -9 {} \; £spaces£ £/spaces£for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi rm -f $PKG/usr/info/dir || true gzip -9 $PKG/usr/info/*.info* || true ( cd $PKG £spaces£ £/spaces£# Remove 'special' files £spaces£ £/spaces£find . -name perllocal.pod \ £spaces£ £/spaces£-o -name ".packlist" \ £spaces£ £/spaces£-o -name "*.bs" \ £spaces£ £/spaces£| xargs rm -f ) # Copy program documentation into the package # The included documentation varies from one application to another, so be sure # to adjust your script as needed # Also, include the SlackBuild script in the documentation directory mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION #cp -a $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild> $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild # Copy the slack-desc (and a custom doinst.sh if necessary) into ./install mkdir -p $PKG/install cat $CWD/slack-desc> $PKG/install/slack-desc # Make the package; be sure to leave it in $OUTPUT # If package symlinks need to be created during install *before* # your custom contents of doinst.sh runs, then add the -p switch to # the makepkg command below -- see makepkg(8) for details cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$ARCH-$BUILD$TAG.tgz Affreusement pompé du script exemple ;)

AltStyle によって変換されたページ (->オリジナル) /