VectorLinux
November 29, 2014, 12:22:45 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1] 2
  Print  
Author Topic: HOW TO BUILD PACKAGES FOR THE VL REPOSITORY  (Read 23517 times)
JohnB316
Administrator
Vectorian
*****
Posts: 1346


Registered Linux User #386728


« on: January 01, 2007, 12:14:15 pm »

This is a repost of LLL's post from the old VL forum. The points in it are geared toward VL 5.8. I've taken liberty to update, add and subtract where appropriate.

Cheers,
John

==============
STOP!  Wink

BEFORE YOU GO TOO FAR, SEE HOW LONG THIS HOW-TO IS, AND GIVE UP...
1) You likely already have a lot of the skills/knowledge outlined below.
2) If you don't: The details are there for you!
3) Anyone can do this; it's been written by a newbie, for a newbie.
4) If you have questions: post them below!

--------------------------------------------------

THE BASICS:

A very basic conceptual understanding of what we're about to do:
Get Source Code --> Configure it --> Compile it --> Package it --> SHARE IT!



THE DETAILS:

A) PREPARE THE HOST (AKA 'YOUR SYSTEM')

1. Clean that box! The development box (or partition) should be as clean as possible, meaning that it doesn't have any veclinux-current, slackware-current or freerock (or other) gnome packages on it. The reason behind this is that we don't want to force dependencies that could cause breakage.

Notes on using a Virtual Machine as your host: Here and here.

2. No OOo! For a similar reason, a build environment should not have OpenOffice as part of it. OpenOffice tends to include symlinks to standard libraries. If a Vector packages is built and OpenOffice is on the box, OO will become an unneeded dependency.

Suggestion: If you have a free partition, perform a clean install of Vector Linux Standard 5.1; make no changes - save this 'install' as your packaging station. If you can't sacrifice the hard-drive space, just keep your system as clean as possible; if your packages aren't working due to a 'dirty' system, we'll find out in testing  Wink

3) Set your environment. Put the code below in your $HOME/.bashrc (that's the hidden file called '.bashrc' in your home directory!); doing so sets your system to create packages optimized to VL-standards.
Code:

export CFLAGS="-O2 -mtune=i686 -march=i586"
export CXXFLAGS="$CFLAGS"


Interested in knowing more about compiling flags?!



B) GET THE SOURCE!

1) Download the source code of your choice from the software homepage. Source code typically comes as *.tar.gz or *.tar.bz2 files (the latter has better compression = smaller download for you!).

2) Check for any dependencies listed in the application's docs/on the web. Install them if necessary (using existing packages - e.g., linuxpackages.net - or by compiling them from source...keep reading!). If you have to install/package any dependencies, you will need to share those in the VL-repository as well.

Notes on dependencies (found in the posts below, linked for ease of use):
- 'Dependents'
- 'Suggests'


C) COMPILE & PACKAGE

Open a terminal or command-line interface of your choice; any time this guide asks you to 'Type...', do it in the terminal!

1) Unzip/tar your source code file
Depending on the file you downloaded, use:
Code:
tar xzvf filename.tar.gz
---or---
Code:
tar xjvf filename.tar.bz2


- Move or 'cd' into the new directory (likely of the same name as the file you downloaded)
- Check for an 'Install' or 'Readme' in that folder and read it! Then...


2) Configure & Compile
a) Software Options:
Many software-specific compiling options can be found by typing './configure --help'. For example, when building Sylpheed, you can tell it to be built with spellcheck by typing './configure --enable-aspell' instead of just './configure'. Doing a basic './configure' should, in most cases, just provide the generic program options which should work just fine. The 'readme' or 'install' files may also discuss these options.

b) Installation Location
- You can force the application to be installed in a particular location; on VL, almost every package you create should go to '/usr'.
- How do you tell it to set things up there? With the '--prefix=/usr' option!
- What about apps stored elsewhere?! Not sure where to 'prefix' something to? Guidelines:

