VectorLinux

Cooking up the Treats => New Package Requests => Topic started by: kidd on April 10, 2008, 05:16:37 pm

Title: Packaging howto
Post by: kidd on April 10, 2008, 05:16:37 pm
Hello vectorites,

I've written a little text about packaging as lately some people asked for it in the forums.

It's objective is not giving a full explanations about packaging internals but showing some of the basics to make a package good enough to get the repos.

It has to be polished, but the info is already there.  Feel free to edit it ;)

http://vectorlinux.com/wiki/doku.php?id=howtos:packaging59

HTH
Title: Re: Packaging howto
Post by: kc1di on April 10, 2008, 06:59:47 pm
Hello vectorites,

I've written a little text about packaging as lately some people asked for it in the forums.

It's objective is not giving a full explanations about packaging internals but showing some of the basics to make a package good enough to get the repos.

It has to be polished, but the info is already there.  Feel free to edit it ;)

http://vectorlinux.com/wiki/doku.php?id=howtos:packaging59

HTH


Nice write up  thanks for your efforts.

Title: Re: Packaging howto
Post by: Andy Price on October 09, 2008, 11:48:00 pm
Hi, this how to seems to have disappeared. Any new address?
Thanks
Title: Re: Packaging howto
Post by: lagagnon on October 10, 2008, 08:40:15 am
http://forum.vectorlinux.com/index.php?topic=1701.0
Title: Re: Packaging howto
Post by: kidd on October 11, 2008, 05:47:12 am
http://forum.vectorlinux.com/index.php?topic=1701.0

I don't think this howto is valid anymore.  To package apps for 5.9, you have to provide sources, and slackbuild, so checkinstall is useful only for your private work, but not for publishing.

I'l try to search my document.. Let's see if I have a backup of the text...
Title: Re: Packaging howto
Post by: kidd on October 11, 2008, 11:36:42 am
I think I definately lost the text... :(
Title: Re: Packaging howto
Post by: kukibl on December 01, 2008, 11:12:35 am
Would it be possible to post default VL SlackBuild template with few examples? I would like to try some packaging these days, if nothing else to try to learn something new. :)

Thank you in advance!
Title: Re: Packaging howto
Post by: kidd on December 01, 2008, 12:12:00 pm
Kukibl,

Theese days rbistolfi , uelsk8s and I are creating a helper application to make slackbuilds. If you're interested on trying and betatest it, it'd be great.

Here follows a typical slackbuild for VL6.  helper script will create the correct directory structure, and will fill names where necessary. You'll only have to tweak configure options and fill description

Code: [Select]
#!/usr/bin/bash
# This script assumes it will be launched within "/NAME/VERSION/src" dir.
# With all sources in "src" Your Vector Linux .tlz package, slack-desc,
# and slack-required will be found in "VERSION" dir. The extraction and
# build will be in a temp dir created in "NAME" dir, and then removed on exit.
# Comment out second to last line to keep this dir intact.


NAME=""            #Enter package Name!
VERSION=${VERSION:-""}      #Enter package Version!
VL_PACKAGER=${VL_PACKAGER:-""}   #Enter your Name!
LINK=\${LINK:-""}  #Enter URL for package here!

#SYSTEM VARIABLES
#----------------------------------------------------------------------------
BUILDNUM=${BUILDNUM:-"1"}
VL_VERSION=${VL_VERSION:-"$(ls /var/log/packages/|grep vlconfig2|cut -d "-" -f4|cut -c 2-5)"}
BUILD=${BUILD:-"$BUILDNUM""$VL_VERSION"}
ARCH=${ARCH:-$(uname -m)}
CONFIG_OPTIONS=${CONFIG_OPTIONS:-""}
CFLAG_OPTIONS=${CFLAG_OPTIONS:-""}
LDFLAG_OPTIONS=${LDFLAG_OPTIONS:-""}
#----------------------------------------------------------------------------


#SETUP PACKAGING ENVIRONMENT
#--------------------------------------------
CWD=$(pwd)
cd ../
RELEASEDIR=$(pwd)
cd $CWD
mkdir -p $RELEASEDIR/tmp
TMP=$RELEASEDIR/tmp
PKG=$TMP/package-$NAME
#--------------------------------------------


if [ $UID != 0 ]; then
   echo "You are not authorized to run this script. Please login as root"
   exit 1
fi

if [ ! -x /usr/bin/requiredbuilder ]; then
   echo "Requiredbuilder not installed, or not executable."
   exit 1
fi

if [ $VL_PACKAGER = "YOURNAME" ]; then
   echo 'Who are you?
   Please edit VL_PACKAGER=${VL_PACKAGER:-YOURNAME} in this script.
   Change the word "YOURNAME" to your VectorLinux packager name.
   You may also export VL_PACKAGER, or call this script with
   VL_PACKAGER="YOUR NAME HERE"'
   exit 1
