Prepare build environment
deb https://apt2.dilos.org/dilos dg3-unstable main contrib non-free deb https://apt2.dilos.org/dilos du3-unstable main contrib non-free deb https://apt2.dilos.org/dilos dg2-unstable main contrib non-free deb https://apt2.dilos.org/dilos du2-unstable main contrib non-free deb-src https://apt2.dilos.org/dilos du3-unstable main contrib non-free deb-src http://mirrors.kernel.org/debian/ buster-updates main contrib non-free deb-src http://mirrors.kernel.org/debian/ buster-proposed-updates main contrib non-free deb-src http://mirrors.kernel.org/debian/ buster-backports main contrib non-free deb-src http://mirrors.kernel.org/debian/ buster main contrib non-free
To build packages into a new repo (du3) we need to use old build environment based on du2, but new packages should come from the new repo, that is why we placed du3 above du2 in the list.
deb-src lines instruct apt where it should get upstream source packages. In our example it is buster (a codebase of debian).
apt-get update
Perhaps you will see key errors due to update stage something like this:
du3p03% sudo apt-get update Hit:2 https://apt2.dilos.org/dilos dg3-unstable InRelease Hit:1 http://mirrors.edge.kernel.org/debian buster-updates InRelease Hit:3 https://apt2.dilos.org/dilos du3-unstable InRelease Hit:4 https://apt2.dilos.org/dilos dg2-unstable InRelease Hit:5 https://apt2.dilos.org/dilos du2-unstable InRelease Hit:6 http://mirrors.edge.kernel.org/debian buster-proposed-updates InRelease Hit:7 http://mirrors.edge.kernel.org/debian buster-backports InRelease Hit:8 http://mirrors.edge.kernel.org/debian buster InRelease Err:1 http://mirrors.edge.kernel.org/debian buster-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 Err:6 http://mirrors.edge.kernel.org/debian buster-proposed-updates InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 Err:7 http://mirrors.edge.kernel.org/debian buster-backports InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 Err:8 http://mirrors.edge.kernel.org/debian buster InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY EF0F382A1A7B6500 NO_PUBKEY DCC9EFBF77E11517 Reading package lists... Done W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://mirrors.edge.kernel.org/debian buster-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://mirrors.edge.kernel.org/debian buster-proposed-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://mirrors.edge.kernel.org/debian buster-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://mirrors.edge.kernel.org/debian buster InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY EF0F382A1A7B6500 NO_PUBKEY DCC9EFBF77E11517 W: Failed to fetch http://mirrors.kernel.org/debian/dists/buster-updates/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 W: Failed to fetch http://mirrors.kernel.org/debian/dists/buster-proposed-updates/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 W: Failed to fetch http://mirrors.kernel.org/debian/dists/buster-backports/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 W: Failed to fetch http://mirrors.kernel.org/debian/dists/buster/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY EF0F382A1A7B6500 NO_PUBKEY DCC9EFBF77E11517 W: Some index files failed to download. They have been ignored, or old ones used instead.
This means you shoud add these public keys to the system. Do it as:
du3p03% sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 EF0F382A1A7B6500 DCC9EFBF77E11517 Executing: /tmp/apt-key-gpghome.0nsKnHHLVF/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 EF0F382A1A7B6500 DCC9EFBF77E11517 gpg: key DCC9EFBF77E11517: public key "Debian Stable Release Key (10/buster) <debian-release@lists.debian.org>" imported gpg: key EF0F382A1A7B6500: public key "Debian Stable Release Key (9/stretch) <debian-release@lists.debian.org>" imported gpg: key DC30D7C23CBBABEE: public key "Debian Archive Automatic Signing Key (10/buster) <ftpmaster@debian.org>" imported gpg: Total number processed: 3 gpg: imported: 3
Ok, now these keys have been imported, let's update it once again:
du3p03% sudo apt-get update Hit:1 https://apt2.dilos.org/dilos dg3-unstable InRelease Hit:2 https://apt2.dilos.org/dilos du3-unstable InRelease Hit:4 https://apt2.dilos.org/dilos dg2-unstable InRelease Hit:5 https://apt2.dilos.org/dilos du2-unstable InRelease Hit:3 http://mirrors.edge.kernel.org/debian buster-updates InRelease Hit:6 http://mirrors.edge.kernel.org/debian buster-proposed-updates InRelease Hit:7 http://mirrors.edge.kernel.org/debian buster-backports InRelease Hit:8 http://mirrors.edge.kernel.org/debian buster InRelease Reading package lists... Done du3p03%
Install build packages:
du3p03% apt-get install gmake build-essential
If you want to build some package from an existing repo you need to install git to clone the repo:
du3p01% sudo apt-get install git
Now clone a repo (du3), at this stage you have created an account at bitbucket and ask to provide you access by info: http://www.dilos.org/conact-me
du3p03% git clone https://bitbucket.org/dilos/du3.git
cd du3/components
cd <du3>/components/p0f gmake JOBS=4 deb (JOBS is the number of parallel build processes you want to use)
After the building process is done, you find the built package(s) in <du3>/components/${component}/build directory
How to port a new package
Choose a package you want to port. For example, apache2. Go to the debian packages page at https://packages.debian.org/buster-backports/apache2 and copy the correct name of the source package in the right column ("Download Source Package apache2:"). Remember (or copy) "apache2". Install additional packages to manipulate the source code:
du3p03% sudo apt-get install dpkg-dev Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: binutils libdpkg-perl make patch Suggested packages: binutils-doc debian-keyring gcc | c-compiler bzr make-doc ed diffutils-doc Recommended packages: build-essential gcc | c-compiler fakeroot libalgorithm-merge-perl libfile-fcntllock-perl liblocale-gettext-perl The following NEW packages will be installed: binutils dpkg-dev libdpkg-perl make patch 0 upgraded, 5 newly installed, 0 to remove and 7 not upgraded. Need to get 6277 kB of archives. After this operation, 46.4 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 https://apt2.dilos.org/dilos du3-unstable/main solaris-i386 binutils solaris-i386 2.31.1-1+dilos3 [4409 kB] Get:2 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 libdpkg-perl all 1.19.7+dilos5 [706 kB] Get:3 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 patch solaris-i386 2.7.6-3+dilos1 [137 kB] Get:4 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 make solaris-i386 4.1-9.1-2+dilos2 [316 kB] Get:5 https://apt2.dilos.org/dilos du2-unstable/main solaris-i386 dpkg-dev all 1.19.7+dilos5 [708 kB] Fetched 6277 kB in 8s (740 kB/s) Selecting previously unselected package binutils. (Reading database ... 15551 files and directories currently installed.) Preparing to unpack .../binutils_2.31.1-1+dilos3_solaris-i386.deb ... Unpacking binutils (2.31.1-1+dilos3) ... Selecting previously unselected package libdpkg-perl. Preparing to unpack .../libdpkg-perl_1.19.7+dilos5_all.deb ... Unpacking libdpkg-perl (1.19.7+dilos5) ... Selecting previously unselected package patch. Preparing to unpack .../patch_2.7.6-3+dilos1_solaris-i386.deb ... Unpacking patch (2.7.6-3+dilos1) ... Selecting previously unselected package make. Preparing to unpack .../make_4.1-9.1-2+dilos2_solaris-i386.deb ... Unpacking make (4.1-9.1-2+dilos2) ... Selecting previously unselected package dpkg-dev. Preparing to unpack .../dpkg-dev_1.19.7+dilos5_all.deb ... Unpacking dpkg-dev (1.19.7+dilos5) ... Setting up binutils (2.31.1-1+dilos3) ... Setting up make (4.1-9.1-2+dilos2) ... Setting up patch (2.7.6-3+dilos1) ... Setting up libdpkg-perl (1.19.7+dilos5) ... Setting up dpkg-dev (1.19.7+dilos5) ... Processing triggers for install-info (6.5.0.dfsg.1-1+dilos1) ... du3p03%
Now download the source code into your build environment:
du3p03% apt-get source apache2 Reading package lists... Done NOTICE: 'apache2' packaging is maintained in the 'Git' version control system at: https://salsa.debian.org/apache-team/apache2.git Please use: git clone https://salsa.debian.org/apache-team/apache2.git to retrieve the latest (possibly unreleased) updates to the package. Need to get 10.4 MB of source archives. Get:1 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (dsc) [3530 B] Get:2 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (tar) [9348 kB] Get:3 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (asc) [488 B] Get:4 http://mirrors.edge.kernel.org/debian buster-backports/main apache2 2.4.43-1~bpo10+1 (diff) [1015 kB] Fetched 10.4 MB in 6s (1660 kB/s) dpkg-source: info: extracting apache2 in apache2-2.4.43 dpkg-source: info: unpacking apache2_2.4.43.orig.tar.gz dpkg-source: info: unpacking apache2_2.4.43-1~bpo10+1.debian.tar.xz dpkg-source: info: using patch list from debian/patches/series dpkg-source: info: applying fhs_compliance.patch dpkg-source: info: applying no_LD_LIBRARY_PATH.patch dpkg-source: info: applying suexec-CVE-2007-1742.patch dpkg-source: info: applying customize_apxs.patch dpkg-source: info: applying build_suexec-custom.patch dpkg-source: info: applying reproducible_builds.diff dpkg-source: info: applying buffer-http-request-bodies-for-tlsv13.diff dpkg-source: info: applying tlsv13-add-logno.diff du3p01%
Now we can port the package. First of all you should install (possible) all dependencies to build the package. At this stage the build system does now know anything about dependencies, install them manually:
du3p01% cd apache2-2.4.43 du3p01% dpkg-checkbuilddeps dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 10) bison jdupes libapr1-dev (>= 1.6.0) libaprutil1-dev (>= 1.6.0) libbrotli-dev liblua5.2-dev libnghttp2-dev libpcre3-dev libssl-dev (>= 1.1.1) libxml2-dev lsb-release zlib1g-dev libcurl4-openssl-dev | libcurl4-dev libjansson-dev
Now you can try to install them:
du3p01% sudo apt-get install debhelper bison jdupes libapr1-dev libaprutil1-dev libbrotli-dev liblua5.2-dev libnghttp2-dev libpcre3-dev libssl-dev libxml2-dev lsb-release zlib1g-dev libcurl4-openssl-dev libjansson-dev sudo: unable to resolve host du3p01: node name or service name not known Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package jdupes
As you see we have no package jdupes and we should port it first to build apache2, repeat the steps to download all dependecy packages until you have done.
du3p03% apt-get source jdupes Reading package lists... Done NOTICE: 'jdupes' packaging is maintained in the 'Git' version control system at: https://salsa.debian.org/debian/jdupes.git Please use: git clone https://salsa.debian.org/debian/jdupes.git to retrieve the latest (possibly unreleased) updates to the package. Need to get 124 kB of source archives. Get:1 http://mirrors.edge.kernel.org/debian buster-backports/main jdupes 1.18.1-1~bpo10+1 (dsc) [1878 B] Get:2 http://mirrors.edge.kernel.org/debian buster-backports/main jdupes 1.18.1-1~bpo10+1 (tar) [109 kB] Get:3 http://mirrors.edge.kernel.org/debian buster-backports/main jdupes 1.18.1-1~bpo10+1 (diff) [13.0 kB] Fetched 124 kB in 1s (80.2 kB/s) dpkg-source: info: extracting jdupes in jdupes-1.18.1 dpkg-source: info: unpacking jdupes_1.18.1.orig.tar.gz dpkg-source: info: unpacking jdupes_1.18.1-1~bpo10+1.debian.tar.xz du3p03%
du3p03% cd jdupes-1.18.1 du3p03% dpkg-checkbuilddeps dpkg-checkbuilddeps: warning: cannot determine CC system type, falling back to default (native compilation) dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper-compat (= 13)
create package directory and copy Makefile from another package
update Makefile with build flags (CONFIGURE_OPTIONS)
gmake JOBS=4 install
Create directory 'debs' with structure of files for DEB package build by dpkg-buildpackage.
For example take a look another components
gmake JOBS=4 deb
if you want build packages in your component root directory you can add flag WS_DEBS:
gmake JOBS=4 WS_DEBS=`pwd` deb
as result you can find package at your component directory and be able to install it by 'dpkg -i <your package.deb>'
For more information about environment variables or build flags you can take a look <du2>/make-rules/deb_src.mk