Quote from: Someone smarter than me
i) If you are contributing a new package (one not available up to now), use --prefix=/usr.
ii) If you're contributing an updated version of an existing package, check where the old one is installed and use that prefix (most of the time it's /usr sometimes /usr/X11R6, etc.).

Quote from: Kocil
* About --prefix options
Just to make it tidy a bit
- /usr : for text based applications and libraries
- /usr/X11R6 : for X11 and its immediately related packages, like freetype.
- /opt : for static applications (OpenOffice, Acrobat reader, etc)
- /opt/kde : kde and it's applications
- /usr : XFCE4 and it's applications
- /usr/local : experimental
- /usr/games : games other than those that are KDE-dependent


Now, type:
Code:
./configure (+any options you chose above) && make


For those of you like me who need examples...here's a potential ./configure string for Sylpheed:
Code:
./configure --prefix=/usr --enable-aspell && make

That would set things up to install files in /usr while making spell-check (aspell) available.


3) Setup Checkinstall
- Checkinstall will produce a *.tlz or 'Vector Package' that can be installed/removed via Gslapt or using the 'installpkg' command.
- For effective package building using checkinstall, a description-pak file needs to be created.
- Name it 'description-pak' and save it in the top level of the build directory (i.e., the directory you first cd'ed into way back when/above).
- The description-pak contents are as follows:
Quote from: Kocil
Code:
pkg-name (Description)

The complete description up to [b]9 lines[/b].

Website: http://pkg.sf.net
License: GNU GPL
Author: someone


pkg-name: the correct name of the package
Description: will be shown on VL install, pkgtools or gslapt. Must put it in the () bracket!
Website: VERY IMPORTANT.
License: Check it carefully. GNU GPL is very common. Others include GNU LGPL, Apache, QPL, Sun Public License, BSD, etc.
Author: Please respect the one(s) that make the software in the first place!

Why bother with the description-pak?
- If you don't provide the proper description, VL-Install or gslapt will show "Package created by checkinstall-x.y", which is not so nice.
- Making complete descriptions will also help in the event that someone creates a database of available packages at some point (*hint*) - the database could pull the info directly from the package descriptions.


4) Run Checkinstall

For the final step we need root privileges, so 'su' and type your root password. As root, type:
Code:
checkinstall -L



Quote from: Kocil
USE ONLY VL provided checkinstall that has been patched with slapt-get support. The original checkinstall does not create dependency info by itself. You might setup a manual dependency info by creating files named required-pak, suggests-pak and conflict-pak in the base directory of the package.


D) INSTALL FOR TESTING

Type:

Code:
installpkg software-name.tlz


- After testing, you may remove the package from your host by typing

Code:
removepkg software-name.tlz





E) NAME YOUR PACKAGE

Ensuring appropriate filenames for our packages is a crucial step:
- Why? See Wiki <To be added shortly...>
- As a general rule, Checkinstall will handle the naming for you. In case it doesn't, here's what we're looking for:

NAME-VERSION-ARCH-RELEASE.tlz

NAME: Software Name (e.g., Firefox 1.0.7)
VERSION: Software Version (e.g., Firefox 1.0.7)
- 'Version' must be ONE segment (contains no dashes: '-'). If you have a dash (-), convert it to an underscore ( _ ).
ARCH: i586
RELEASE: 4vl58

The release number needs to be increased if you are rebuilding a package due to packaging errors, the need to incorporate bugfixes in the form of patches, etc. To use the firefox example, if you built firefox-1.0.7-i586-4vl58.tlz and had to rebuild due to an error, the new version would be named firefox-1.0.7-i586-5vl58.tlz. Being consistent with this ensures that the repository maintenance tools will work correctly.


F) SHARE YOUR PACKAGE!

- JohnB316 is our local package repository guru; PM him about uploading your package.


G) ASK QUESTIONS!

- Please...please...if you want to help out, but are stuck on something: ASK! I will gladly be the most patient man ever in helping you along if it means one more happy packager for the VL-community.



AND THAT'S IT...THANKS FOR YOUR CONTRIBUTION!  Cheesy
Happy Vectoring!


