[HOW TO] Compile a package from source

Post tutorials, HOWTO's and other useful resources here.
Post Reply
User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

[HOW TO] Compile a package from source

Post#1 by freestyler » 08 May 2014, 13:46

This is just a quick beginners guide on how to build a package from source. Not every package is compiled the same, I will cover the 2 most common ways as well as how to use slackbuilds. Usually there is instructions in the INSTALL file. To do this you will need the devel.xzm module.

First example we will compile xfce-theme-manager, this method applies to packages that contain a file called "configure" and is the most common:
1.Download the source package from here
2.Unpack it and enter the directory (if you are using a file manager then right click and choose "open terminal here"
3.enter the following in the terminal:

Code: Select all

./configure
once that is done execute:

Code: Select all

make
4.Now we need to install the package, instead of installing it directory to the system we will install it to the /tmp directory so we can turn it into a porteus module to do this we need to be root enter:

Code: Select all

su
and type your password, then:

Code: Select all

make install DESTDIR=/tmp/xfce-theme-manager-0.3.4
5.Now convert /tmp/xfce-theme-manager-0.3.4 to xzm module and your done. (It can also be converted to a slackware package by entering the directory /tmp/xfce-theme-manager-0.3.4 and typing)

Code: Select all

makepkg ../xfce-theme-manager-0.3.4.tgz
There will be a slackware package waiting for you in /tmp

The next way is using cmake, you will know its cmake if it has a file called CMakeLists.txt, I cant find a package at the moment that uses cmake for an example (ill try to remember to update this post next time I come across one) but this is how it goes:
1.unpack the source and enter the directory
2.make a directory called build

Code: Select all

mkdir build
3.enter the directory

Code: Select all

cd build
4.start cmake

Code: Select all

cmake ..
5. Now its just the same as the last example make the source, install it and convert to module

Code: Select all

make
then get root access:

Code: Select all

su
enter password and:

Code: Select all

make install DESTDIR=/tmp/package-name
and convert

The last method I will cover is using slackbuilds. You can find a whole bunch of packages available at http://slackbuilds.org for the example lets use ffmpeg:
1.Search for ffmpeg at slackbuilds.org
2.download the source package and the slackbuild
3.unpack the slackbuild and copy the source package into the directory
4.we need to make sure the slackbuild file is executable to enter in terminal:
(keep in mind it is case sensitive)

Code: Select all

chmod +x ffmpeg.SlackBuild
now run the slackbuild script as root:

Code: Select all

su
enter password and then

Code: Select all

./ffmpeg.SlackBuild
5.Done! you now have a proper slack package that includes a /install folder with a slack-desc (description file) waiting for you in /tmp
6.Convert to module

Hope this will help anyone that wants to get started compiling their own packages. This is just a beginners guide and as you compile more you will come across other methods of compilation as well as the need to use arguments in the configuring of a package (like selecting architecture and base directories), just remember to read the INSTALL file.
Good luck!
Last edited by freestyler on 09 May 2014, 09:42, edited 1 time in total.
https://www.porteus-apps.org

User avatar
Obosan
Samurai
Samurai
Posts: 113
Joined: 28 Mar 2014, 17:02
Distribution: Porteus xfce 32BIT v3.0
Location: JAPAN

Re: [HOW TO] Compile a package from source

Post#2 by Obosan » 08 May 2014, 15:59

@freestyler
This is amazing! It gave me goose bumps! You're the man.
When I am impressed I get goose bumps as my intuition.
Maybe you are not. :oops:

Please allow to me say that you might be a saviour and/or a saint for me
to use Porteus in peace. You're the one of angels! :angel:

This HOW TO will be a milestone for porteus/linux newbies!
Thanks freestyler!

User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

Re: [HOW TO] Compile a package from source

Post#3 by freestyler » 08 May 2014, 16:14

Glad to help :)
https://www.porteus-apps.org

3n1gm4
White ninja
White ninja
Posts: 4
Joined: 09 May 2014, 06:47
Distribution: Porteus 3.0 x86_64 KDE_Desktop
Location: Croatia, Dalmatia

Re: [HOW TO] Compile a package from source

Post#4 by 3n1gm4 » 09 May 2014, 07:09

Hi and thanks for instructions... :good:
I am new with Linux and Porteus so that mean I don't have a clue about programming...(I'm not IT expert at all)
So looking for some good Linux distro I found Porteus as the best for my needs.
Now I have problem with this app "QtBitcoinTrader" https://bitcointalk.org/index.php?topic=201062.0
I can't install it (I don't Know how) even with these three type of your instructions because:
1. there is no config file in source
2. there is no cmake file in source
3. it's not listed in slackbuild repository.
Using this Linux package http://packages.altlinux.org/en/Sisyphu ... Trader/get
I converted rpm to xzm but app don't work (probably some dependency missing).

Can you help me please to build this...

Thanks

User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

Re: [HOW TO] Compile a package from source

Post#5 by freestyler » 09 May 2014, 09:08

I'll check it out. what error do you get when you run it from terminal?

Edit: Just had a look, it uses qmake-qt4 to build it and requires the following packages:

Code: Select all

g++, qt4-qmake, libqt4-dev, qtmobility-dev, libssl-dev, libglu1-mesa-dev, libqt4-opengl-dev
once you have those extract the source, enter the folder and execute from terminal:

