Package Building
From EnGardeWiki
Contents |
Introduction
Although EnGarde Secure Linux does not include a development environment "out of the box," all of the tools to set one up are available via the Guardian Digital Secure Network. The purpose of this document is to provide you, the software developer, with the instructions to set up a package building environment of your own.
Setting Up Your Environment
What you'll need:
- A machine to do your development on. It's not recommended to do this on a production machine. This machine should be somewhat powerful, or you should have a lot of patience.
- Hints on how to build RPM's. There are a lot of HOWTO's out there.
Once you have all of the above you may log in as root, transition over to sysadm_r, and disable SELinux:
[root@engarde ~]# newrole -r sysadm_r Authenticating root. Password: [root@engarde ~]# setenforce 0
Next you must install the following packages:
[root@engarde ~]# apt-get update Get:1 gdsn://updates.guardiandigital.com rapier release Fetched 478B in 0s (1794B/s) Get:1 gdsn://updates.guardiandigital.com rapier/core pkglist Get:2 gdsn://updates.guardiandigital.com rapier/core release Fetched 149kB in 0s (176kB/s) Reading Package Lists... Done Building Dependency Tree... Done [root@engarde ~]# apt-get install rpm-build rpm-devel autoconf automake gcc gcc-c++ make patch binutils glibc-devel kernel-headers libstdc++-devel Reading Package Lists... Done Building Dependency Tree... Done The following NEW packages will be installed: autoconf automake binutils gcc gcc-c++ glibc-devel kernel-headers libstdc++-devel make patch rpm-build rpm-devel 0 upgraded, 12 newly installed, 0 removed and 6 not upgraded. Need to get 48.3MB of archives. After unpacking 154MB of additional disk space will be used. ... Committing changes... Preparing... ########################################### [100%] 1:binutils ########################################### [ 8%] ... 12:rpm-build ########################################### [100%] Done.
At this point you have most of the core development package installed. As you build packages which link against other packages, you'll most definitely have to install other -devel packages. You may install the packages via WebTool or the command-line using apt-get.
Installing and Building Source Packages
All of the sources packages for EnGarde Secure Linux are available via the GDSN. To get them, you simply need to add a line to /etc/apt/sources.list and apt-get source them. Begin by including the GDSN rpm-src URI in your sources.list:
[root@engarde ~]# echo "rpm-src gdsn://updates.guardiandigital.com/GDSNROOT rapier core" >> /etc/apt/sources.list
Then run apt-get update:
[root@engarde ~]# apt-get update Get:1 gdsn://updates.guardiandigital.com rapier release Fetched 478B in 0s (1755B/s) Get:1 gdsn://updates.guardiandigital.com rapier/core pkglist Get:2 gdsn://updates.guardiandigital.com rapier/core release Get:3 gdsn://updates.guardiandigital.com rapier/core srclist Fetched 210kB in 1s (155kB/s) Reading Package Lists... Done Building Dependency Tree... Done
At this point you may use apt-get to install the source to any package. As an example, let's use diffstat:
[root@engarde ~]# apt-get source diffstat Reading Package Lists... Done Building Dependency Tree... Done Need to get 1219kB of source archives. Get:1 gdsn://updates.guardiandigital.com rapier/core diffstat 1.41-2 (srpm) [102kB] Fetched 102kB in 0s (223kB/s) 1:diffstat ########################################### [100%]
At this point the package sources are installed in /usr/src/engarde/SOURCES, and the spec file is in /usr/src/engarde/SPECS:
[root@engarde engarde]# ls -l SOURCES/ SPECS/ SOURCES/: -rw-r--r-- 1 root root 98321 Aug 25 2005 diffstat-1.41.tgz SPECS/: -rw-r--r-- 1 root root 1163 Aug 25 2005 diffstat.spec
To build the package, use rpmbuild:
[root@engarde SPECS]# rpmbuild -ba diffstat.spec Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.69447 + umask 022 + cd /usr/src/engarde/BUILD + cd /usr/src/engarde/BUILD + rm -rf diffstat-1.41 + /usr/bin/gzip -dc /usr/src/engarde/SOURCES/diffstat-1.41.tgz ... Wrote: /usr/src/engarde/SRPMS/diffstat-1.41-2.src.rpm Wrote: /usr/src/engarde/RPMS/i686/diffstat-1.41-2.i686.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.42532 ...
Voila! You just built your first package. This is where this document stops but we encourage you to get familiar building packages. We're always looking for user contributions, and SRPMS are a great place to start :).
References
- Packaging software with RPM, Parts 1-3
- Maximum RPM
Categories: Documentation | EnGarde | GDSN | HOWTO | Tips