P.S. Some interesting reading on the history of checkinstall/slapt-get on Vector Linux.

P.P.S: JohnB316 inserted Kocil's additions from his post and noted them as such by using the quote function of phpBB.

======

Some JohnB316 additions to this info:

1) There is some good reading at linuxpackages.net on how to build good packages. I strongly recommend this literature to anybody who wants to do packaging.

2) If you prefer to use checkinstall to do the packaging step (I don't - I personally prefer to use traditional SlackBuild scripts, which I'll discuss in another thread in the future, but I digress), please read the documentation for using checkinstall correctly. You can find the latest README on line here.

3) Be aware that checkinstall will not work in certain situations, like building Mozilla-based applications and other similar apps.

4) There are special considerations needed when building a standalone package to go into /opt. Those will be discussed in a separate thread.

Cheers,
John
« Last Edit: January 01, 2007, 01:56:49 pm by JohnB316 » Logged

VL 6.0 SOHO latest alpha on one box, VL 5.9 Lite on the other.
MikeCindi
Tester
Vectorian
****
Posts: 1073


« Reply #1 on: January 01, 2007, 01:07:44 pm »

Thank you JohnB316.
Logged

The plans of the diligent lead to profit...Pro. 21:5
VL64 7.1b3                                     RLU 486143
forbajato
Packager
Member
****
Posts: 46


« Reply #2 on: January 01, 2007, 04:57:14 pm »

Perfect, just what I was looking for.

forbajato
Logged
stoichyu
Packager
Vectorite
****
Posts: 369



« Reply #3 on: January 03, 2007, 05:55:49 am »

I'd like to add some stuff I found out while using checkinstall to package.

1. By default checkinstall guesses the architecture to be i386. This can be overridden in the /usr/lib/checkinstall/checkinstallrc file. Change the line that says ARCHITECTURE="" to ARCHITECTURE="i586" It's pretty nifty since I don't have to manually change the architecture each time I use checkinstall.

2. In case the program you're compiling doesn't use a make install or you want to use a different command when compiling use "checkinstall -L <command>."

Note: I got these from the README. I just found these to be really useful.


Also, here's how I did the chroot setup (it's more convenient since you don't have to install to a different partition or to a vm), you have to do the following as su/root:

1. Get the ff. from the VL-5.8 cd:
*veclinux/required/veclinux.tlz
*veclinux/required/vlconfig.tlz (not sure if reqd, I think this gives you the defaults for /etc)
*veclinux/required/vlconfig2.tlz (not sure if reqd, I think this gives you the rc/config files for root)
*veclinux/optional/X11.tlz (for x-apps, if you plan to build them)
*veclinux/optional/dev.tlz

you probably don't need the other packages but if you do you can always get them later. they are
*veclinux/optional/samba.tlz (not sure why you'd need this, will just add some unnecessary dependencies sometimes)
*veclinux/optional/kernel-src.tlz (you should know if you need this)

for other packages you can always slapt-get them

2. Put them in your fake root directory, something like /home/build-root, then cd to that dir

3. Extract the packages with "lzma -d -c * | tar x"

4. Remove the packages if you want. "rm *.tlz"

5. To go into your nice and clean build environment do "chroot . /bin/bash"

6. You would probably want to copy the src files to the build environment. Don't do this while chrooted(you can't). Just copy the files to /home/build-root/tmp or someplace you'd like.

This setup takes up about 3GB(amazing what you can store with tlz files). Also, you can't use x-apps when chrooted but you wouldn't need to do that anyway.
Logged

There's no place like ~.
VL 5.8 PentiumD 2.8Ghz Registered Linux User #432836
caitlyn
Packager
Vectorian
****
Posts: 2876


WWW
« Reply #4 on: January 22, 2007, 12:12:38 pm »

For those building gtk2 packages I'd like to encourage using the --with-installed-gettext option when you run ./configure.  This can be specified in addition to --prefix=/usr or anything else you need.  What this option does in supported applications and libraries is add full internationalization/localization (foreign language) support.  It will result in a bigger package but it will also make it usable for the significant part  of the world's population for whom one of the three or four most popular European languages isn't a first language.