fi


#CFLAGS SETUP
#--------------------------------------------
if [[ "$ARCH" = i?86 ]]; then
  ARCH=i586
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  CONFIGURE_TRIPLET="i486-slackware-linux"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fpic"
  CONFIGURE_TRIPLET="x86_64-pc-linux"
fi

export CFLAGS="$SLKCFLAGS $CFLAG_OPTIONS"
export CXXFLAGS=$CFLAGS
export FFLAGS=$CFLAGS
export FCFLAGS=$CFLAGS
export LDFLAGS="$LDFLAGS $LDFLAG_OPTIONS"
#--------------------------------------------

#GET THE SOURCE
#--------------------------------------------
if [ ! -f $CWD/$NAME-$VERSION.tar.* ]
then
        wget $LINK
fi
#--------------------------------------------

rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf $NAME-$VERSION

#EXTRACT SOURCES
#-----------------------------------------------------
echo "Extracting source..."
tar xvf $CWD/$NAME-$VERSION.tar.* || exit 1
#-----------------------------------------------------


cd $TMP/$NAME-$VERSION


#SET PERMISSIONS
#-----------------------------------------
echo "Setting permissions..."
chown -R root:root .
find . -perm 664 -exec chmod 644 {} \;
find . -perm 777 -exec chmod 755 {} \;
find . -perm 2777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 2755 -exec chmod 755 {} \;
find . -perm 774 -exec chmod 644 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
find . -perm 444 -exec chmod 644 {} \;
find . -perm 400 -exec chmod 644 {} \;
find . -perm 440 -exec chmod 644 {} \;
find . -perm 511 -exec chmod 755 {} \;
find . -perm 711 -exec chmod 755 {} \;
find . -perm 555 -exec chmod 755 {} \;
#-----------------------------------------


#CONFIGURE & MAKE
#----------------------------------------------------------------------
# If you are building a KDE-related app, then change the following
# arguments in the script below:
# --prefix=$(kde-config -prefix) \
# --sysconfdir=/etc/kde \
#
# Making these changes will ensure that your package will build in the
# correct path and that it will work seamlessly within the KDE environment.
#
#-----------------------------------------------------------------------
echo "Configuring source..."
./configure --prefix=/usr
  --sysconfdir=/etc
  --localstatedir=/var
  --mandir=/usr/man
  --with-included-gettext
  --disable-debug
  --program-prefix=""
  --program-suffix=""
  --build=$CONFIGURE_TRIPLET
  $CONFIG_OPTIONS || exit 1

make || exit 1

make install DESTDIR=$PKG || exit

#######################################################################
#Miscellenious tweaks and things outside a normal ./configure go here #
#######################################################################

#mkdir -p $PKG/usr/share/applications
#cp $CWD/$NAME.desktop $PKG/usr/share/applications/$NAME.desktop
#mkdir -p $PKG/usr/share/pixmaps
#cp $CWD/$NAME.png $PKG/usr/share/pixmaps/$NAME.png

mkdir -p $PKG/usr/doc/$NAME-$VERSION
cp -a README.txt PKG-INFO \
   $PKG/usr/doc/$NAME-$VERSION
cat $CWD/$NAME.SlackBuild > $PKG/usr/doc/$NAME-$VERSION/$NAME.SlackBuild

#----------------------------------------------------------------------

