[HOW TO] Compile a package from source
Posted: 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:
once that is done execute:
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:
and type your password, then:
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)
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
3.enter the directory
4.start cmake
5. Now its just the same as the last example make the source, install it and convert to module
then get root access:
enter password and:
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)
now run the slackbuild script as root:
enter password and then
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!
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
Code: Select all
make
Code: Select all
su
Code: Select all
make install DESTDIR=/tmp/xfce-theme-manager-0.3.4
Code: Select all
makepkg ../xfce-theme-manager-0.3.4.tgz
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
Code: Select all
cd build
Code: Select all
cmake ..
Code: Select all
make
Code: Select all
su
Code: Select all
make install DESTDIR=/tmp/package-name
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
Code: Select all
su
Code: Select all
./ffmpeg.SlackBuild
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!