Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://askubuntu.com/questions/28372/how-do-i-get-and-modify-the-source-code-of-packages-installed-through-apt-get
- Use the command apt-get source <package> (don't use sudo with it) to download the source of a package.
- From man apt-get:
- source
- source causes apt-get to fetch source packages. APT will examine the
- available packages to decide which source package to fetch. It will then
- find and download into the current directory the newest available version of
- that source package while respect the default release, set with the option
- APT::Default-Release, the -t option or per package with the pkg/release
- syntax, if possible.
- Source packages are tracked separately from binary packages via deb-src type
- lines in the sources.list(5) file. This means that you will need to add such
- a line for each repository you want to get sources from. If you don't do
- this you will properly get another (newer, older or none) source version
- than the one you have installed or could install.
- If the --compile option is specified then the package will be compiled to a
- binary .deb using dpkg-buildpackage, if --download-only is specified then
- the source package will not be unpacked.
- A specific source version can be retrieved by postfixing the source name
- with an equals and then the version to fetch, similar to the mechanism used
- for the package files. This enables exact matching of the source package
- name and version, implicitly enabling the APT::Get::Only-Source option.
- Note that source packages are not tracked like binary packages, they exist
- only in the current directory and are similar to downloading source tar
- balls.
- To build a package from source, first install the build dependencies:
- sudo apt-get build-dep <package>
- Then use dpkg-buildpackage to create a .deb file. From APT and Dpkg Quick Reference Sheet:
- dpkg-buildpackage Builds a Debian package from a Debian source tree. You must be in the main directory of the source tree for this to work. Sample usage:
- dpkg-buildpackage -rfakeroot -uc -b
- Where -rfakeroot instructs it to use the fakeroot program to simulate root privileges (for ownership purposes), -uc stands for "Don't cryptographically sign the changelog", and -b stands for "Build the binary package only"
- In a terminal, cd into the directory containing the package source (e.g ~/code/hellanzb-0.13) and run the following command:
- dpkg-buildpackage -rfakeroot -uc -b
- If the build is successful, there will be a .deb file located in the parent
- directory (e.g ~/code/hellanzb_0.13-6.1_all.deb).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement