\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{RPM HOWTO (RPM at Idle)}
\author{§@ªÌ: Donnie Barnes, {\ttfamily djb@redhat.com}\\ 
        Ä¶ªÌ: ­J±R°¶ {\ttfamily marr@cc.nccu.edu.tw}}
\date{v2.0, 8 April 1997}
\abstract{¦p¦ó¨Ï¥Î Red Hat ¥]¸ËºÞ²zµ{¦¡¡C}


\begin{document}
\maketitle
\tableofcontents

\section{Introduction}

RPM «üªº¬O {\bfseries R}ed Hat {\bfseries P}ackage {\bfseries M}anager ¤§ÁY¼g¡A
ÁöµM¦WºÙ¤W¥]§tµÛ Red Hat ªº¦r¸¹¡A ¦ý¨ä­ì©l³]­p²z©À¬O±Ä¶}¦¬¦¡ªº¡A
¥Î·N¦b©óÅý³o­Óµ{¦¡¯à´£¨Ñµ¹©Ò¦³¤H¨Ï¥Î¡C ³z¹L rpm ªººÞ²z¡A
¨Ï¥ÎªÌ¥i¥H±N¬Y­Ó·s³nÅéªº source code¡A ­«·s¾ã²z¥]¸Ë¦¨¥t¤@ºØ source
»P binary ªºÀÉ®×«¬¦¡¡A ¦p¦¹¤@¨Ó¡A §Ú­Ì¥i¥H»´ÃP¦a¥Ñ binary
«¬¦¡ªºÀÉ®×¡A ¶i¦æ¦w¸Ë»P®M¥ó°lÂÜºÞ²zªº¤u§@¡A ¦Ó source «¬¦¡ªºÀÉ®×¡A
¤]«Ü¤è«K¦a¯à°÷¦A³Q­«·s¾ã²z¥]¸Ë¡C ¦P®É¡A rpm ºÞ²zµÛ¤@¥÷¸ê®Æ®w¡A
¸ÌÀY¥]§t¤F©Ò¦³ªºµ{¦¡®M¥óªºÀÉ®×¸ê®Æ¡A ³z¹L³o¥÷¸ê®Æ®w¡A
§Ú­Ì¥i¥H¶i¦æµ{¦¡®M¥ó¤§½T»{»P¬d¸ß¤u§@¡C

Red Hat ¤½¥q¹ªÀy¨ä¥L¨ó¤O¼t°Ó¡A ¤@¦Pµo®i¤Î¨Ï¥Î RPM ©ó¥¦­Ìªº distribution ·í¤¤¡C
RPM ¬Û·í¨ã¦³¼u©Ê¡A ¨ä¾Þ§@«D±`Â²³æ¡A ´£¨Ñ¨t²ÎÂX¥Rµo®iªº°òÂ¦¡A
¥t¤@¤è­±¡A ¥¦ªºµo®i§¹¥þ¤½¶}¡A ¦Ó¥B¥i§K¶O¨ú±o¡A
¨Ï¥ÎªÌ¥i¥H¦^ÂÐ¥ô¦óµ{¦¡½X¤Wªº¿ù»~»P­×¥¿¤º®e¡C
¥u­n¦b²Å¦X GPL ªº«Å§i±ø¥ó¤U¡A ¤j®a¥i¥H¦Û¥Ñ¦a¨Ï¥Î¤Î¶Ç¼½ RPM µ{¦¡¡C

¦pªG±z·QÀò±o¦³Ãö RPM §ó¸Ô²Óªº¤å¥ó»¡©ú¡A ¥i¥H°Ñ¦Ò
Ed Bailey ©Ò¼¶¤§ {\itshape Maximum RPM\/} ¤@®Ñ¡C ³o¥»®Ñ¥i¥Ñ
\nameurl{http://www.redhat.com}{www.redhat.com}
¤U¸ü©ÎÁÊ¶R¨ì¡C




\section{Overview}

­º¥ý¡A Åý§Ú­Ì¥ý¨Ó¤F¸Ñ RPM ­I«áªº³]­p­õ¾Ç¡A ¨ä³]­pªº¥Øªº¤§¤@¡A
«K¬O¤¹³\¨Ï¥ÎªÌ¯à°÷¨Ï¥Î¡u¯Â²b¡vªº source ÀÉ®×¡C Ãö©ó¦¹ÂI¡A
§Ú­Ì¥²¶·¦^·¹¦Ü RPP µ{¦¡¡A ( ³o¬O¤@­Ó¦­´Á©Ò¨Ï¥Îªºµ{¦¡®M¥óºÞ²z¨t²Î¡A
¤£¹L¡A «á¨Ó RPM {\itshape ­Ë¨S¦³\/}¥Ñ¨ä­l¥Í )¡A ¥¦©Ò±Ä¥Îªº source ÀÉ®×¡A
³£¬O¸g¹LÃB¥~ªº¡u¯}¸Ñ³B²z¡v¡C ²z½×¤W¡A ¨Ï¥ÎªÌ¥i¥H¶¶ºZµL»~¦a¡A
±q¤@¥÷ RPP ­ì©lÀÉ¡A §¹¦¨ install »P {\ttfamily make} ªº°Ê§@¡C
¦ý¬O³o¼Ë³B²z¹Lªº source ÀÉ®×¡A ¤w¬O­±»ª¥þ«D¡A ¨Ï¥ÎªÌ¥i¯àµL±q±oª¾¡A
ÀÉ®×¸Ì¨ì©³­þ¨Ç¦a¤è³Q§ó§ï¹L¡A ³q±`¥²¶·ÃB¥~¨ú¦^¥¼¸g³B²z¹Lªº source ÀÉ®×¡C
¦Ó RPM ªº°µªk¡A «K¬OÅý¨Ï¥ÎªÌ¨ú±o¡u¥¼¸g³B²z¹Lªº source ÀÉ®×¡v¡A
¦P®É¦Aªþ¤W¤@¥÷¡upatch ÀÉ®×¡v¡A ¥iÂÇ¤§§¹¦¨µ{¦¡½sÄ¶ªº¤u§@¡C
§Ú­Ì«Ü®e©öµo²{¡A ³o¼Ëªº°µªk±a¨Ó¤£¤Ö¦n³B¡C «ç»ò»¡©O¡S
Á|­Óª¬ªp¬°¨Ò¡A ¦b Red Hat Linux ¤U¡A ¦pªG¬Y­Ó·sª©ªºµ{¦¡°Ý¥@¤F¡A
±z¥i¯à¨S¦³¥²­n¦A­«ÀY¶}©l°µ compile °Ê§@¡A ¥ýÆ[¹î¡upatch ÀÉ®×¡vªº¤º®e¡A
¬Ý¬Ý¬O§_¦³­þ¨Ç³¡¥÷¤~¬O±z{\itshape »Ý­n\/}°µªº¡C ¦p¦¹¤@¨Ó¡A
©Ò¦³¤º§tªºµ{¦¡¹w³]­È«K«Ü®e©ö¬Ý¥X¨Ó¡C

¥t¤@¤è­±¡A RPM ¤]¨ã¦³±j¤jªº¬d¸ß¥\¯à¡A ±z¥i¥H°w¹ï¾ã­Óµ{¦¡®M¥óªº¸ê®Æ®w¡A
©Î¬O¬Y¨Ç¯S©wªºÀÉ®×¡A ¶i¦æ¬d¸ßªº°Ê§@¡A ¤]¥i¥H»´ÃP¦a¬d¥X¡A
¬Y­ÓÀÉ®×¬OÄÝ©ó­þ­Óµ{¦¡®M¥ó¡A ©Î¬O¥¦¥´±q­þ¸Ì¨Óªº¡C
RPM ÀÉ®×¥»¨­¬O¸g¹LÀ£ÁYªº¡A ¦ý±zÁÙ¬O¥i¥H«Ü®e©ö¦Ó{\itshape §Ö³t\/}¦a¡A
¬d¸ß¨C­Óµ{¦¡®M¥óªº¤º®e¡A ¦]¬°¦bµ{¦¡®M¥ó¸Ì¡A ¤w¸g¥[¤J¤@¬q¯S®íªº
binary header¡A ¥¦°O¿ý¤F¥þ³¡¬d¸ß®É©Ò»Ýªº¤º®e¡A ³o¼Ëªº°µªk¡A
¨Ï±o¬d¸ß¥\¯àÅÜ±o{\itshape ¬Û·í§Ö³t\/}¡C

¥t¤@¶µ±j¤jªº¥\¯à¡A «K¬Oµ{¦¡®M¥óªº§¹¾ã½T»{¡C
¦pªG±z¾á¤ß»~¬å¬Y­ÓÀÉ®×¡A ¦Ó¥¦¥¿¬O¬Y­Óµ{¦¡®M¥óªº­«­n³¡¥÷¡A
¨º»ò°µ­Ó¡u½T»{°Ê§@¡v´N¦æ¤F¡C ¦p¦³¥ô¦ó¤£¥¿±`ªº¦a¤è¡A «K·|³qª¾±z¡A
³o®É­Ô¡A ±z¥i¥Hµø±¡ªp­«·s¦w¸Ë¸Óµ{¦¡®M¥ó¡A ¦Ó¥B©Ò¦³¤§«eªº³]©wÀÉ¡A
³£·|§¹¦n¦a³Q«O¦s¤U¨Ó¡C

§Ú­Ì«D±`·PÁÂ¨Ó¦Û BOGUS distribution ªº°ª¤â­Ì¡A ¥L­Ì´£¨Ñ¤F³\¦h·N¨£ºc·Q¡A
«á¨Ó¤]³£³Q±Ä¥Î©ó RPM ·í¤¤¡C ÁöµM RPM §¹¥þ¬O¥Ñ Red Hat Software ©Ò¼¶¼g¡A
¦ý¨ä¾Þ§@¼Ò¦¡¬O®Ú¾Ú BOGUS (PM »P PMS) ©Ò¼gªºµ{¦¡½X¡C




\section{General Information}




\subsection{Acquiring RPM}

³Ì¦n¥B³ÌÂ²³æªº¤èªk¡A ·íµM´N¬O¦w¸Ë Red Hat Linux Åo¡A
¦pªG±z©è¦º¤£±q¡A ¨º»ò¨ÌµM¥i¥H±q FTP ¯¸¡A §ì¨ú­ì©lµ{¦¡¦^¨Ó¦w¸Ë¡C
µ{¦¡ÀÉ®×ªº¦ì¸m¬O
\nameurl{ftp://ftp.redhat.com/pub/redhat/code/rpm}{ftp.redhat.com}¡C




\subsection{RPM Requirements}

¶¶§Q°õ¦æ RPM ªº³Ì¤j±ø¥ó¡A ´N¬O¡u­n¦³ 2.4.2 ª©¥H¤Wªº cpio µ{¦¡¡v¡C
RPM ¥D­n¬O³]­pµ¹ Linux ¨Ï¥Îªº¡A ¦ý¹ï©ó¨ä¥L Unix ¨t²Îªº¬Û®e©Ê¤]¬Û·í¤£¿ù¡A
¨Æ¹ê¤W¡A ¥¦¤w¸g¶¶§Q¦b SunOS¡B Solaris¡B AIX¡B Irix¡B AmigaOS
¤Î¨ä¥L¨t²Î¤W§¹¦¨ compile °Ê§@¡C ­È±oª`·Nªº¬O¡A ¥Ñ¤£¦P Unix
§@·~¥­¥x©Ò½sÄ¶¥X¨Óªº binary µ{¦¡®M¥ó¡A ¬O¤£¯à©¼¦¹¬Û®eªº¡C

¤W­z¥u¬O¦w¸Ë RPM ªº³Ì§C»Ý¨D¡A ¦pªG·Q­n¥Ñ source ÀÉ®×«Ø³y°_¡A
¨º»ò±zÁÙ»Ý­n {\ttfamily gcc}¡A {\ttfamily make} ¤§Ãþªº½sÄ¶¤u¨ãµ{¦¡¡A
³o©M«Ø³y¤@¯ëµ{¦¡®M¥ó¨ÃµL¤G­P¡C




\section{Using RPM}

RPM ¥i¥H¥Î©ó¦w¸Ëµ{¦¡®M¥ó¤W¡A ³ÌÂ²³æªº¾Þ§@®æ¦¡¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
rpm -i foobar-1.0-1.i386.rpm
\end{verbatim}
\end{tscreen}

¥t¤@­ÓÂ²³æªº¾Þ§@½d¨Ò¡A ¬O¥Î©ó¸Ñ°£¬Y¤@­Óµ{¦¡®M¥óªº¦w¸Ë¡G
\begin{tscreen}
\begin{verbatim}
rpm -e foobar
\end{verbatim}
\end{tscreen}


±µ¤U¨Óªº«ü¥O½d¨Ò¸û¬°½ÆÂø¡A ¦ý¥¦{\itshape «D±`\/}¦³¥Î¡A ¥i¥HÅý±z³z¹L FTP
¨Ó¦w¸Ëµ{¦¡®M¥ó¡C ¦pªG±z¯à°÷³s¤Wºô¸ô¡A ·Q¦w¸Ë¬Y­Ó·sªºµ{¦¡®M¥ó®É¡A
©Ò»Ý¤U¹Fªº«ü¥O¡A «K¬O¦bÀÉ®×«e¥[¤W¾A·íªº URL ®æ¦¡¡A ¨Ò¦p¡G
\begin{tscreen}
\begin{verbatim}
rpm -i ftp://ftp.pht.com/pub/linux/redhat/rh-2.0-beta/RPMS/foobar-1.0-1.i386.rpm
\end{verbatim}
\end{tscreen}


½Ð¯S§Oª`·N¡A RPM ¥Ø«e¤w¤¹³\³z¹L FTP ¨Ó¶i¦æ¬d¸ß©Î¦w¸Ë¡C

¤W­z³£¬O¨ÇÂ²³æªº«ü¥O¡A rpm ÁÙ¦³³\¦h¤£¦Pªº¿ï¶µ¤è¦¡¡A
³o¨Ç¥i¥Ñ {\ttfamily Usage} ªº»¡©ú¤¤¬Ý¥X¡G
\begin{tscreen}
\begin{verbatim}
RPM version 2.3.9
Copyright (C) 1997 - Red Hat Software
This may be freely redistributed under the terms of the GNU Public License

usage: rpm {--help}
       rpm {--version}
       rpm {--initdb}   [--dbpath <dir>]
       rpm {--install -i} [-v] [--hash -h] [--percent] [--force] [--test]
                        [--replacepkgs] [--replacefiles] [--root <dir>]
                        [--excludedocs] [--includedocs] [--noscripts]
                        [--rcfile <file>] [--ignorearch] [--dbpath <dir>]
                        [--prefix <dir>] [--ignoreos] [--nodeps]
                        [--ftpproxy <host>] [--ftpport <port>]
                        file1.rpm ... fileN.rpm
       rpm {--upgrade -U} [-v] [--hash -h] [--percent] [--force] [--test]
                        [--oldpackage] [--root <dir>] [--noscripts]
                        [--excludedocs] [--includedocs] [--rcfile <file>]
                        [--ignorearch]  [--dbpath <dir>] [--prefix <dir>] 
                        [--ftpproxy <host>] [--ftpport <port>]
                        [--ignoreos] [--nodeps] file1.rpm ... fileN.rpm
       rpm {--query -q} [-afpg] [-i] [-l] [-s] [-d] [-c] [-v] [-R]
                        [--scripts] [--root <dir>] [--rcfile <file>]
                        [--whatprovides] [--whatrequires] [--requires]
                        [--ftpuseport] [--ftpproxy <host>] [--ftpport <port>]
                        [--provides] [--dump] [--dbpath <dir>] [targets]
       rpm {--verify -V -y} [-afpg] [--root <dir>] [--rcfile <file>]
                        [--dbpath <dir>] [--nodeps] [--nofiles] [--noscripts]
                        [--nomd5] [targets]
       rpm {--setperms} [-afpg] [target]
       rpm {--setugids} [-afpg] [target]
       rpm {--erase -e} [--root <dir>] [--noscripts] [--rcfile <file>]
                        [--dbpath <dir>] [--nodeps] [--allmatches]
                        package1 ... packageN
       rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile  <file>]
                        [--sign] [--test] [--timecheck <s>] specfile
       rpm {--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
       rpm {--recompile} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm
       rpm {--resign} [--rcfile <file>] package1 package2 ... packageN
       rpm {--addsign} [--rcfile <file>] package1 package2 ... packageN
       rpm {--checksig -K} [--nopgp] [--nomd5] [--rcfile <file>]
                           package1 ... packageN
       rpm {--rebuilddb} [--rcfile <file>] [--dbpath <dir>]
       rpm {--querytags}
\end{verbatim}
\end{tscreen}


±z¥i¥H¦b RPM ªº man page ¸Ì¡A §ä¨ì³o¨Ç¿ï¶µªº¸Ô²Ó»¡©ú¡C




\section{Now what can I {\itshape really\/} do with RPM?}

RPM ¬O­Ó«D±`¦³¥Îªº¤u¨ã¡A ¦Ó¥B¦p±z©Òª¾ªº¡A ¥¦¨ã¦³³\¦h¿ï¶µ¥\¯à¡C
Åý±z¤F¸Ñ³o¨Ç¥\¯àªº³Ì¦n¤è¦¡¡A «K¬O¹ê»Ú¤¶²Ð´X­Ó½d¨Ò¡A
«e­±§Ú­Ì¤w¸g´£¹L¦w¸Ë»P¸Ñ°£¦w¸ËªºÂ²³æ¨Ò¤l¡A ©³¤U¬O¤@¨ÇÃB¥~ªº½d¨Ò¡G
\begin{itemize}
\item °²³]»¡¡A ±z¤£¤p¤ß»~§R¤F´X­ÓÀÉ®×¡A ¦ý¤£½T©w¨ì©³¬O­þ¨ÇÀÉ®×¡A
±z·Q¹ï¾ã­Ó¨t²Î¶i¦æ½T»{°Ê§@¡A ¥H¤F¸Ñ­þ¨Ç³¡¥÷¥i¯à¤w¸g¿ò·l¡A ±z¥i¥H³o¼Ë°µ¡G
\begin{tscreen}
\begin{verbatim}
rpm -Va
\end{verbatim}
\end{tscreen}
\item °²³]»¡¡A ±z¸I¨ì¤@­Ó»{¤£¥X¨ÓªºÀÉ®×¡A
·Q­nª¾¹D¥¦¬OÄÝ©ó­þ¤@­Óµ{¦¡®M¥óªº¸Ü¡A ±z¥i¥H³o¼Ë°µ¡G
\begin{tscreen}
\begin{verbatim}
rpm -qf /usr/X11R6/bin/xjewel
\end{verbatim}
\end{tscreen}

¨äµ²ªG·|±o¨ì¡G
\begin{tscreen}
\begin{verbatim}
xjewel-1.6-1
\end{verbatim}
\end{tscreen}
\item ¦pªG±z§ä¨ì¤@­Ó·sªº RPM ÀÉ®×¡A «o¤£²M·¡¥¦ªº¤º®e¡A
·Q­nÀò±o¬ÛÃöªº¸ê°T¡A ¥i¥H³o¼Ë°µ¡G
\begin{tscreen}
\begin{verbatim}
rpm -qpi koules-1.2-2.i386.rpm
\end{verbatim}
\end{tscreen}

¨äµ²ªG·|±o¨ì¡G
\begin{tscreen}
\begin{verbatim}
Name        : koules                      Distribution: Red Hat Linux Colgate
Version     : 1.2                               Vendor: Red Hat Software
Release     : 2                             Build Date: Mon Sep 02 11:59:12 1996
Install date: (none)                        Build Host: porky.redhat.com
Group       : Games                         Source RPM: koules-1.2-2.src.rpm
Size        : 614939
Summary     : SVGAlib action game with multiplayer, network, and sound support
Description :
This arcade-style game is novel in conception and excellent in execution.
No shooting, no blood, no guts, no gore.  The play is simple, but you
still must develop skill to play.  This version uses SVGAlib to
run on a graphics console.
\end{verbatim}
\end{tscreen}
\item ¦pªG±z·Q¤F¸Ñ¬Y­Ó RPM ÀÉ®×¡A ·|¦b¨t²Î¸Ì¦w¸Ë­þ¨ÇÀÉ®×¡A
±z¥i¥H³o¼Ë°µ¡G
\begin{tscreen}
\begin{verbatim}
rpm -qpl koules-1.2-2.i386.rpm
\end{verbatim}
\end{tscreen}

¨äµ²ªG·|¬O¡G
\begin{tscreen}
\begin{verbatim}
/usr/doc/koules
/usr/doc/koules/ANNOUNCE
/usr/doc/koules/BUGS
/usr/doc/koules/COMPILE.OS2
/usr/doc/koules/COPYING
/usr/doc/koules/Card
/usr/doc/koules/ChangeLog
/usr/doc/koules/INSTALLATION
/usr/doc/koules/Icon.xpm
/usr/doc/koules/Icon2.xpm
/usr/doc/koules/Koules.FAQ
/usr/doc/koules/Koules.xpm
/usr/doc/koules/README
/usr/doc/koules/TODO
/usr/games/koules
/usr/games/koules.svga
/usr/games/koules.tcl
/usr/man/man6/koules.svga.6
\end{verbatim}
\end{tscreen}
\end{itemize}


¤W­z¥u¬O¤@¨Ç½d¨Ò¡A ·í±z¹ï RPM ·U¥[¼ô±x®É¡A
À³¸Ó¯à·Q¥X¨ä¥L§ó¦hªº³Ð·N²Õ¦X¡C






\section{Building RPMs}



¦pªG±z¥i¥H¦Û­Ó¨à¨ú±o©Ò»Ýªº³nÅé¡A¨º»ò«Ø³y RPM ÀÉ®×¤]¬O«D±`Â²³æªº¡C

«Ø³y RPM ÀÉ®×ªº°ò¥»¨BÆJ¦p¤U¡G
\begin{itemize}
\item ½T©w±zªº {\ttfamily /etc/rpmrc} ¤w¸g²Å¦X¨t²Î©Ò»Ý¡A §¹¦¨³]©w¡C
\item ¨ú¦^©Ò­n«Ø³yªº source code¡C
\item ¶i¦æ©Ò»Ýªº source ÀÉ®× patch °Ê§@¡A ¥H¨Ï±o§Ú­Ì¯à¶¶§Q¦a
build ¾ã­Óµ{¦¡¡C
\item ¬°µ{¦¡®M¥ó¼¶¼g¤@¥÷ spec ÀÉ®×¡C
\item ½T»{¨C­ÓÀÉ®×³£¦b¥¿½Tªº¥Ø¿ý¦ì¸m¡C
\item ¨Ï¥Î RPM ¨Ó build ¾ã­Óµ{¦¡®M¥ó¡C
\end{itemize}


¦pªG¤@¤Á¾Þ§@¥¿½T¡A RPM «K¯à¶¶§Q build §¹¦¨ binary »P source µ{¦¡®M¥ó¡C








\subsection{The rpmrc File}



¥Ø«e¬°¤î¡A RPM ¨t²Î°ß¤@ªº³]©wÀÉ¡A ¬O³z¹L {\ttfamily /etc/rpmrc} ÀÉ®×¨ÓºÞ²z¡C
¨ä¤º®e½d¨Ò¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
require_vendor: 1
distribution: I roll my own!
require_distribution: 1
topdir: /usr/src/me
vendor: Mickiesoft
packager:  Mickeysoft Packaging Account <packages@mickiesoft.com>

optflags: i386 -O2 -m486 -fno-strength-reduce
optflags: alpha -O2
optflags: sparc -O2

signature: pgp
pgp_name: Mickeysoft Packaging Account
pgp_path: /home/packages/.pgp

tmppath: /usr/tmp
\end{verbatim}
\end{tscreen}


ÀÉ®×¤¤ªº {\ttfamily require\_vendor} ³o¤@¦æ±Ô­z¡A ¥Î¥H±±¨î RPM
¬O§_¶·­n§ä´M vendor ¨º¤@¦æ±Ô­z¡A ¦Ó verdor ªº¸ê°T¥i¯à¨Ó¦Û
{\ttfamily /etc/rpmrc} ©Î¬O spec ÀÉ®×ªº header ³B¡C ¦pªG±z§â¤W­zªº¸¹½X§ï¬°
{\ttfamily 0}¡A «K¯à§â³o¶µ´M§ä¥\¯àÃö³¬¡C ³o¼Ëªº³]©w¤è¦¡¡A
¦P¼Ë¾A¥Î©ó {\ttfamily require\_distribution} »P {\ttfamily require\_group} ªº±Ô­z¤W¡C

±µ¤U¨Ó¡A §Ú­Ì¬Ý¨ì {\ttfamily distribution} ³o¤@¦æ¡A ±z¥i¥H¦b¦¹³]©w¡A ©Î¬O¤é«á¦b
spec ÀÉ®×ªº header ³B³]©w¡C ·í§Ú­Ì¦b¬Y­Ó distribution ¤W build µ{¦¡®M¥ó®É¡A
´Nºâ¤£»Ý­n¬d¸ß³]©w¡A ¦¹¦æ¤º®eªº³]©w¥¿½T¡A ¤]¬O¯à°÷±a¨Ó³\¦h«K§Q¡C
{\ttfamily vendor} ¨º¤@¦æªº§@¥Î¡A ©M¤W­zªº distribution «D±`¬Û¦ü¡A
¦ý¨ä¤º®e¨Ã¤£­­©w ( ¨Ò¦p¬O Joe's Software ©Î Rock Music Emporium )¡C

RPM ¥Ø«e¤ä´©¡u¦h¥­¥x¬[ºc¡vªºµ{¦¡®M¥ó build ¥\¯à¡A §Ú­Ì¥i¥H¦b {\ttfamily rpmrc}
ÀÉ®×¸Ì«ü©w ``optflags'' ÅÜ¼Æ¡A ·í¶i¦æµ{¦¡®M¥ó build °Ê§@®É¡A
«K¥i¨Ì¾Ú©Ò»Ýªº¥­¥xÃþ«¬¡A À³¥Î¯S©wªºÅÜ¼Æ¤º®e¡C §Ú­Ì±N·|¦b±µ¤U¥hªº³¹¸`¸Ì¡A
»¡©ú¦p¦ó¨Ï¥Î³o¨ÇÅÜ¼Æ¡C

°£¤F¤W­zªº macro ³]©w¥~¡A ÁÙ¦³³\¦h¨ä¥Lªº³]©w¤è¦¡¡A ±z¥i¥H¨Ï¥Î¡G
\begin{tscreen}
\begin{verbatim}
rpm --showrc
\end{verbatim}
\end{tscreen}

¨Ó¬d¬Ý¨t²Îªº tag »P¥i¨Ñ¨Ï¥Îªº flag ¦³­þ¨Ç¡C




\subsection{The Spec File}

¦b¦¹§Ú­Ì±N°Q½× spec ÀÉ®×ªº³]©w¡C build ¤@­Óµ{¦¡®M¥ó®É¡A §Ú­Ì»Ý­n¨Ï¥Î¨ì
spec ÀÉ®×¡A ¨ä¤º®e¬°¸Óµ{¦¡®M¥óªº»¡©ú¡A ÃB¥~ÁÙ¥]¬A¤@¨Ç«ü¥O¡A
¥Î¥H«ü¥Ü¾ã­Ó build ªº¹Lµ{¡A ÁÙ¦³¤@¥÷ÀÉ®×¦Cªí¡A ¥Î¥Hªí¥Üµ{¦¡®M¥ó¤¤ªºÀÉ®×¡A
¤À§O³Q¦w¸Ë¨ì­þ¸Ì¡C

spec ÀÉ®×ªº©R¦W¤è¦¡¡A ³Ì¦n¬O¿í´`¼Ð·ÇªººD¨Ò¡A ¨ä®æ¦¡À³¸Ó¬°
package name-dash-version number-dash-release number-dot-spec¡C

³o¸Ì§Ú­ÌÁ|¤@­Ó¤p«¬ªº spec ÀÉ®×¬°¨Ò (vim-3.0-1.spec)¡G
\begin{tscreen}
\begin{verbatim}
Summary: ejects ejectable media and controls auto ejection
Name: eject
Version: 1.4
Release: 3
Copyright: GPL
Group: Utilities/System
Source: sunsite.unc.edu:/pub/Linux/utils/disk-management/eject-1.4.tar.gz
Patch: eject-1.4-make.patch
Patch1: eject-1.4-jaz.patch
%description
This program allows the user to eject media that is autoejecting like
CD-ROMs, Jaz and Zip drives, and floppy drives on SPARC machines.

%prep
%setup
%patch -p1
%patch1 -p1

%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"

%install
install -s -m 755 -o 0 -g 0 eject /usr/bin/eject
install -m 644 -o 0 -g 0 eject.1 /usr/man/man1

%files
%doc README COPYING ChangeLog

/usr/bin/eject
/usr/man/man1/eject.1
\end{verbatim}
\end{tscreen}





\subsection{The Header}

ÀÉ®× header ªº³¡¥÷¡A ¦³´X­Ó¯S©wªºÄæ¦ì¤º®e¡A ±z¥²¶·¥[¥H³]©w§¹¦¨¡A
¥t¥~ÁÙ¦³´XÂIª`·N¨Æ¶µ¡C ±z¥²¶·³]©w§¹¦¨ªºÄæ¦ì¤º®e¦p¤U¡G
\begin{itemize}
\item {\ttfamily Summary:} ¥H¤@¦æªø«×ªº´y­z¡A ¨Ó»¡©úµ{¦¡®M¥óªº¤º®e¡C
\item {\ttfamily Name:} ³o­ÓÀÉ®×¦WºÙ¥²¶·»P±z·Ç³Æ¨Ï¥Îªº rpm ÀÉ¦W¤@­P¡C
\item {\ttfamily Version:} ³o­Óª©¥»¦WºÙ¥²¶·»P±z·Ç³Æ¨Ï¥Îªº rpm ÀÉ¦W¤@­P¡C
\item {\ttfamily Release:} ³o­Óµo¦æ§Ç¸¹¥²¶·»P±z·Ç³Æ¨Ï¥Îªº rpm ÀÉ¦W¤@­P¡C
( ¤]´N¬O»¡¡A ¦pªG§Ú­Ì§¹¦¨¤@­Óµ{¦¡®M¥ó¡A ¦ý¨Æ«áµo²{¥¦¦³¨Ç¤p¤pªº°ÝÃD¡A
¥²¶·­«·s build ¤@¦¸¡A ¦¹®É·sªºµ{¦¡®M¥ó¡A ¨äµo¦æ§Ç¸¹«K¬O 2 ¸¹ )¡C
\item {\ttfamily Icon:} ¦pªG±z¨Ï¥Î¤F¨ä¥L°ª¶¥ªº¦w¸Ë¤u¨ãµ{¦¡
( ¹³¬O Red Hat ªº ``glint'' µ{¦¡ )¡A ¨º»ò³o¸Ì¥i¥H«ü©w¨ä¬Û¹ïÀ³ªº¹Ï¥ÜÀÉ¡A
¥¦¥²¶·¬O¤@­Ó gif ÀÉ®×¡A ¦Ó¥B¥²¶·¦ì©ó SOURCES ¥Ø¿ý¡C
\item {\ttfamily Source:} ³o¸Ì«ü©w¤F¨º¨Ç¡u¥¼¸g³B²z¹Lªº source ÀÉ®×¡vªº
HOME ¥Ø¿ý¡A ·í±z·Q­n­«·s¨ú±o source ÀÉ®×¡A ©Î¬OÀË¹î¬O§_¦³·sª©¥»®É¡A
´N»Ý­n¥Î¨ì³o­Ó³]©w¡C ª`·N¨Æ¶µ¡G ³o¸ÌªºÀÉ¦W¡A ¡u°È¥²¡v»P±z¨t²Î¤WªºÀÉ®×¦WºÙ¤@­P
( ¤]´N¬O»¡¡A ¤U¸ü source ÀÉ®×«á¡A ¤£­n¥hÅÜ§ó¨äÀÉ®×¦WºÙ )¡C
¦P®É¡A ±z¥i¥H«ü©w¤@­Ó¥H¤Wªº source ÀÉ®×¡A ¤è¦¡¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
Source0: blah-0.tar.gz
Source1: blah-1.tar.gz
Source2: fooblah.tar.gz
\end{verbatim}
\end{tscreen}

³o¨ÇÀÉ®×³£·|¨ì {\ttfamily SOURCES} ¥Ø¿ý©³¤U ( ¬ÛÃöªº¥Ø¿ýµ²ºc»¡©ú¡A
·|¦b«á­±ªº "The Source Directory Tree" ³¹¸`¸Ì¥[¥H°Q½× )¡C
\item {\ttfamily Patch:} ¦pªG±z»Ý­n­«·s¤U¸ü patch ÀÉ®×¡A
¨º»ò¨ä¥Ø¿ý¦ì¸m³]©w©ó¦¹¡C
ª`·N¨Æ¶µ¡G ³o¸ÌªºÀÉ¦W¡A ¥²¶·»P±z¨t²Î¤W¨Ï¥Îªº patch ÀÉ®×¦WºÙ¬Û²Å¡A
¥t¤@¤è­±¡A ©M«e­z¦h­Ó source ÀÉ®×ªº³]©w¤@¼Ë¡A ±z¤]¥i¥H«ü©w¦h­Ó
patch ÀÉ®×¦WºÙ¡C ¨ä®æ¦¡½d¨Ò¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
Patch0: blah-0.patch
Patch1: blah-1.patch
Patch2: fooblah.patch
\end{verbatim}
\end{tscreen}

³o¨ÇÀÉ®×³£·|¨ì {\ttfamily SOURCES} ¥Ø¿ý©³¤U¡C
\item {\ttfamily Copyright:} ³o¸Ìªº³]©w¡A ¥Î¥H»¡©úµ{¦¡®M¥ó±Ä¥Î¦óºØª©ÅvÁn©ú¡C
¹³ GPL¡B BSD¡B MIT¡B public domain¡B distributable¡B commercial µ¥¡A
³£¬O±z¥i¥H«ü©wªº¡C
\item {\ttfamily BuildRoot:} ±z¥i¥H«ü©w¤@­Ó¥Ø¿ý¡A
¥¦·|³Q·í§@¬O build »P install ·sµ{¦¡®M¥óªº ``root'' ¥Ø¿ý¡A
¦pªG±z·Q¦b¹ê»Ú¦w¸Ë¤§«e¡A ¥ý¦æ´ú¸Õµ{¦¡¤º®e¡A ¥i¥Hµ½¥Î¦¹¶µ³]©w¡C
\item {\ttfamily Group:} ³o¸Ìªº³]©w¡A ¥Î©ó°ª¶¥ªº¦w¸Ë¤u¨ãµ{¦¡ ( ¨Ò¦p
Red Hat ªº ``glint'' µ{¦¡ ) ·í¤¤¡A ¥Î¥H»¡©úµ{¦¡©ÒÄÝªº¸s²Õ¦ì¸m¡C
¥Ø«eªº¸s²Õ¬[ºc¡A ¤j­P¦p¤U©Ò­z¡G
\begin{tscreen}
\begin{verbatim}
Applications
    Communications
    Editors
        Emacs
    Engineering
    Spreadsheets
    Databases
    Graphics
    Networking
    Mail
    Math
    News
    Publishing
        TeX
Base
    Kernel
Utilities
    Archiving
    Console
    File
    System
    Terminal
    Text
Daemons
Documentation
X11
    XFree86
        Servers
    Applications
        Graphics
        Networking
    Games
        Strategy
        Video
    Amusements
    Utilities
    Libraries
    Window Managers
Libraries
Networking
    Admin
    Daemons
    News
    Utilities
Development
    Debuggers
    Libraries
        Libc
    Languages
        Fortran
        Tcl
    Building
    Version Control
    Tools
Shells
Games
\end{verbatim}
\end{tscreen}

\item {\ttfamily \%description}  ³o­Ó¨Ã«D¯uªº¬O header ¶µ¥Ø¡A
¦ý±zÀ³¸Ó³s¦P¤W­zªº¶µ¥Ø¤@¦P¶ñ¼g¡A ¨C­Ó¡uµ{¦¡®M¥ó¡v©Î¡u¤lµ{¦¡®M¥ó¡v¡A
³£À³¸Ó¦³¤@­Ó description tag¡C ³o¸Ì¤¹³\±z¿é¤J¦h¦æ¤º®e¡A
¨Ï±oµ{¦¡®M¥ó¯à°÷¨ã¦³¤@¥÷§¹¾ã¸ÔºÉªº»¡©ú¡C
\end{itemize}





\subsection{Prep}

³o¸Ì¬O spec ÀÉ®×ªº¥t¤@­Ó¬q¸¨³¹¸`¡A ¥Î¥H³]©wÅý source ÀÉ®×´Nºü¡A
¥H¨Ñ¤U¤@¨Bªº build °Ê§@¡C ¥­±`§Ú­Ì¥²¶·¸g¹L setup¡A ¤~¯à¹ê»Ú¶i¦æ {\ttfamily make}
°Ê§@¡A ¦]¦¹¦b¥»¬q¸¨³¹¸`¤¤¡A §Ú­Ì±Nµø»Ý­n¶i¦æ source ÀÉ®×ªº patch »P setup¡C

¦³¥ó¨Æ­È±oª`·Nªº¡G ±µ¤U¨Óªº¬q¸¨³]©w¡A ¹ê»Ú¤W¥u¬O«ü©ú¬Y¬q shell scripts
ªº¦ì¸m¡A ±z¥i¥H±N shell scripts ªº¤º®e¡A ¥t¥~¥H {\ttfamily sh} script
ªº¤è¦¡¥[¥H¦sÀÉ¡A ¨Ã±N script µ{¦¡¦WºÙ¸m©ó {\ttfamily \%prep} tag ¤§«á¡A
¥Î¥H°õ¦æ source ÀÉ®×ªº unpack »P patch °Ê§@¡C ·íµM¡A ¥H­ì¦³¤§ macro
«¬¦¡¨Ó°µ¡A À³¸Ó¬O¤è«K³\¦hªº¡C

²Ä¤@­Ó­n»¡©úªº macro ¬O {\ttfamily \%setup}¡C
¦pªG§Ú­Ì±Ä¥Î¨ä³ÌÂ²³æªº®æ¦¡ ( §Y¤£¥[¥ô¦ó©R¥O¦C°Ñ¼Æªº±¡ªp )¡A
¥¦·|³æ¯Â¦a±N source ÀÉ®×¥[¥H unpack¡A ¨Ã {\ttfamily cd} ¶i¤J source ÀÉ®×ªº¥Ø¿ý¡C
°£¦¹¤§¥~¡A ±zÁÙ¥i¥H¨Ï¥Î¤U¦Cªº¿ï¶µ¡G

\begin{itemize}
\item {\ttfamily -n name} ³o­Ó¿ï¶µ³]©w·|§â build ªº¥Ø¿ý³]¬° {\ttfamily name}¡A
­ì¹w³]­È¬° {\ttfamily \$NAME-\$VERSION}¡A ¨ä¥L¥i¯à¥Ø¿ý¦WºÙ¥]¬A
{\ttfamily \$NAME}¡A {\ttfamily \$$\{$NAME$\}$\$$\{$VERSION$\}$}¡A ©Î¬O tar
ÀÉ®×¥»¨­©Ò¥Îªº¥Ø¿ý¡C ( ½Ðª`·N¨ì¡A ¤W­zªº ``\$'' ÅÜ¼Æ¡A
¨Ã{\itshape ¤£¬O\/} spec ÀÉ®×¸ÌªºÅÜ¼Æ¡A ¥¦­Ì¦b³o¸Ì¥u¬O¥Î¨Ó¥Nªí¤@­Ó½d¨Ò¦WºÙ¡A
±z¥²¶·¦bµ{¦¡®M¥ó¸Ì¡A ¨Ï¥Î¹ê»ÚªºÀÉ®×¦WºÙ»Pª©¥»¦WºÙ )¡C
\item {\ttfamily -c} ¦b¶i¦æ untar °Ê§@{\itshape ¤§«e\/}¡A
·|¥ý«Ø¥ß¤@­Ó¥Ø¿ý¡A ¨Ã cd ¶i¤J¸Ó¥Ø¿ý¡C
\item {\ttfamily -b \#} ¦b cd ¶i¤J¸Ó¥Ø¿ý{\itshape ¤§«e\/}¡A
·|¥ý±N Source\# ¶i¦æ untar °Ê§@ ( ³o­Ó¿ï¶µ»P {\ttfamily -c} ¿ï¶µ¨Ã¦s®É¡A
¬O¨S¦³·N¸qªº¡A ©Ò¥HÀ³Á×§K¦P®É¨Ï¥Î )¡A ¦Ó¥B³o­Ó¿ï¶µ¡A
¶È¾A¥Î©ó¦h­Ó source ÀÉ®×ªº³õ¦X¡C
\item {\ttfamily -a \#} ¦b cd ¶i¤J¸Ó¥Ø¿ý{\itshape ¤§«á\/}¡A
¦A±N Source\# ¶i¦æ untar °Ê§@¡C
\item {\ttfamily -T} ³o­Ó¿ï¶µ·|»\¹L­ì¥»¹w³]ªº untar °Ê§@¡A
¦P®É»Ý­n¤@­Ó {\ttfamily -b 0} ©Î¬O {\ttfamily -a 0} ªº¿ï¶µ¨Ó°t¦X¡A
·í±z¨Ï¥Î¨ì¨â­Ó¥H¤Wªº source ÀÉ®×®É¡A «K»Ý­n¦¹¶µ¥\¯à¡C
\item {\ttfamily -D} ¦b¸Ñ¶}µ{¦¡®M¥ó¤§«e¡A {\itshape ¤£­n\/}§R°£¸Ó¥Ø¿ý¡C
³o­Ó¿ï¶µ¶È¾A¥Î©ó¨Ï¥Î¨â­Ó¥H¤W setup macro ¤§³õ¦X¡A
¦Ó¥B{\itshape ¥u¯à\/}¥Î©ó²Ä¤@­Ó setup macro {\itshape ¤§«á\/} ( ¤d¸U§O¥Î©ó²Ä¤@­Ó¤§¤º )¡C
\end{itemize}


±µ¤U¨Ó­n»¡©úªº macro ¬O {\ttfamily \%patch}¡C
¥¦¬O¥Î¨Ó¨ó§U¦Û°Ê³B²z source ÀÉ®×§ó·sªº°Ê§@¡A ¨ä¬ÛÃöªº¿ï¶µ«Ü¦h¡A ¦Cªí»¡©ú¦p¤U¡G
\begin{itemize}
\item {\ttfamily \#} ·|¤Þ¥Î Patch\# ·í§@¨ä©Ò»Ý¤§§ó·sÀÉ¡C
\item {\ttfamily -p \#} ¦³®É patch(1) «ü¥O»Ý°t¦X«ü©w strip ªº¥Ø¿ý¼Æ¥Ø¡A
§A¥i¥H¦b¦¹¿ï¶µ¤¤¥[¥H³]©w¡C
\item {\ttfamily -P} ¨ä¹w³]¤§°Ê§@¬O¤Þ¥Î {\ttfamily Patch} ( ©Î {\ttfamily Patch0} )¡A
·í±z¨Ï¥Î¨â­Ó¥H¤Wªº {\ttfamily \%patch} macro¡A ¨Ã¥B»Ý­n»P²Ä¤@­Ó
macro ¤£¦P¤§ patch number ®É¡A ³o­Ó¿ï¶µÅã±o¬Û·í¦³¥Î¡C
¥¦·|»\¹L­ì¥»ªº¹w³]°Ê§@¡A ¨Ã¥B»Ý­n°t¦X¤@­Ó {\ttfamily 0}¡A
¥H¨Ï±o¥D­nªº source ÀÉ®×±o¥H¶i¦æ untar °Ê§@¡C
\item  ±z¤]¥i¥H¨Ï¥Î {\ttfamily \%patch\#}¡A
¦Ó¤£¥²¨Ï¥Î³o¼Ëªº«ü¥O¡G {\ttfamily \%patch \# -P}
\end{itemize}


³o¨ÇÀ³¸Ó´N¬O¥þ³¡©Ò»Ý­nª¾¹D¤§ macro »¡©ú¡A ¤F¸Ñ¥¦­Ì¤§«á¡A
±z¤]¥i¥H³z¹L {\ttfamily sh} ¤§ script ®æ¦¡¡A ³]©w¤£¦Pªº setup ¤èªk¡A
¦b {\ttfamily \%build} macro ( ¦b¤U¤@³¹¸`¤¤·|´£¤Î ) ¤§«e¡A
±z©Ò³]©w¤§©Ò¦³¿ï¶µ¡A ³£¬O¸g¥Ñ {\ttfamily sh} ¨Ó°õ¦æ¡A
±z¥i¥H¦A°Ñ¦Ò¤@¤U«e­zªº½d¨Ò¡A ©Î³\¥i¥H¾A¥Î©ó±zªº»Ý­n¡C




\subsection{Build}

³o­Ó³¹¸`¸Ì¡A ©Ò­z¤Îªº¨Ã«D¯u¥¿ªº macro¡C ·í±z§â source ÀÉ®× untar¡A
¨Ã¥B patch §¹¦¨¡A cd ¶i¤J¥Ø¿ý¤§«á¡A ¶}©l·Ç³Æ build °Ê§@®É¡A
«K¬O¦b³o¸Ì³]©w¨º¨Ç±±¨î build °Ê§@ªº«ü¥O¡C ¦Ó³o¨Ç«ü¥O³£ÁÙ¬O¶Çµ¹ {\ttfamily sh}¡A
©Ò¥H¥ô¦ó {\ttfamily sh} ¤§«ü¥O¡A ³£¥i¥H¦b¦¹«ü©w ( ¥]¬A comments ¦b¤º )¡C
{\bfseries ¦b spec ÀÉ®×¸Ìªº¨C¤@¬q¸¨³¹¸`³]©w¤¤¡A ±zªº¥Ø«e©Ò¦b¥Ø¿ý¦ì¸m¡A
³£·|³Q­«·s³]©w¬° source directory ªº³Ì¤W¼h}¡A ©Ò¥H½Ð¨c°O¦b¤ß¡A
¥²­n®É¡A ±z¥i¥H {\ttfamily cd} ¶i¤J¬ÛÃöªº¤l¥Ø¿ý¡C




\subsection{Install}

³o¸Ì©Ò³]©wªº¡A ¦P¼Ë¤]¤£¬O macro¡A °ò¥»¤W¡A ±z¥u¶·­n¦b¦¹³]©w¤@¨Ç
install ©Ò»Ý¤§«ü¥O¡C ¦pªG±z¥´ºâ¦bµ{¦¡®M¥ó¸Ì¡A ´£¨Ñ§¹¾ãªº {\ttfamily make
install} «ü¥O³]©w¡A ¨º»ò½Ð¦b¥»¬q¸¨³]©w¤¤§¹¦¨¡A ¤£µM¡A
±z¤]¥i¥H§ó§ï makefile ÀÉ®×¸Ì¡A ¦³Ãö {\ttfamily make install} ªº³¡¥÷¡A
µM«á¶È¦b¥»¬q¸¨³]©w¤¤«ü©w {\ttfamily make install}¡C ©Î¬O¡A ¤]¥i¥H§â¾ã­Ó
install ªº«ü¥O¥æµ¹ {\ttfamily sh} ¨Ó°µ¡C °O¦í¡A ±zªº¥Ø«e©Ò¦b¥Ø¿ý¦ì¸m¡A
À³¸Ó¤w³Q­«·s³]©w¬° source directory ªº³Ì¤W¼h¡C




\subsection{Optional pre and post Install/Uninstall Scripts}

µ{¦¡®M¥ó¦b¦w¸Ë»P¸Ñ°£¦w¸Ë¤§«e«á¡A±z¥i¥H«ü©w script¡A 
¨Ï¨äµø±¡ªp¥[¥H°õ¦æ¡C ¶i¦æ¦¹¶µ°Ê§@ªº¥D­n­ì¦]¤§¤@¡A
«K¬O¹J¨ì¦p¤Uªº³õ¦X¡A Ä´¦p»¡¡A §Ú­Ì¦b¦w¸Ë©Î¸Ñ°£¦w¸Ë¤@¨Ç§t¦³
shared library ªºµ{¦¡®M¥ó®É¡A »Ý­n°õ¦æ {\ttfamily ldconfig}¡C
¦U¦¡ script ©Ò»Ý¤§ macro ¦WºÙ¦p¤U¡G
\begin{itemize}
\item {\ttfamily \%pre} °õ¦æ pre-install scripts ªº macro¡C
\item {\ttfamily \%post} °õ¦æ post-install scripts ªº macro¡C
\item {\ttfamily \%preun} °õ¦æ pre-uninstall scripts ªº macro¡C
\item {\ttfamily \%postun} °õ¦æ post-uninstall scripts ªº macro¡C
\end{itemize}


³o¨Ç¬q¸¨³]©wªº¤º®e¡A ¥i¥H¬O¥ô¦ó {\ttfamily sh} «¬¦¡¤§ script¡A
¤£¹L¡A ±z{\itshape µL¶·\/}«ü©wÃöÁä±Ô­z {\ttfamily \#!/bin/sh}¡C




\subsection{Files}

¥»¬q¸¨³]©w·í¤¤¡A ±z{\itshape ¥²¶·\/}¦C¥Xµ{¦¡®M¥ó¤º¤§©ÒÄÝÀÉ®×¦WºÙ¡C
RPM ¥»¨­¨ÃµL±q±oª¾¡A °õ¦æ {\ttfamily make install} ¤§«á¡A ¨ì©³¦³­þ¨Ç
binary ÀÉ®×³Q¦w¸Ë¶i¥h¡A ¥Ø«e{\itshape ¨ÃµL\/}¥Lªk¥i¥Hª½±µ¸Ñ¨M¦¹°ÝÃD¡C
¦³¨Ç¤H«ØÄ³¦b install µ{¦¡®M¥óªº«e«á¡A ¨Ï¥Î {\ttfamily find} «ü¥O¨Ó³B²z¡A
¤£¹L¦b¤@­Ó¦h¨Ï¥ÎªÌªº¨t²Î¤U¡A ³oÀ³¸Ó¬O¤£¥i¦æªº¡A ¦]¬°¦bµ{¦¡®M¥ó
build ªº¹Lµ{¤¤¡A ¥i¯à¦³¨ä¥L»Pµ{¦¡®M¥ó¥»¨­µLÃöªºÀÉ®×³Q²£¥Í¡C

¥t¥~ÁÙ¦³¤@¨Ç macro¡A ¥¦­Ì¥i¥Î¨Ó°µ¤@¨Ç¯S®íªº¤u§@¡A
¯÷±N¨ä¦C­z©ó¤U¡G
\begin{itemize}
\item {\ttfamily \%doc} ¥Î¥H¼Ð¥Ü¦b install µ{¦¡®M¥ó®É¡A
±z©Ò·Q­n¦w¸Ë¤§ source ÀÉ®×¸Ìªº»¡©ú¤å¥ó¬O­þ¨Ç¡A
¦Ó³o¨Ç»¡©ú¤å¥ó·|³Q¦w¸Ë¦b
{\ttfamily /usr/doc/\$NAME-\$VERSION-\$RELEASE}¡C
±z¥i¥H¦b©R¥O¦C¤W¡A ¥H¦¹ macro ¦P®É«ü©w¦n´X­Ó»¡©ú¤å¥ó¦WºÙ¡A
©Î¬O¥H¦¹ macro¡A ¦U§O¬°¥¦­Ì¤@¤@§¹¦¨«ü©w¡C
\item {\ttfamily \%config} ¥Î¥H¼Ð¥Üµ{¦¡®M¥ó¸Ìªº³]©wÀÉ®×¬O­þ¨Ç¡A
³o¥]¬A¹³ sendmail.cf¡B passwd ¤§ÃþªºÀÉ®×¡C
¦pªG±z¨Æ«á uninstall ¤F¬Y­Óµ{¦¡®M¥ó¡A ¦Ó¥B¥¦§t¦³³]©wÀÉ®×¡A
¨º»ò©Ò¦³¨S¦³§ïÅÜªºÀÉ®×·|³Q²¾°£¡A ¦Ó©Ò¦³¤w¸g§ïÅÜªºÀÉ®×¡A
·|¦b­ìÀÉ®×¦WºÙ¤§«á¡A ¥[¤W {\ttfamily .rpmsave} ªº©µ¦ù¦WºÙ¡C
¦P¼Ëªº¡A ±z¥i¥H¦b¦¹¦P®É¦C¥X¦h­ÓÀÉ®×¦WºÙ¡C
\item {\ttfamily \%dir} ¦bÀÉ®×¦Cªí¤¤¡A ¼Ð©ú¬Y¤@­Ó¯S©wªº¥Ø¿ý¡A
¥Î¥H»¡©ú¸Ó¥Ø¿ý¬°¬Yµ{¦¡®M¥ó©Ò¾Ö¦³¡C ¦pªG±z¦bÀÉ®×¦Cªí¤¤«ü©w¤@­Ó¥Ø¿ý¦WºÙ¡A
¦ý«o{\itshape ¨S¦³\/}¦b«e­±¥[¤W{\ttfamily \%dir} macro¡A ¨º»ò¸Ó¥Ø¿ý¤º¡A
{\itshape ©Ò¦³ÀÉ®×¥Ø¿ý\/}³£·|³Q¥]§t¦bÀÉ®×¦Cªí·í¤¤¡A ¨Ã¦bµy«á¡A
³Q·í§@¬Oµ{¦¡®M¥óªº¤@³¡¥÷¦Ó¥þ³Q¦w¸Ë¶i¥h¡C
\item {\ttfamily \%files -f $<$filename$>$} ¤¹³\±z¤Þ¥Î source
¤§ build ¥Ø¿ý¸Ì¡A ¬Y¥÷ÀÉ®×²M³æªº¤º®e¡C ·í±z¹J¨ì¬Y¤@­Óµ{¦¡®M¥ó¡A
¥¦¥i¥H«Ø¥ß¦Û¤vªºÀÉ®×²M³æ®É¡A ³o­Ó¿ï¶µ«KÅã±o¬Û·í¤£¿ù¡A
±z¥u¶·­n¤Þ¥Î¸Ó¥÷ÀÉ®×²M³æ¡A ¤£¥²¦A¦Û¦æ¨¯­W¦a¦C¥X¡C
\end{itemize}


¦bÀÉ®×¦Cªí¸Ì¡A ¦³­Ó³Ì¤jªºª`·N¨Æ¶µ¡A «K¬O¥Ø¿ýªº³]©w¡C
¦pªG±z¤£¤p¤ß±N {\ttfamily /usr/bin} ¦C¤J¡A ¨º»ò±zªºµ{¦¡®M¥ó¡A
±N·|¥]¬A¨t²Î¸Ì {\ttfamily /usr/bin} ©³¤Uªº{\itshape ©Ò¦³\/}ÀÉ®×¡C




\subsection{Building It}




\subsubsection{The Source Directory Tree}

²Ä¤@¥ó¨Æ¡A ±z¥²¶·¿ï©w¤@­Ó¾A·íªº build tree¡A
¦¹¶µ³]©w¥i¦b {\ttfamily /etc/rpmrc} ÀÉ®×¸Ì§¹¦¨¡A
¦Ó¤j¦h¼Æ¤H·|ª½±µ¨Ï¥Î {\ttfamily /usr/src}¡C

±z¥i¯àÁÙ»Ý­n«Ø¥ß¤U¦Cªº¥Ø¿ý¡A ¨Ï±o build tree ªº³]©w¯à°÷§¹¦¨¡G
\begin{itemize}
\item {\ttfamily BUILD} ¦¹¥Ø¿ý«K¬O RPM ¶i¦æ©Ò¦³ build °Ê§@ªº¤u§@¥Ø¿ý¡C
±z¤£¥²¯S§O¦a¦b­þ­Ó¥Ø¿ý¶i¦æ´ú¸Õ©Êªº build °Ê§@¡C
\item {\ttfamily SOURCES} ¦¹¥Ø¿ý¦s©ñµÛ±zªº¡u°_©l¡v (original)
­ì©l tar ÀÉ®×¡B »P¬ÛÃöªº patch ÀÉ®×¡A RPM ¹w³]·|´M§ä¥»¥Ø¿ý¡C
\item {\ttfamily SPECS} ¦¹¥Ø¿ý¦s©ñ©Ò¦³¤§ spec ÀÉ®×¡C
\item {\ttfamily RPMS} ¦¹¥Ø¿ý¦s©ñ©Ò¦³ build ²£¥Í¤§ binary ®æ¦¡ RPM ÀÉ®×¡C
\item {\ttfamily SRPMS} ¦¹¥Ø¿ý¦s©ñ©Ò¦³ source ®æ¦¡ RPM ÀÉ®×¡C
\end{itemize}





\subsubsection{Test Building}

­º¥ý¡A ±z¤j·§·|·Q­n¨ú¦^ source ÀÉ®×¡A ¦b¨S¦³¨Ï¥Î RPM ªº±¡ªp¤U¡A
¶i¦æ¤@¦¸¡u¯Â²bªº¡v build °Ê§@¡C ¨ä¨BÆJ«K¬O¡A ¸Ñ¶} source ÀÉ®×¡A
±N¸Ó¥Ø¿ý¦WºÙ§ï¬° \$NAME.org¡A µM«á¦A¦¸¸Ñ¶} source ÀÉ®×¡A
§Ú­Ì»Ý­n¨Ï¥Î¦¹¤@ source ¨Ó¶i¦æ build °Ê§@¡C
¶i¤J¦¹¤@ source ¥Ø¿ý¡A «ö·Ó«ü¥Ü¨Ó¶i¦æ build¡A
¦pªG±z¥²¶·½s¿è¥ô¦óªF¦è¡A ±z·|»Ý­n¤@¥÷ patch¡A
¤@¥¹±z§¹¦¨ build ¤u§@¡A «K¥i²M°£ source ¥Ø¿ý¸Ìªº¤º®e¡C
½Ð½T©w±N {\ttfamily configure} script ¸Ì¡A ©Ò¦³²£¥Í¤§ÀÉ®×¥[¥H²M°£¡A
µM«á¦A {\ttfamily cd} ¦^¨ì source ¥Ø¿ý¤§¤W¼h¡A ±µµÛ«K¥i°õ¦æ³o¼Ëªº°Ê§@¡G
\begin{tscreen}
\begin{verbatim}
diff -uNr dirname.orig dirname > ../SOURCES/dirname-linux.patch
\end{verbatim}
\end{tscreen}

¤W­z«ü¥O·|²£¥Í¤@¥÷ patch¡A ±z¦b spec ÀÉ®×¥i¥H¨Ï¥Î¨ì¥¦¡C
ª`·N¨ì¤W­±ªº ''linux'' ¦WºÙ¡A ¥¦¥u¬O¤@­Ó´£¥Ü§@¥Î¡A
©Î³\±z¥i¥H¨Ï¥Î¨ä¥L¦WºÙ¡A ½Ñ¦p ''config'' ©Î ''bugs'' ¤§Ãþªº´£¥Ü¦WºÙ¡A
¥Î¥H»¡©ú±z{\itshape ¦ó¥H\/}»s§@¦¹¤@ patch ÀÉ®×¡C
¦P®É¡A ±z³Ì¦n¤]¦b¨Ï¥Î patch ÀÉ®×¤§«e¡A ¥ýÆ[¹î¸ÌÀYªº¤º®e¡A
½T©w¬O§_µL·N¶¡¥]§t¤F¨ä¥Lªº binary ÀÉ®×¡C




\subsubsection{Generating the File List}

²{¦b¡A ±z¤w¸g¦³¤F¤@¥÷¥i¥H®³¨Ó build ªº source ÀÉ®×¡A
¦Ó¥B±z¤]ª¾¹D¦p¦ó§¹¦¨¨ä¬ÛÃöªº°Ê§@¡A ¦p build »P install µ¥¡C
Æ[¹î install ®É¡A ¨Ì§Ç²£¥Íªºµ²ªG¡A §Ú­Ì±N¥Ñ¦¹µ²ªG¡A
¦b spec ÀÉ®×¤¤«Ø¥ß¤@¥÷ÀÉ®×¦Cªí¡C
³q±`§Ú­Ì·|¦b¶i¦æ¤W­z¨BÆJªº¦P®É¡A ¤@°_«Ø¥ß spec ÀÉ®×¡A
±z¥i¥H¥ý§¹¦¨ÀÉ®×ªº°_©l³¡¤À¡A ©M´X­ÓÂ²³æªº³¡¤À¡A
µM«á¦A§â¨ä¥L³¡¤Àªº¨BÆJ¥[¥H§¹¦¨¡C




\subsubsection{Building the Package with RPM}

¤@¥¹±z¦³¤F¤@¥÷ spec ÀÉ®×¡A ¤@¤Á«K¤w´Nºü¡A ±z¥i¥H·Ç³Æ build ªº´ú¸Õ°Ê§@¡C
³Ì¦nªº¤è¦¡¡A ´N¬O¨Ï¥ÎÃþ¦ü¤U¦Cªº«ü¥O¡G

\begin{tscreen}
\begin{verbatim}
rpm -ba foobar-1.0.spec
\end{verbatim}
\end{tscreen}


°t¦X {\ttfamily -b} ¿ï¶µ¡A §Ú­ÌÁÙ¥i¥H¨Ï¥Î¨ä¥L¦³¥Îªº¿ï¶µ¡G
\begin{itemize}
\item {\ttfamily p} «üªº¬O¥u°õ¦æ spec ÀÉ®×¤§ {\ttfamily prep} ³¡¥÷¡C
\item {\ttfamily l} °w¹ï {\ttfamily \%files} ¶i¦æÀÉ®×¦Cªíªº¤ñ¹ïÀË¬d°Ê§@¡C
\item {\ttfamily c} °õ¦æ prep »P compile ªº°Ê§@¡C ·í±z¤£½T©w source
ÀÉ®×¬O§_¯à°÷ build ®É¡A ¦¹¿ï¶µÅã±o¬Û·í¦³¥Î¡C
©Î³\±z·|Ä±±o¥¦¨Ã¨S¦³¦h¤j¥Î³B¡A ¦]¬°±z¥i¯à·Q­nÄ~Äò­×§ï source
ÀÉ®×¥»¨­¡A ª½¨ì build «á¦A¶}©l¨Ï¥Î RPM¡A ¦ý¤@¥¹±z¼ô±x RPM ªº¥Îªk«á¡A
·|µo²{¥¦ªº«K§Q¤§³B¡C
\item {\ttfamily i} °õ¦æ prep¡B compile¡B »P install¡C
\item {\ttfamily b} °õ¦æ prep¡B compile¡B install¡B ¨Ã¥u build ¥X¤@¥÷
binary µ{¦¡®M¥ó¡C
\item {\ttfamily a} °õ¦æ©Ò¦³ªº build °Ê§@ ( ¥]¬A  source »P binary ªºµ{¦¡®M¥ó )¡C
\end{itemize}

°t¦X {\ttfamily -b} ¿ï¶µ¡A ¥t¥~ÁÙ¦³¤@¨Ç²Ó¶µ¿ï¶µ¥i¨Ñ¨Ï¥Î¡A ¥¦­Ì¤À§O¬O¡G
\begin{itemize}
\item {\ttfamily --short-circuit} ·|ª½±µ¸õ¦Ü¬Y­Ó¯S©wªº¶¥¬q ( ¶È¥i°t¦X
c »P i ¿ï¶µ¨Ó¨Ï¥Î )¡C
\item {\ttfamily --clean} ·í°õ¦æ§¹²¦®É¡A ²¾°£¬ÛÃöªº build tree¡C
\item {\ttfamily --keep-temps} ·|§â©Ò¦³ªº temp »P scripts ÀÉ®×¡A
³£«O¯d¦b /tmp ¥Ø¿ý¡A ±z¥i¥H¨Ï¥Î {\ttfamily -v} ¿ï¶µ¡A ¹ê»ÚÆ[¹î¦³­þ¨ÇÀÉ®×³Q²£¥Í¡C
\item {\ttfamily --test} ¨Ã¤£¹ê»Ú°õ¦æ¥ô¦ó¶¥¬qªº°Ê§@¡A ¦ý¦³°õ¦æ keep-temp ªº³¡¥÷¡C
\end{itemize}





\subsection{Testing It}

¤@¥¹¦³¤F source »P binary ªº rpm ÀÉ®×¡A ±z¥²¶·¶i¦æ´ú¸Õ¤u§@¡C
³ÌÂ²³æ¥B³Ì¦nªº¤è¦¡¡A ´N¬O¨Ï¥Î¥t¤@¥x¾÷¾¹¨Ó´ú¸Õ¡A
¤]´N¬O¶i¦æ build °Ê§@¤§¥~ªº¾÷¾¹¡C ²¦³º¡A ±z­è¦b±zªº¾÷¾¹¤W¡A
§¹¦¨¤@¤j°ïªº {\ttfamily make install} °Ê§@¡A ­Y¦b­ì¾÷¾¹¤W°µ´ú¸Õ¡A
·íµM·|Åã±o¬Û·í¶¶§QÅo¡C

±z¥i¥H°õ¦æ {\ttfamily rpm -u packagename} ¨Ó¶i¦æ´ú¸Õ¡A
¦ý³o¼Ë°µÁÙ¬O¦³³y°²ªº¥i¯à¡A ¦]¬°¦b build ªº¹Lµ{¤¤¡A
±z°µ¤F {\ttfamily make install} ªº°Ê§@¡A ¦pªG±z¦bÀÉ®×¦Cªí¤¤¿òº|¤F¬Y¨ÇªF¦è¡A
¨º»ò¥¦¤£·|³Q¸Ñ°£¦w¸Ë¡A µM«á±z¦A reinstall ³o¥÷ binary µ{¦¡®M¥ó¡A
«K·|µo²{¾ã­Ó¨t²ÎÁÙ¬O§¹¾ã¦Ó¹B§@¥¿±`ªº¡A ¦ý¹ê»Ú¤Wªº rpm ÀÉ®×ÁÙ¬O¦³°ÝÃD¡C
¦]¦¹½Ð¯S§O°O¦í¡A ¥Ñ©ó±z°õ¦æªº¬O {\ttfamily rpm -ba package}¡A ¦Ó¤j¦h¼Æªº¤H¡A
·|¥u¥H {\ttfamily rpm -i package} ¤è¦¡¡A ¨Ó¦w¸Ë±zªºµ{¦¡®M¥ó¡C
·í binary ÀÉ®×¿W¦Û³Q¦w¸Ë®É¡A ±z¥²¶·½T©w¦b {\ttfamily build} ©Î {\ttfamily install}
ªº¬q¸¨³]©w¤¤¡A ¨Ã¨S¦³¬ÛÃöªº³¡¥÷¹ï¨ä¦³¼vÅT¡C






\subsection{What to do with your new RPMs}

¤@¥¹±z§@¥X¤F¤@¥÷¦Û¤vªº RPM ÀÉ®× ( °²©w³o¥÷ÀÉ®×¡A ¤§«e¨Ã¥¼¥H RPM
¤è¦¡»s§@¹L )¡A ±z¥i¥H±N±zªº§@«~°^Ämµ¹§O¤H ( ¦¹®É°²©w±z»s§@ªº RPM
ÀÉ®×¡A ¬O¥i¥H¦Û¥Ñ¶Ç§Gªº )¡C ±z¥i¥H¦Ò¼{§â¥¦¤W¶Ç¦Ü
\nameurl{ftp://ftp.redhat.com}{ftp.redhat.com}¡C






\subsection{What Now?}

½Ð¦^ÅU¤W­zªº³¹¸`¡A ¦b¡uTesting¡v©M¡uWhat to do with new RPMs¡v¸Ì¡A
§Ú­Ì§Æ±æ©Ò¦³ªº RPM ÀÉ®×³£¯à³Q´£¨Ñ¥X¨Ó¡A ¦Ó¥B§Ú­Ì§Æ±æ¥¦­Ì³£·|¬O¦nªº RPM
ÀÉ®×¡C ¦]¦¹¡A ½Ð¦hªá¤@ÂI®É¶¡¦n¦n¦a´ú¸Õ¥¦­Ì¡A µM«á¦AªáÂI®É¶¡±N¥¦­Ì¤W¶Ç¡A
¥H³yºÖ´¶Ã¹¤j²³¡C ¦P®É¡A {\itshape ½Ð\/}½T©w±z¥u¤W¶Ç{\itshape ¥i¨Ñ¦Û¥Ñ¶Ç§Gªº³nÅé\/}¡C
°Ó·~³nÅé»P¦@¨É³nÅé¬O{\itshape ¤£\/}À³¸Ó³Q¤W¶Çªº¡A °£«D¥¦­Ì¦³¥÷³\¥iÁn©ú¦b¤W­±¡C
³o¼Ëªº³nÅé¡A ¥]¬A¦³ Netscape software¡B ssh¡B pgp µ¥¡C




\section{Multi-architectural RPM Building}

RPM ¥Ø«e¥i¥Î©ó build ¦U¦¡§@·~¥­¥x¤§µ{¦¡®M¥ó¡A ¦p Intel i386¡B
¦w¸Ë Linux ¤§ Digital Alpha¡B »P Sparc ¾÷¾¹¡A
¦Ó¥B¦³¤H´ú¸Õ³ø§i¡A »¡©ú¥¦¤]¥i¥H¦b SGI »P HP ¤u§@¯¸¤W¨Ï¥Î¡C
RPM ¦³³\¦h¯S¦â¡A ¨Ï±o¥¦¯à°÷»´ÃP¦a¤ä´©¦b¦U¦¡§@·~¥­¥x¤W build
µ{¦¡®M¥ó¡A ²Ä¤@­Ó¯S¦â«K¬O¦b {\ttfamily /etc/rpmrc} ÀÉ®×¸Ìªº
``optflags'' ³]©w¶µ¥Ø¡A ·í§Ú­Ì¦b build ³nÅé®M¥ó®É¡A
¥¦¥i¥Î©ó«ü©w¥­¥x¬[ºcªº¬ÛÃö³]©w­È¡C ¥t¤@­Ó¯S¦â¬O spec ÀÉ®×¸Ìªº
``arch'' macro ¶µ¥Ø¡A ®Ú¾Ú©Ò­n¶i¦æ build ªº¥­¥x¬[ºc¡A
±z¥i¥H«ü©w¥¦­Ì°õ¦æ¤£¦Pªº¤u§@¡C
¥t¤@­Ó¯S¦â¬O¦bÀÉ®× header ³Bªº ``Exclude'' ³]©w¶µ¥Ø¡C




\subsection{Sample spec File}

¤U¦C¥H ``fileutils'' µ{¦¡®M¥ó¬°¨Ò¡A ¨ä spec ÀÉ®×ªº³¡¥÷¤º®e¡A
¥i¥Î¨Ó¦b Alpha »P Intel ¥­¥x¬[ºc¤W¡A ¶i¦æ build ªº¤u§@¡C
\begin{tscreen}
\begin{verbatim}
Summary: GNU File Utilities
Name: fileutils
Version: 3.16
Release: 1
Copyright: GPL
Group: Utilities/File
Source0: prep.ai.mit.edu:/pub/gnu/fileutils-3.16.tar.gz
Source1: DIR_COLORS
Patch: fileutils-3.16-mktime.patch

%description
These are the GNU file management utilities.  It includes programs
to copy, move, list, etc, files.

The ls program in this package now incorporates color ls!

%prep
%setup

%ifarch alpha
%patch -p1
autoconf
%endif
%build
configure --prefix=/usr --exec-prefix=/
make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS=-s

%install
rm -f /usr/info/fileutils*
make install
gzip -9nf /usr/info/fileutils*

.
.
.
\end{verbatim}
\end{tscreen}





\subsection{Optflags}

¦b¦¹¤@½d¨Ò¤¤¡A ±z¥i¥Hµo²{ ``optflags'' ³]©w¶µ¥Ø¡A
¬O¦p¦ó¥Ñ {\ttfamily /etc/rpmrc} ÀÉ®×¤¤µo´§§@¥Î¡C
­º¥ý¨M©w±z©Ò¶i¦æ build °Ê§@ªº¾÷¾¹¡A ¬O­þ¤@ºØ¥­¥x¬[ºc¡A
½Ð±N¨ä¥¿½T¤§³]©w­È¡A «ü©w¨ì {\ttfamily RPM\_OPT\_FLAGS}¡C
±z¥²¶·°w¹ïµ{¦¡®M¥ó¤§ Makefile ÀÉ®×¡A ¶i¦æ patch ªº°Ê§@¡A
±N¤@¨Ç³q¥ÎªºÅÜ¼Æ³]©w­È¡A ¥[¥H§ïÅÜ¥H¾A¥Î©ó±zªºÀô¹Ò
( ¦p {\ttfamily -m486} »P {\ttfamily -O2} )¡C
±z¥i¥H install ³o¥÷ source ®M¥ó¡A ±µµÛ¸Ñ¶} source ¨ÃÀË¬d¨ä Makefile ÀÉ®×¡A
¥H¶i¤@¨B§ä¥X§ó¦nªº³]©w¤è¦¡¡A µM«áÆ[¹î Makefile ªº patch ¤º®e¡A
¥H¤F¸Ñ§Ú­Ì¥²¶·°µ­þ¨Ç§ïÅÜ¡C




\subsection{Macros}

{\ttfamily \%ifarch} ¦¹¤@ macro ³]©w¶µ¥Ø¬O«D±`­«­nªº¡A ¦b³\¦h³õ¦X¡A
±z¶·­n¥u°w¹ï¬Y¤@¯S©w¥­¥x¬[ºc¡A ¶i¦æ¤@¨â­Ó patch ¤u§@¡A
³oºØ±¡ªp¤U¡A RPM ¯à°÷Åý±z¶È°w¹ï¬Y¤@¥­¥x¬[ºc¡A ±Ä¥Î¥²­nªº patch¡C

¦b¤W­z½d¨Ò¤¤¡A fileutils ¦³­Ó´£¨Ñµ¹ 64 bit ¾÷¾¹¨Ï¥Îªº patch¡A
«Ü©úÅã¦a¡A ³o¶µ patch ¶È»Ý­n¥Ñ Alpha ¾÷¾¹©Ò±Ä¥Î¡A ¦]¦¹¡A
§Ú­Ì°w¹ï 64 bit ªº patch ³¡¥÷¡A ¼W¥[¤@­Ó {\ttfamily \%ifarch} ªº macro
³]©w¶µ¥Ø¡A ¨ä½d¨Ò¦p¤U¡G

\begin{tscreen}
\begin{verbatim}
%ifarch axp
%patch1 -p1
%endif
\end{verbatim}
\end{tscreen}

³o¼Ë¯à«OÃÒ¡A °£¤F Alpha ¾÷¾¹¤§¥~¡A ¨ä¥L¥­¥x¬[ºcªº¾÷¾¹¨Ã¤£·|±Ä¥Î¦¹ patch¡C




\subsection{Excluding Architectures from Packages}

±z¥i¥H¦b¤@­Ó¥Ø¿ý¤º¡A ¦P®ÉºÞ²z¦U¦¡§@·~¥­¥xªº RPM ­ì©lÀÉ®×¡A
³o¶µ¥\¯à¨Ï±o§Ú­Ì¦b»s§@µ{¦¡®M¥óªº®É­Ô¡A ¤£¥²­­©w©ó¬Y¨Ç§@·~¥­¥x¤W¡C
¦]¦¹±z¥i¥H³o¼Ë¤U«ü¥O¡G
\begin{tscreen}
\begin{verbatim}
rpm --rebuild /usr/src/SRPMS/*.rpm
\end{verbatim}
\end{tscreen}

¨Ï±o¥¿½Tªºµ{¦¡®M¥ó¯à°÷³Q build¡C
¦pªG±z©|¥¼²¾´Ó¬Y­ÓÀ³¥Îµ{¦¡¦Ü¬Y¤@¯S©wªº§@·~¥­¥x¡A
¥i¥H¥[¤W³o¼Ëªº¤@¦æ¤º®e¡G
\begin{tscreen}
\begin{verbatim}
ExcludeArch: axp
\end{verbatim}
\end{tscreen}

¨ì source µ{¦¡®M¥ó·í¤¤¡A spec ÀÉ®×ªº header ³B¡A
µM«á¦b­ì¥»¶i¦æ build ªº§@·~¥­¥x¤W¡A ¦A°µ¤@¦¸ rebuild °Ê§@¡C
¦¹®É¡A ±z´N¦³¤F¤@¥÷¦b Intel ¾÷¾¹¤W build §¹¦¨ªº source µ{¦¡®M¥ó¡A
¦P®É¥¦¤]«Ü®e©ö«K¯à²¾Þù¦Ü Alpha ¾÷¾¹¤W¡C




\subsection{Finishing Up}

¨Ï¥Î RPM ¨Ó»s§@¡u¦h§@·~¥­¥x¡vªºµ{¦¡®M¥ó¡A ³q±`·|¤ñ¦U§O¦b¸Ó¥­¥x»s§@¨Ó±o®e©ö¡A
¦Ó¥BÀHµÛ±z»s§@¶V¦hªºµ{¦¡®M¥ó¡A ¨ä®ÄÀ³·|§ó¥[©úÅã¡A ¦]¬°¡A
§Ú­Ì¥i¥H°Ñ¦Ò¨ä¥LÃþ¦üªº­ì©lµ{¦¡®M¥ó¤º®e¡A ±o¥H³B²z»s§@®É¹J¨ìªº°ÝÃD¡C




\section{Copyright Notice}

¥»»¡©ú¤å¥ó¤Î¨ä¤º®e¡A §¡¨üª©Åv©Ò«OÅ@¡A ¦b­ì¤å«O«ù§¹¾ã¡B ¥¼³Q§ó°Êªº±¡ªp¤U¡A
¤¹³\±N¨äÂà¸ü¡A ¤]´N¬O»¡¡A ±z¶È¯à¹ï­ì¤å¥[¥H­«·s±Æª©¡B ­«·s¦C¦L¡B ©Î¶i¦æÂà¿ý¡C





\end{document}
