[Discussion] How can I download and compile the Debian source code?

User discussion about Debian Development, Debian Project News and Announcements. Not for support questions.
Post Reply
Message
Author
Akcaoren
Posts: 3
Joined: 2025-01-28 14:37

[Discussion] How can I download and compile the Debian source code?

#1 Post by Akcaoren »

As I said, I want to download, edit and compile the Debian source code. But how can I do it? I know how to use terminal. :?

fx919
Posts: 15
Joined: 2024-04-12 18:43

Re: [Discussion] How can I download and compile the Debian source code?

#2 Post by fx919 »

Hi Akcaoren,

you can add some Source Repositories to your sources.list and download source package with:

Code: Select all

apt-get source $PACKAGE_NAME
Then you may modify the source and rebuild new packages.

See here for more details on rebuilding the debian packages:

https://www.debian.org/doc/manuals/main ... ld.en.html

Regards,
fx
Last edited by fx919 on 2025-01-28 16:39, edited 1 time in total.

arzgi
Posts: 1801
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 104 times

Re: [Discussion] How can I download and compile the Debian source code?

#3 Post by arzgi »

Hello and welcome!

Edit your /etc/apt/sources.list, and add deb-src to front of, like in the example below, where I have disabled the source line.

Code: Select all

deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
# deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
Then run sudo apt update.

After that you can download source for any packages

Code: Select all

sudo apt-get source  [package name]
Compiling is an other issue, as Debian package source are c, python, perl, etc. c-sources can be compiled with g++. python is interpreted, so no compiltaion is needed.

Akcaoren
Posts: 3
Joined: 2025-01-28 14:37

Re: [Discussion] How can I download and compile the Debian source code?

#4 Post by Akcaoren »

Is it for "apt-get source"?

arzgi
Posts: 1801
Joined: 2008-02-21 17:03
Location: Finland
Has thanked: 1 time
Been thanked: 104 times

Re: [Discussion] How can I download and compile the Debian source code?

#5 Post by arzgi »

Yes, apt-get can not predict are you installing binary or soure, so you must mention source if you want it.


Post Reply