[ 이전 ] [ 차례 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 다음 ]
자유 소프트웨어진영에서는 소스코드를 공부하거나 버그가 있는 코드를 수정하는 것이 일상적인 것이다. 이렇게 하기 위해서는 프로그램의 소스를 우선은 다운로드 받는다. APT 시스템이 소스코드를 디스트리뷰션내에 포함된 많은 프로그램들에 소스코드를 가져오게 해주고 .deb를 만들기 위해서 필요한 모든 파일들을 포함해서 가지고 오게 도와준다.
데비안 소스의 다른 일반적인 사용은 프로그램의 좀더 최근의 버젼을 불안정 디스트리뷰션에서 가져와서 안정 디스트리뷰션에서 사용하게 하는 것이다. 안정에서 패키지를 안정버젼에서 컴파일하면 디스트리뷰션에 있는 패키지에 알맞는 의존성을 가지고 .deb를 만들어준다.
이렇게 하기 위해서는 deb-src 항목을 /etc/apt/sources.list에 넣어서 불안정 버젼의 파일을 받게 해주면 된다. 주석을 없애고 사용하면된다. /etc/apt/sources.list 파일, 3.1 부분을 참조하라.
Aptitude, the Debian Package Manager is mainly targeted at binary packages. To
use source packages we'll need to use apt-get instead. To
download a source package, you would use the following command:
$ apt-get source packagename
이렇게 하면 세가지 파일을 얻게 되는데: .orig.tar.gz, .dsc와 .diff.gz. 데비안만을 위한 패키지의 경우에 마지막 파일은 다운로드 되지 않고 첫번째는 이름에 "orig"이 없게 됩니다.
.dsc 파일은 소스 패키지를 패키지버젼 디렉토리 안에 풀 때 dpkg-source에 의해 이용되는 것이다. 각 다운로드된 소스패키지에는 debian/ 디렉토리가 있는데 .deb 패키지를 만들어주는데 필요한 파일들을 포함하고 있다.
다운로드를 하면서 자동적으로 패키지를 빌드하고자 하면 -b를 다음과 같이 추가하면 된다:
$ apt-get -b source packagename
다운로드 하면서 .deb를 다운로드 하면서 만들고 싶지 않다면 다음과 같이 나중에 실행하면 된다:
$ dpkg-buildpackage -rfakeroot -uc -b
Notice that to build most packages you'll need at least the following packages:
devscripts, dpkg-dev, debhelper,
fakeroot, take a look at 패키지 설치하기, 4.4 and install them
before proceeding. Most packages will also depend on compilation tools, so it
may be useful to install the build-essential package as well.
Other packages may be needed, take a look at 소스패키지를 컴파일 하는데 필요한 패키지들, 5.2 for
more information.
To install the package built by the commands above one must use the package
manager directly. Take a look at Installing manually downloaded or
locally created debian packages, 4.5. A useful tool is provided by the
devscripts package: debi. If you run
debi from inside the source package directory it will look for the
.changes file at the parent directory to discover what are the
binary packages the package produces and will run dpkg to install
all of them. While this is not very useful if your source package produces
conflicting packages, it might be in most circunstances. Of course you need
root powers in order to perform this.
apt-get의 source와 다른 방법의 차이는 있다.
source 방법은 루트 권한 없이도 일반 사용자들이 이용할 수 있다.
파일은 apt-get source package를 실행한 디렉토리에 다운로드 된다.
일반적으로 특정 헤더와 공유 라이브러리는 소스패키지를 컴파일하기 위해서 있어야한다. 모든 .deb 패키지들은 control 파일에 소스에서 빌드하여 추가 패키지를 만들 때 필요한 부분을 지칭하는 'Build-Depends:' 필드를 포함하고 있다.
APT는 이러한 패키지들을 자동으로 다운로드 해주는 단순한 방법을 갖고 있다. 단지 apt-get build-dep package를 실행하면 되는데 여기서 'package'는 여러분이 빌드할 패키지 이름이다. 예를 들면:
# apt-get build-dep gmc
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
comerr-dev e2fslibs-dev gdk-imlib-dev imlib-progs libgnome-dev libgnorba-dev
libgpmg1-dev
0 packages upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
Need to get 1069kB of archives. After unpacking 3514kB will be used.
Do you want to continue [Y/n]
설치될 패키지들은 빌드할 gmc에 필요한 패키지들이다. 이 명령은
컴파일할 프로그램의 소스 패키지를 찾지는 않는다. apt-get source을
실행하여 이를 따로 실행할 수 있다.
단지 어떤 패키지가 빌드할 때 필요한지 알려면 apt-cache show 에서 Build-Depends에 그 패키지 목록을 볼 수 있을 것이다.
# apt-cache showsrc package
If you want to build a package for debuging purposes to, for example, report a bug -- or fix one, you can use simple environment variables that are supported by most Debian packages.
To build a package which contains unstriped binaries[6] all you need to do is prefix it with DEB_BUILD_OPTIONS=nostrip. Optimizations can also make debuging harder, so you can disable them by adding the noopt string to the DEB_BUILD_OPTIONS variable too. Example:
$ dpkg-buildpackage -rfakeroot -uc -b
If what you want is to customize the way the package is built you'll have to go
about editing the debian/rules file. This means: inside the main
directory created when the source package is extracted there will be a
debian directory, which contains many files. One of them is
special: the rules file.
This file is usually a Makefile that has targets to configure, build, install
and create the package. For example, if I want to have the
luola[7] built
without sound I can, after downloading and extracting its source edit the
debian/rules file that looks like this:
[...]
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
./configure $(confflags) \
--prefix=/usr \
--mandir=share/man \
--infodir=share/info \
--datadir=share/games \
--bindir=games \
--enable-sound
# --enable-sdl-gfx
touch configure-stamp
[...]
See the --enable-sound switch If I remove it or replace it with --disable-sound and then rebuild the package using the technique described on 소스 패키지 다운로드 하기, 5.1 I'll have a luola package that is built with no sound.
If you really want to work with source packages on a daily basis I would
suggest reading the Debian New Maintainers
Guide and the Debian Policy,
mainly. Other documentation available from the Debian Developers Corner may be
useful too.
Sometimes, people want to use a specific version of a program available only on source code, with no Debian package. But the packaging system can be a trouble when doing this. Suppose you want to compile a new version of your email server. All is fine, but many packages in Debian depend on an MTA (Mail Transfer Agent). Since you installed something you compiled by yourself, the packaging system doesn't know about it.
이 상황에서 equivs가 나타나는데 이를 이용하기 위해서 이 이름을
가진 패키지를 설치한다. 이 패키지가 하는 일은 의존성을 해결해주는 패키지를
만들고 없애는 기능을 하면서 패키징 시스템이 의존성이 만족하게 믿도록 하는
것이다.
시작하기 전에, 우선 다른 옵션으로 데비안 용으로 패키지된 프로그램을 좀더 안정적인 방법으로 컴파일 하는 방법이 있다는 것을 여러분에게 상기시켜주는 것이 좋다. 그리고 하고자 하는 것을 알고자 하지 않는다면 의존성을 대체하는 equivs 사용을 하지 말아야한다. 자세한 정보는 Building from source, 5를 참조하라.
계속해서 MTA를 가지고 보면 여러분이 postfix을 새롭게 컴파일 해서
설치했는데 mutt를 계속해서 사용하고 싶은 경우 갑자기
mutt가 다른 MTA를 원하게 됨을 알고 있지만 이미 시스템 내에는 있다.
어떤 디렉토리로 (/tmp를 예를 들면) 가서 다음을 실행한다:
# equivs-control name
여기서 여러분이 만들고자 하는 control 파일의 이름으로 name 를 대체하라.
ection: misc
Priority: optional
Standards-Version: 3.0.1
Package: <enter package name; defaults to equivs-dummy>
Version: <enter version here; defaults to 1.0>
Maintainer: <your name and email address; defaults to username>
Pre-Depends: <packages>
Depends: <packages>
Recommends: <packages>
Suggests: <package>
Provides: <(virtual)package>
Architecture: all
Copyright: <copyright file; defaults to GPL2>
Changelog: <changelog file; defaults to a generic changelog>
Readme: <README.Debian file; defaults to a generic one>
Extra-Files: <additional files for the doc directory, comma separated>
Description: <short description; defaults to some wise words>
long description and info
.
second paragraph
우리는 우리가 원하는 것을 변경할 필요가 있다. field의 형태를 잘 보고 기술내용을 확인하라. 여기에 대해서 다 설명하지는 않는다. 이젠 필요한 작업을 해보자:
Section: misc
Priority: optional
Standards-Version: 3.0.1
Package: mta-local
Provides: mail-transport-agent
여기까지 다 했다. mutt는 mail-transport-agent에
의존하는데 이는 모든 MTA에 의해 제공하는 가상 패키지이다. 그래서 여기선
mail-transport-agent라는 이름을 사용할 수 있지만 Provides를
이용하여 가상 패키지 방법을 이용하게 된다.
The Conflicts and Replaces fields are needed, too, so
that APT and dpkg will understand they should remove
the currently installed MTA package in favour of the new one you're installing.
이제는 여기서 패키지를 빌드할 필요가 있다:
# equivs-build name
dh_testdir
touch build-stamp
dh_testdir
dh_testroot
dh_clean -k
# Add here commands to install the package into debian/tmp.
touch install-stamp
dh_testdir
dh_testroot
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb: building package `name' in `../name_1.0_all.deb'.
패키지가 생성되었다. 여기서 주의할 것은 패키지가 현재 디렉토리에 만들어
졌다는 것이다.
그리고 나서 .deb를 설치하면 된다.
우리가 보아온 것은 equivs데 대한 몇가지 사용에 대한 것이었다.
여러분이 대개 설치하는 프로그램에 의존하는 my-favorites 를 만들 수
있다. 자유롭게 생각하되, 조심하길 바란다.
/usr/share/doc/equivs/examples에 있는 control 파일의 예가 있다는
것에 주목하라. 이들을 확인하길 바란다.
[ 이전 ] [ 차례 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 다음 ]
APT HOWTO
2.0.2 - October 2006kov@debian.orgyooseong@debian.org