John:  Is this something VL developers might eventually want to make policy?

Just my .02...

-Cait
Logged

eMachines EL-1300G desktop, 1.6GHz AMD Athlon 2650e CPU, 4GB RAM, nVidia GeForce 6150 SE video
CentOS 6.5 (will try VL64-7.1 soon)

Toshiba Satellite A135-S4727,  Intel Pentium T2080 / 1.73 GHz, 2GB RAM, Intel GMA 950

HP Mini 110 netbook, 1.6GHz Intel Atom CPU, 2GB RAM, Intel 950 video, VL 7.1
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« Reply #5 on: January 22, 2007, 12:23:53 pm »

Thanks for pointing this out, caitlyn, I always thought not using --disable-nls was enough. I'm going to be adding that to my library of build instructions I keep for each app. FWIW, it gets my vote to become policy.
Logged

O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10
caitlyn
Packager
Vectorian
****
Posts: 2876


WWW
« Reply #6 on: January 22, 2007, 12:36:02 pm »

Thanks for the vote, Joe Smiley

This appears to be the reason why Xfce will, for example, put an appropriate translation for the word menu but not actually translate the menu (at least the category/submenu headers) into a language like Hebrew.  I am still trying to figure out why the menu doesn't flip from the left corner to the right when using an RTL language (also includes Arabic, Thai, Yiddish) in Xfce as it does in other distros. 

Thanks again,
Cait
Logged

eMachines EL-1300G desktop, 1.6GHz AMD Athlon 2650e CPU, 4GB RAM, nVidia GeForce 6150 SE video
CentOS 6.5 (will try VL64-7.1 soon)

Toshiba Satellite A135-S4727,  Intel Pentium T2080 / 1.73 GHz, 2GB RAM, Intel GMA 950

HP Mini 110 netbook, 1.6GHz Intel Atom CPU, 2GB RAM, Intel 950 video, VL 7.1
stoichyu
Packager
Vectorite
****
Posts: 369



« Reply #7 on: January 25, 2007, 07:48:37 am »

Edit: The one I first posted didn't work quite right.
I made a script that checkinstall can use so checkinstall can work with python packages.

checkinstall-python:
Code:
#!/bin/sh
python setup.py bdist
cd dist
tar xvf *.tar.gz -C/
cd ..
rm dist -r

then make it executable.

To use, when building python packages you can now simply use
Code:
checkinstall -L "checkinstall-python"
« Last Edit: January 25, 2007, 08:10:41 am by stoichyu » Logged

There's no place like ~.
VL 5.8 PentiumD 2.8Ghz Registered Linux User #432836
M0E-lnx
Administrator
Vectorian
*****
Posts: 3192



« Reply #8 on: January 25, 2007, 08:07:00 am »

Thanks for that tip.... I don't like python... but this could be useful
Logged

The Headacher
Louder than you
Global Moderator
Vectorian
*****
Posts: 1553


I like the bass to go BOOM!


WWW
« Reply #9 on: January 25, 2007, 08:12:32 am »

You can put pretty much every command that would install some software between the quotes.
Logged

Most music on my soundcloud page was arranged in programs running on VL.
stoichyu
Packager
Vectorite
****
Posts: 369



« Reply #10 on: January 25, 2007, 08:23:12 am »

You can put pretty much every command that would install some software between the quotes.
I have tried that and python packages would just refuse to install. The script does what I normally do to package python stuff but lets checkinstall do the dirty work i.e add deps, desc,...
Logged

There's no place like ~.
VL 5.8 PentiumD 2.8Ghz Registered Linux User #432836
blurymind
Packager
Vectorian
****
Posts: 1082



« Reply #11 on: January 25, 2007, 09:56:49 am »

this howto lacks some helpful info such as:

*how to add files in a package
*how to change package's description
*how to make a package with makepkg (when checkinstall doesnt work on the perticular instalation procedure of the app)
 Smiley
