LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 08-02-2013, 01:02 PM   #1
PeterUK
Member
 
Registered: May 2009
Posts: 277

Rep: Reputation: 16
Slackware- package creation help


I still learning how to create a script for installation so, I decided that may be a good practice to create a package that I already have so this what I did, bare in mind that the script stop in info folder creation.

I have this package from here that is foomatic-filters-4.0.12-i486-1.txz

I already have that package installed in my system. you could installed by only typing "upgradepkg --install-new foomatic-filters-4.0.12-i486-1.txz" but that is out that scope as Its already in (its my current package)

So I also can get the original package from: here

I went to look at "./configure --help" from that package and it say that you could use: " --infodir=/usr/info\" so I did but its stopping at:

Quote:
gzip: /tmp/SBo/package-foomatic-filters/usr/info/*.info*: No such file or directory
Obviously that folder is not in there. so it means that should not be there?

---------- Post added 08-02-13 at 07:02 PM ----------

This is the script:

Quote:
#!/bin/sh

foomatic-filters-4.0.12.tar.gz

PRGNAM=foomatic-filters # replace with name of program
VERSION=${VERSION:-4.0.12} # replace with version of program
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} # the "_SBo" is required

# 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} # For consistency's sake, use this
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp

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

set -e # Exit on most errors
# If you prefer to do selective error checking with
# command || exit 1
# then that's also acceptable.

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;

# Your application will probably need different configure flags;
# these are provided as an example only.
# Be sure to build only shared libraries unless there's some need for
# static.
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--infodir=/usr/info\
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux

# Compile the application and install it into the $PKG directory
make
make install DESTDIR=$PKG

# Strip binaries and libraries - this can be done with 'make install-strip'
# in many source trees, and that's usually acceptable if so, but if not,
# use this:
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# Compress man pages
# If the man pages are installed to /usr/share/man instead, you'll need to either
# add the --mandir=/usr/man flag to configure or move them manually after the
# make install process is run.
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

# Compress info pages and remove the package's dir file
# If no info pages are installed by the software, don't leave this in the script
rm -f $PKG/usr/info/dir
gzip -9 $PKG/usr/info/*.info*

# Remove perllocal.pod and other special files that don't need to be installed,
# as they will overwrite what's already on the system. If this is not needed,
# remove it from the script.
# Remove 'special' files
find $PKG -name perllocal.pod \
-o -name ".packlist" \
-o -name "*.bs" \
| 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 \
<documentation> \
$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
cat $CWD/doinst.sh > $PKG/install/doinst.sh

# 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-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
 
Old 08-02-2013, 01:13 PM   #2
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
UPDATE1:

if I remove info from config and remove the info bit from the script it also hang on doc.

Again I look at the "./configure --help" and if say you can use: " --docdir=DIR "

So I did used as: --docdir=/usr/doc/$PRGNAM-$VERSION \ but there is not folder as document.

But if you look at foomatic-filters-4.0.12-i486-1.txz, there is a doc folder, how do they can get that in there?

Here is the script so far:

Quote:
#!/bin/sh

foomatic-filters-4.0.12.tar.gz

PRGNAM=foomatic-filters # replace with name of program
VERSION=${VERSION:-4.0.12} # replace with version of program
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} # the "_SBo" is required

# 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} # For consistency's sake, use this
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp

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

set -e # Exit on most errors
# If you prefer to do selective error checking with
# command || exit 1
# then that's also acceptable.

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;

# Your application will probably need different configure flags;
# these are provided as an example only.
# Be sure to build only shared libraries unless there's some need for
# static.
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux

# Compile the application and install it into the $PKG directory
make
make install DESTDIR=$PKG

# Strip binaries and libraries - this can be done with 'make install-strip'
# in many source trees, and that's usually acceptable if so, but if not,
# use this:
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# Compress man pages
# If the man pages are installed to /usr/share/man instead, you'll need to either
# add the --mandir=/usr/man flag to configure or move them manually after the
# make install process is run.
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

# Compress info pages and remove the package's dir file
# If no info pages are installed by the software, don't leave this in the script
#rm -f $PKG/usr/info/dir
#gzip -9 $PKG/usr/info/*.info*

# Remove perllocal.pod and other special files that don't need to be installed,
# as they will overwrite what's already on the system. If this is not needed,
# remove it from the script.
# Remove 'special' files
find $PKG -name perllocal.pod \
-o -name ".packlist" \
-o -name "*.bs" \
| 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 \
<documentation> \
$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
cat $CWD/doinst.sh > $PKG/install/doinst.sh

# 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-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
 
Old 08-02-2013, 02:53 PM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,211

Rep: Reputation: 292Reputation: 292Reputation: 292
This:

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION

creates the doc dir. And this:

cp -a \
<documentation> \
$PKG/usr/doc/$PRGNAM-$VERSION

Needs changing. take out the <documentation> and replace it with the list of docs in the source dir- usually README, INSTALL etc
 
Old 08-02-2013, 03:39 PM   #4
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by dive View Post
This:

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION

creates the doc dir. And this:

cp -a \
<documentation> \
$PKG/usr/doc/$PRGNAM-$VERSION

Needs changing. take out the <documentation> and replace it with the list of docs in the source dir- usually README, INSTALL etc
I looked a file and its something like:

ChangeLog.txt COPYING.txt README.txt STANDARD_installation TODO.txt USAGE.txt INSTALL.txt\

But I dont know the extension , how do I know them? Do I need them?

I read you can list it like:

ls -l | grep ^-

but that is not working!
 
Old 08-02-2013, 04:26 PM   #5
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Just look at the untarred source file and look for any files that might fit. It's good sense to include any license file, ChangeLog and README files, but that depends on your program/source. If you find any other files that are of interest for you, just include it

In your case, just take a look at /tmp/SBo/foomatic-filters-4.0.12 and see what's there. Once again, I suggest you take a look at Patricks SlackBuild to build this package.

Last edited by titopoquito; 08-02-2013 at 04:28 PM.
 
Old 08-02-2013, 04:45 PM   #6
PeterUK
Member
 
Registered: May 2009
Posts: 277

Original Poster
Rep: Reputation: 16
I still not sure if there is another way to list extension file I tried all possible combinations of ls and nothing!

so I did like this:

ChangeLog COPYING README STANDARD_installation TODO USAGE INSTALL\

now in the slack-desc as there was none I create one like:

Quote:
# 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------------------------------------------------------|
foomatic-filters: foomatic-filters ()
foomatic-filters:
foomatic-filters: This is a test
foomatic-filters: backends for Python running on Windows, Linux, BSD (possibly any POSIX
foomatic-filters: compliant system), Jython and IronPython (.NET and Mono).
foomatic-filters:
foomatic-filters: Homepage: http://foomatic-filters.
foomatic-filters:
foomatic-filters:
foomatic-filters:
foomatic-filters:
and I also have to create the doinst.sh I picked one like that but I am not sure how to change it:
Quote:
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi
then this is the package so far:

Quote:
./
usr/
usr/bin/
usr/bin/foomatic-rip
usr/man/
usr/man/man1/
usr/man/man1/foomatic-rip.1.gz
usr/lib/
usr/lib/cups/
usr/lib/cups/filter/
usr/lib/cups/backend/
usr/lib/cups/backend/beh
usr/lib/ppr/
usr/lib/ppr/interfaces/
usr/lib/ppr/lib/
usr/doc/
usr/doc/foomatic-filters-4.0.12/
usr/doc/foomatic-filters-4.0.12/ChangeLog
usr/doc/foomatic-filters-4.0.12/STANDARD_installation
usr/doc/foomatic-filters-4.0.12/COPYING
usr/doc/foomatic-filters-4.0.12/TODO
usr/doc/foomatic-filters-4.0.12/USAGE
usr/doc/foomatic-filters-4.0.12/README
usr/doc/foomatic-filters-4.0.12/INSTALL
usr/doc/foomatic-filters-4.0.12/foomatic-filters.SlackBuild
etc/
etc/foomatic/
etc/foomatic/filter.conf.sample
etc/foomatic/filter.conf
etc/foomatic/direct/
install/
install/slack-desc
install/doinst.sh

Slackware package /tmp/foomatic-filters-4.0.12-i486-1_SBo.tgz created
Now compare the two package and they look nearly the same, if those file I created are right?

---------- Post added 08-02-13 at 10:46 PM ----------

UPDATE1: the script

Quote:
#!/bin/sh



PRGNAM=foomatic-filters # replace with name of program
VERSION=${VERSION:-4.0.12} # replace with version of program
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} # the "_SBo" is required

# 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} # For consistency's sake, use this
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp

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

set -e # Exit on most errors
# If you prefer to do selective error checking with
# command || exit 1
# then that's also acceptable.

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;

# Your application will probably need different configure flags;
# these are provided as an example only.
# Be sure to build only shared libraries unless there's some need for
# static.
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux

# Compile the application and install it into the $PKG directory
make
make install DESTDIR=$PKG

# Strip binaries and libraries - this can be done with 'make install-strip'
# in many source trees, and that's usually acceptable if so, but if not,
# use this:
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# Compress man pages
# If the man pages are installed to /usr/share/man instead, you'll need to either
# add the --mandir=/usr/man flag to configure or move them manually after the
# make install process is run.
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

# Compress info pages and remove the package's dir file
# If no info pages are installed by the software, don't leave this in the script
#rm -f $PKG/usr/info/dir
#gzip -9 $PKG/usr/info/*.info*

# Remove perllocal.pod and other special files that don't need to be installed,
# as they will overwrite what's already on the system. If this is not needed,
# remove it from the script.
# Remove 'special' files
find $PKG -name perllocal.pod \
-o -name ".packlist" \
-o -name "*.bs" \
| 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 \
ChangeLog COPYING README STANDARD_installation TODO USAGE INSTALL\
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

echo $PKG/install

# Copy the slack-desc (and a custom doinst.sh if necessary) into ./install
mkdir -p $PKG/install
echo $PKG/install
echo $CWD
echo $CWD/$PRGNAM-$VERSION

cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
#cat $CWD/$PRGNAM-$VERSION/slack-desc > $PKG/install/slack-desc
#cat $CWD/$PRGNAM-$VERSION/doinst.sh > $PKG/install/doinst.sh

# 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-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
 
Old 08-03-2013, 02:33 AM   #7
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
You can use "less" to view the file.
 
  


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
RPM Package creation question rahulthewall3000 Programming 13 07-03-2008 06:27 AM
.deb vs .rpm package creation uselpa Linux - Distributions 2 09-04-2007 12:45 AM
package creation problem mobilemonkey Linux - Newbie 5 07-22-2007 01:13 PM
Creation of RPM package yashwantpinge Programming 1 03-06-2006 07:57 AM
package creation problem Rognon Slackware 8 03-28-2005 04:56 PM


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