Probably required: packaging-dev , ubuntu-dev-tools
Pbuilder setup
(this allows you to create a package in chroot without polluting your system with build packages)
sudo pbuilder create
if you want to create for a specific distribution (pbuilder uses the build system release in chroot), you can use pbuilder-dist [exact / oneric / trusy / etc ...] create
Get debian source
pull-debian-source gcc-4.9 [4.9.0-6]
a specific version of debian is optional, but may be useful if you want to pull out experimental / unstable / test / stable versions you can also pull from specific ubuntu distributions by adding them to sources.list as deb-src and using sudo apt-get src
Package assembly
sudo pbuilder build gcc-4.9_4.9.0-6.dsc
In the downloaded files there is a .dsc file, for the most recent gcc it is gcc-4.9_4.9.0-6.dsc, which is the package descriptor file ..orig.tar. [gz / xz] is the original tarball.
Create a local Apt repository
mkdir /convenient/place/for/repo cp /var/cache/pbuilder/result/* /path/to/repo cd /path/to/repo apt-ftp archive packages . > Packages sudo echo "deb [trusted=yes] file:/local/repo/Packages ./" > /etc/apt/sources.list.d/gcc-repo.list`
Please note that you can also do this step with .debs downloaded from anywhere (skip step 1-3)
Installation
apt-get update; apt-get install gcc-4.9 g++-4.9
user4032676
source share