if [ -d $PKG/usr/share/man ] ; then
  mkdir -p $PKG/usr/man
  mv $PKG/usr/share/man/* $PKG/usr/man
  rm -rf $PKG/usr/share/man
fi
find $PKG/usr/man -type f -exec gzip -9 {} \;

if [ -d $PKG/usr/share/info ] ; then
  mkdir -p $PKG/usr/info
  mv $PKG/usr/share/info/* $PKG/usr/info
  rm -rf $PKG/usr/share/info
fi
find $PKG/usr/info -type f -exec gzip -9 {} \;

mkdir -p $PKG/install

           # This creates the white space in front of "handy-ruler" in slack-desc below.

      LENGTH=$(expr length "$NAME")
      SPACES=0
      SHIM=""
      until [ "$SPACES" = "$LENGTH" ]; do
        SHIM="$SHIM "
        let SPACES=$SPACES+1
      done

# Fill in the package summary between the () below.
# Then package the description, License, Author and Website.
# There may be no more then 11 $NAME: lines in a valid slack-desc.

cat > $RELEASEDIR/slack-desc << EOF
# 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 ':'.

$SHIM|-----handy-ruler------------------------------------------------------|
$NAME: $NAME (an enhanced interactive Python shell)
$NAME:
$NAME: An enhanced interactive Python shell.
$NAME:
$NAME:
$NAME:
$NAME:
$NAME:
$NAME: License:
$NAME: Authors:
$NAME: Website: http://


#----------------------------------------
BUILDDATE: $(date)
PACKAGER:  $VL_PACKAGER
HOST:      $(uname -srm)
DISTRO:    $(cat /etc/vector-version)
CFLAGS:    $CFLAGS
CXXFLAGS:  $CXXFLAGS
LDFLAGS:   $LDFLAGS
FFLAGS:    $FFLAGS
FCFLAGS:   $FFLAGS

EOF

cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc


#STRIPPING
#------------------------------------------------------------------------------------------------------------------
cd $PKG
echo " "
echo "Stripping...."
echo " "
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
#------------------------------------------------------------------------------------------------------------------


#FINISH PACKAGE
#--------------------------------------------------------------
echo "Finding dependencies..."
requiredbuilder -v -y -s $RELEASEDIR $PKG
echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.tlz"
makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tlz

cd $CWD
echo "Cleaning up temp files..." && rm -rf $TMP
echo "Package Complete"
#--------------------------------------------------------------

Our program will make easy to make packages for python,perl or noarch apps. 
Title: Re: Packaging howto
Post by: kukibl on December 01, 2008, 12:19:44 pm
Wow... that was fast.:) Thank you very much kidd for your response. I will be glad to help. Just tell me, is it possible to use your app on 5.9.x or is it meant just for VL6 and future releases (I ask because of testing - is it OK to test it on my 5.9.1 SOHO)? Also, where can I download it?
Title: Re: Packaging howto
Post by: kidd on December 02, 2008, 01:13:46 am
We're now making compatible with 5.9 (perl 5.8 and some other things)... Hopefully, in a few hours we'll have it uploaded somewhere
Title: Re: Packaging howto
Post by: player on December 03, 2008, 01:22:14 am
I've built a kdiff3 package using vpackager on my VL SOHO 5.9.1. Is it not good anymore? If it's good, how I should go about sharing it. I intend to built more packages if everything goes well. Thanks.
Title: Re: Packaging howto
Post by: kidd on December 03, 2008, 02:02:45 am
Packages built with vpackager are ok to redistribute , but only among your
computers and friends.  That was not this way until 5.9, but from now on, we
*have to* provide sources along with with binaries and a script to build the
binary from sources.  I suppose vpackager does everything internally, and can't
output a slackbuild file, so packages won't be included in the repos this way.

Packaging in VL SOHO is not the best distro to make packages for vl because it
may add extra dependencies of packages that aren't installed in vl std or light.
That happened in vl 5.8. I don't know if now, in 5.9 and 6.0 it's possible to
package in SOHO.

uelsk, hints?
Title: Re: Packaging howto
Post by: uelsk8s on December 03, 2008, 08:57:40 am
You should build packages on the lightest version possible to avoid adding unneeded deps.
with that said, it may be ok to build kdiff3 on SOHO since it requires kde anyway.

It will be recommended to use the new sbbuilder app to build packages as soon as it is ready
Title: Re: Packaging howto
Post by: Joe1962 on December 03, 2008, 10:27:07 am
... it may be ok to build kdiff3 on SOHO since it requires kde anyway.

Not really. I've always built kdiff3 as qt-only.
Title: Re: Packaging howto
Post by: kukibl on December 03, 2008, 02:48:43 pm
I am currently using sbbuilder and must admit that things are going great so far. Automatic generation of SlackBuild makes things easier a lot, so for classic "configure; make; make install" apps only slight modifications are required. :) Worked pretty well for me for openobex, obexftp, kdebluetooth...

I would like to ask one question... What is procedure to join VL's packaging team? I am currently using 5.9.1 soho and since VL6 is quite close to final release, I would like to start packaging some apps after VL6 comes out. So what are conditions and is there any free room in VL's packages team? :)

Thanks!

Alex
Title: Re: Packaging howto
Post by: player on December 03, 2008, 07:27:51 pm
That was my second question that didn't get any response - how to share the packages. I would like to contribute back to the community, but I don't know how and if anyone is interested. There are some packages that I use daily but that are not get updated often enough (vim, git, ...). Please let me know if you are interested.
Title: Re: Packaging howto
Post by: rbistolfi on December 03, 2008, 07:33:58 pm
For contributing packages you need to contact Johnb316, you can send a pm to him and he will answer back with instructions.
Title: Re: Packaging howto
Post by: kidd on December 04, 2008, 07:24:03 am
Well, the tool to make packaging faster and easier is out (its first public version)

More info:

http://forum.vectorlinux.com/index.php?topic=7886.0