*how to include a menu entry of the app in the package (the start menu)
« Last Edit: January 25, 2007, 10:21:07 am by blurymind » Logged

status: playing around with new tablet and learning to 3d :p
google page :  http://blurymind.googlepages.com
DA PAGE :  http://www.blurymind.deviantart.com/
JohnB316
Administrator
Vectorian
*****
Posts: 1346


Registered Linux User #386728


« Reply #12 on: January 25, 2007, 07:19:49 pm »

this howto lacks some helpful info such as:

*how to add files in a package

Are you talking about adding files after the package is packaged or before? This is best accomplished via scripting the build. Otherwise, it's a very simple matter of exploding the package with explodepkg, adding what you need, then repackaging it with the makepkg command.

Quote
*how to change package's description

Er, you should think about the package description BEFORE you build the package.  Angry

Quote
*how to make a package with makepkg (when checkinstall doesnt work on the perticular instalation procedure of the app)
 Smiley

Typing makepkg --help as root will get you that information. ;-)

Quote
*how to include a menu entry of the app in the package (the start menu)

Most well-written X applications will do this for you automatically. If not, then a .desktop file needs to go into /usr/share/applications. There are several posts in the forum with examples, so use the search tool.

HTH,
John
Logged

VL 6.0 SOHO latest alpha on one box, VL 5.9 Lite on the other.
easuter
Global Moderator
Vectorian
*****
Posts: 2160



« Reply #13 on: January 26, 2007, 02:42:16 am »

Quote
*how to include a menu entry of the app in the package (the start menu)

This is what I do if I've already used checkinstall to build the package and want to add a .desktop:

First create a temporary directory wherever you want. then enter it:

Code:
cd tmp

then move or copy your package into there:

Code:
cp /path/to/package ./

then explode the package:

Code:
explodepkg package-name.tlz

Let it extract, then remove the package:

Code:
rm packagename.tlz

You should see your temporary directory with new directories like usr/ and lib/ for example.
Any files you want to add to the package must be put in the corresponding directories in your temporary dir.
Like JohnB316 said: X-apps should normaly include .desktops. But lots of them don't.

Now check to see if in your temporary dir you have usr/share/applications and usr/share/icons or usr/share/pixmaps.
The icons and pixmaps directories should be there, but go into them, and make sure there are useable icons (doesn't matter what size).
If not, then make the icons dir and add an icon for your menu entry yourself:

Code:
mkdir -p usr/share/pixmaps/

and save you custom icon in there (should one not exist).

Now make the applications .desktop dir:

Code:
mkdir -p usr/share/applications/

You could try creating your own .desktop, but the easiest is simply to copy one from your existing filesystem and then modify it:

Code:
cp /usr/share/applications/gftp.desktop usr/share/applications/name_here.desktop

make sure you change its name when you copy it (replace "name_here"). the .desktop name doesnt have to be a full package name, just a short descriptive name.

now edit it and change its contents with your favourite editor.
Make sure you remove the old name and tooltip, description and replace them with the new app's one. Also, edit the catagory line to make sure it will be placed in the correct menu section.
Also be sure you add the right icon path in the icon line.
Save up, and close your edit, and remake the package:

Code:
makepkg appname-version-arch-4vl58.tlz

"appname" must be exactly the same as the name you see in install/slack-desc with the colons.

after its done recompressing your package, then install it and test it by using the menu entry for it. If you missed something like putting in the wrong command, you will know Wink

« Last Edit: January 26, 2007, 02:45:46 am by easuter » Logged

thegeekster
Member
*
Posts: 17


« Reply #14 on: May 23, 2007, 06:15:50 pm »

Nice info..........  Grin

However, I would like to point out all but two of the links in the first post are broken..........They point to a VL forum at the 'ibiblio.org' site which doesn't exist......

It's nice to know about the patched checkinstall!...........Also, I had a main package building script that automated the process of downloading the source, configuring/compiling from a SlackBuild script, and installing using Slack's package tools.......I'll see if I can find it if anyone's interested......

---thegeekster
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!