Saturday, 21 March 2020

Rebuild debian package

You can recompile your favorite package:

First you have to install this package:
apt install build-essential

In this example were going to rebuild midnight commander:

Create file for your custom flags under /etc/dpkg/buildflags.conf:
APPEND CFLAGS -march=native
APPEND CXXFLAGS -march=native
APPEND LDFLAGS -fuse-ld=lld


$ apt source mc
$ apt build-dep mc
$ dpkg-source -x mc-revision.dsc # this is optional, extract source package

$ cd mc-revision
$ debian/rules binary

I had to set up PATH for ldconfig:
$ PATH=/usr/sbin:$PATH dpkg -i mc-revision.deb

or "single" liner (or course you need fakeroot or su):

# apt build-dep mc

$ apt-get --build source mc


Or is a better to use apt-build to fetch and optimize packages for your machine.

 

After you got the packages you can install with dpkg.

$ dpkg -i mc

Or you can create your local repository:


$ sudo mkdir -p /usr/local/mydebs
$ cd /usr/local/mydebs 
$ dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
  Add this one to sources (/etc/apt/sources.list) :
deb[trusted=yes] file:/usr/local/mydebs ./ 
 
sudo apt-get update 
And you your a happy owner of your own super native repositorty.

No comments:

Post a Comment