Code: Select all

qmake-qt4 QtBitcoinTrader_Desktop.pro
make
su
make install DESTDIR=/tmp/QtBitcoinTrader
then convert /tmp/QtBitcoinTrader to xzm

I can knock up a module tomorrow if you're having problems but the alt package should work if you have the required deps.
https://www.porteus-apps.org

3n1gm4
White ninja
White ninja
Posts: 4
Joined: 09 May 2014, 06:47
Distribution: Porteus 3.0 x86_64 KDE_Desktop
Location: Croatia, Dalmatia

Re: [HOW TO] Compile a package from source

Post#6 by 3n1gm4 » 09 May 2014, 10:06

...thanks for quick reply
1.
freestyler wrote:I'll check it out. what error do you get when you run it from terminal?
when I start "QtBitcoinTrader" from terminal this message appear "QtBitcoinTrader: error while loading shared libraries: libcrypto.so.10: cannot open shared object file: No such file or directory" if that means some other deps are required

2.
freestyler wrote:Edit: Just had a look, it uses qmake-qt4 to build it and requires the following packages:

Code: Select all

g++, qt4-qmake, libqt4-dev, qtmobility-dev, libssl-dev, libglu1-mesa-dev, libqt4-opengl-dev
once you have those extract the source, enter the folder and execute from terminal:

Code: Select all

qmake-qt4 QtBitcoinTrader_Desktop.pro
make
su
make install DESTDIR=/tmp/QtBitcoinTrader
then convert /tmp/QtBitcoinTrader to xzm

I can knock up a module tomorrow if you're having problems but the alt package should work if you have the required deps.
2.i was looking for those packages but there are no such through USM and it was difficult (for me) to find those from slackware (or some other) repository...

Can you give me some quick link where to look for...

Thanks

User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

Re: [HOW TO] Compile a package from source

Post#7 by freestyler » 09 May 2014, 10:23

go to pkgs.org and search for libcrypto.so.10
It will bring up all packages containing that file, try to only use slackware packages but if they are not available use the alt pacakge.
I'll find some time tomorrow to build them all as native slackware packages
https://www.porteus-apps.org

3n1gm4
White ninja
White ninja
Posts: 4
Joined: 09 May 2014, 06:47
Distribution: Porteus 3.0 x86_64 KDE_Desktop
Location: Croatia, Dalmatia

Re: [HOW TO] Compile a package from source

Post#8 by 3n1gm4 » 09 May 2014, 10:27

ok, thanks

EDIT: ...developer of QtBitcoinTrader told me this: "libcrypto.so is part of OpenSSL library what is missing on your system. You should install Open SSL 1.0.1g"

EDIT_2: ...I found out throgh USM that openssl-1.0.1e-x86_64-1.txz is installed and there is "libcrypto10-1.0.1g-alt1.x86_64.rpm" under "ALT Linux Sisyphus" at pkgs.org...here-> http://pkgs.org/altlinux-sisyphus/class ... 4.rpm.html

So I downloaded that package, converted pckg from rpm to xzm, rebooted with activated new xzm module and now when I open QtBitcoinTrader from terminal I get this message:"QtBitcoinTrader: relocation error: /lib64/libcrypto.so.10: symbol __libc_enable_secure, version GLIBC_2.2.5 not defined in file ld-linux-x86-64.so.2 with link time reference"

EDIT_3: ...now I downloaded this package -> "glibc-core-2.17-alt8.x86_64.rpm" from here-> http://pkgs.org/altlinux-sisyphus/class ... 4.rpm.html and converted it from rpm to xzm, rebooted with new module activated and now app WORKS :Yahoo!:

Thanks for your help...

P.S. It would be great if you could build it as you said placing it at your site under Office packages and I need to find out how to build it from source and also how to upgrade firefox 24 placed in base folder to some new version like firefox 28 :good:

User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

Re: [HOW TO] Compile a package from source

Post#9 by freestyler » 10 May 2014, 11:19

I remember seeing a module for a newer version of firefox, maybe search the forum. I gotta warn you though, the new firefox sucks balls.
I haven't got around to building the bit coin app yet but its on my list, If your interested in compiling I recommend starting on something a little easier but on the other hand I say go for it, its how you learn.
Good to see you got it working :)
https://www.porteus-apps.org

3n1gm4
White ninja
White ninja
Posts: 4
Joined: 09 May 2014, 06:47
Distribution: Porteus 3.0 x86_64 KDE_Desktop
Location: Croatia, Dalmatia

Re: [HOW TO] Compile a package from source

Post#10 by 3n1gm4 » 12 May 2014, 12:13

freestyler wrote:I gotta warn you though, the new firefox sucks balls.
good to know...thanks :good:

P.S. I'm ninja now :)

amigo
White ninja
White ninja
Posts: 15
Joined: 26 Aug 2013, 14:14
Distribution: KISS
Location: Dreieich

Re: [HOW TO] Compile a package from source

Post#11 by amigo » 29 Jun 2014, 09:11

And what about when DESTDIR is not supported -or worse, only partially supported?

User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

Re: [HOW TO] Compile a package from source

Post#12 by freestyler » 02 Jul 2014, 12:24

You can use the "changes-time" command
https://www.porteus-apps.org

Post Reply