[ ÀÌÀü ] [ Â÷·Ê ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ ´ÙÀ½ ]


APT HOWTO
5 - Building from source


5.1 ¼Ò½º ÆÐŰÁö ´Ù¿î·Îµå Çϱâ

ÀÚÀ¯ ¼ÒÇÁÆ®¿þ¾îÁø¿µ¿¡¼­´Â ¼Ò½ºÄڵ带 °øºÎÇϰųª ¹ö±×°¡ ÀÖ´Â Äڵ带 ¼öÁ¤ÇÏ´Â °ÍÀÌ ÀÏ»óÀûÀÎ °ÍÀÌ´Ù. ÀÌ·¸°Ô Çϱâ À§Çؼ­´Â ÇÁ·Î±×·¥ÀÇ ¼Ò½º¸¦ ¿ì¼±Àº ´Ù¿î·Îµå ¹Þ´Â´Ù. 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¸¦ ½ÇÇàÇÑ µð·ºÅ丮¿¡ ´Ù¿î·Îµå µÈ´Ù.


5.2 ¼Ò½ºÆÐŰÁö¸¦ ÄÄÆÄÀÏ Çϴµ¥ ÇÊ¿äÇÑ ÆÐŰÁöµé

ÀϹÝÀûÀ¸·Î ƯÁ¤ Çì´õ¿Í °øÀ¯ ¶óÀ̺귯¸®´Â ¼Ò½ºÆÐŰÁö¸¦ ÄÄÆÄÀÏÇϱâ À§Çؼ­ ÀÖ¾î¾ßÇÑ´Ù. ¸ðµç .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

5.3 ÆÐŰÁö °ü¸®Çϱâ

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

5.4 Customizing package build options

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.


5.5 But hey, I do not want to use the Debian stuff!

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 2006

Gustavo Noronha Silva kov@debian.org
Çѱ¹¾î ¹ø¿ª: ¾çÀ¯¼º yooseong@debian.org