¦b Linux ¤U«Ø¥ß³nÅé®M¥ó §@ªÌ: [1]Mendel Leo Cooper [2]http://personal.riverusers.com/~thegrendel/ ĶªÌ: [3]J.S.Lin v1.52, 27 December 1997 _________________________________________________________________ ³o¬O¥÷¼sªx«ü¤Þ¤å¥ó,¥i¥Î¨Ó«Ø¥ß"¤@¯ë©Ê" UNIX ³nÅéµo¦æ®M¥ó¦b Linux ¤U. _________________________________________________________________ 1. ²¤¶ 2. ±q¨ú±o¶}©l 3. ¨Ï¥Î Make 4. §JªA§xÃø * 4.1 ³sµ²¿ù»~ * 4.2 ¨ä¥¦°ÝÃD * 4.3 ±Û§á»P·L½Õ * 4.4 ¥h­þ¨ú±o¶i¤@¨Bªº¨ó§U 5. ³Ì«á¨BÆJ 6. ²Ä¤@­Ó¨Ò¤l: Xscrabble 7. ²Ä¤G­Ó¨Ò¤l: Xloadimage 8. ²Ä¤T­Ó¨Ò¤l: Fortune 9. ­þùØ¥i§ä¨ì­ì©l½XÀÉ®× 10. µ²»y 11. °Ñ¦Ò»P¶i¤@¨B¾\Ū¸ê®Æ _________________________________________________________________ 1. ²¤¶ «Ü¦h³nÅé®M¥ó´£¨Ñµ¹¦U¦¡ UNIX, ¥]¬A Linux, ¬O±N­ì©l½XÀÉ®×À£ÁY¦¨ÀÉ ®×(archives)¦Óµo¦æªº. ¬Û¦Pªº®M¥ó¥i¥H«Ø¥ß¥H«K¦b¤£¦P¹ï¶Hªº¾÷¾¹¤W°õ¦æ, ¨Ã ¥B³o¥i¸`¬Ù¨Ç³nÅ馨«~¦Ó§K©ó¥²¶·»s³y¦UºØµo¦æª©¥». ³nÅé®M¥óªº³æ¤@µo¦æª©¥» µ²ªG¯à°õ¦æ¦b¦U¦¡¹êÅé(incarnations), ¹³¬O¦b Intel ¾÷¾¹, DEC Alpha, RISC ¤u§@¯¸, ¬Æ¦Ü¬O¹qºâ¥D¾÷. ¦ý¤£©¯ªº¬O, ³o±N"«Ø¥ß"³nÅ骺¤u§@±Àµ¹¤F³Ì²×¨Ï¥Î ªÌ(end user), ¹ê»Ú¤W¬O"¨t²ÎºÞ²zªÌ", §Y§¤¦bÁä½L«eªº¦P§Ó...§A. ÁöµM³o¼Ë, »{¯u¨Ó»¡³o¹Lµ{¨Ã¤£¬O¹³¥¦¬Ý°_¨Ó¨º»ò¥i©È©Î¤£¥i«äij, ´N¹³³o«ü¤Þ©Ò¸Ñ»¡¤@ ¼Ë. 2. ±q¨ú±o¶}©l §A¦³¤U¸ü©Î¨ä¥¦¤è¦¡¨ú±o¤@­Ó³nÅé®M¥ó. ³Ì±`¨£±¡ªp¬O¥¦³Q¥´¥]°_¨Ó (tarred) ¦Ó¥B³QÀ£ÁY (gzipped), ¦¨¬° .tar.gz ©Î .tgz §Î¦¡. ­º¥ý±N¥¦½Æ»s¨ì¤@¤u§@¥Ø ¿ý. µM«á¥Î untar ©M gunzip ³B²z¥¦. ³B²z¥¦³Ì¾A¦Xªº©R¥O¬O tar xzvf filename, ³oùتº filename ·íµM¬O³nÅéÀɦW. ³oºØ¸Ñ¶}µ{§Ç±`±`·|¦w¸Ë¾A·íÀÉ ®×¦b¥¦©Ò¶}±Òªº¤l¥Ø¿ý¤¤. ª`·Nªº¬O¦pªG®M¥ó¦WºÙ¦³ .Z µ²§À, ¨º±N­n¨Ï¥Î uncompress PACKAGENAME, µM«á¦A¥Î tar xvf PACKAGENAME ¦Ó¤£­n¥Î¤§«eªº¨B ÆJ. ¦³®É¥´¥]°_¨ÓªºÀÉ®×¥²¶· untarred ¥B¦w¸Ë¦Û¨Ï¥ÎªÌªº®a¥Ø¿ý(home directory), ©ÎªÌ¤]³\¬O¦b¬Y­Ó¨ä¥¦¥Ø¿ý, ¹³¬O®M¥ó³]©w¸ê®Æ©Ò«ü©wªº. °²­Y§A ³]ªk­n untar ¥¦¦Ó±o¨ìªº¬O¿ù»~°T®§, ¤]³\´N¬O¨º­ì¦]. Ū¤@¤U®M¥ó¤å¥ó, ¯S§O ¬O README ©M/©Î Install ÀÉ®×, ¦pªG¦s¦b, ½s¿è³]©wÀɮשM/©Î Makefiles ¦p ©Ò»Ý­nªº, §Y»P¦w¸Ë«ü¥Ü²Å¦X. ª`·Nªº¬O³q±` ¤£ ¥h§ó§ï Imake ÀÉ®×, ¦]¬°³o¥i ¯à¦³¥¼¹w´Áªºµ²ªG. ¬Y¨Ç³nÅé®M¥ó¤¹³\¦Û°Ê¦w¸Ëµ{§Ç,¥¦¬OÂǥѰõ¦æ make install ¨Ó©ñ¸m¤G¤¸½X¦b¾A·í¨t²Î¦ì¸m. °¸¦Ó, §A¥i¯à»Ý­n¨Ï¥Î patchÀÉ®×,¸ÓÀɮצ³¦C¥X­ì¥»ªº»P·sªº­ì©lÀɮתº®t²§, ¨Ó¤É¯Å©Î¥[¤J¯äÂÎ(bug)ªº­×¥¿¦Ü¥¼¥´¥](unarchived)ªº­ì©lÀÉ®×. docÀÉ®×»P/©Î README ÀÉ®×·|§iª¾§A³oºâ¤£ºâ¸Ó±¡ªp. ¹ï©ó¨Ï¥Î Larry Wall ªº±j¤O ­× ¸É(patch) ¤u¨ã¤§¥¿±`ªº»yªk(syntax)¬O patch < patchfile. §A²{¦b¥i¥H¶}©l¶i¦æ «Ø¥ß ¹Lµ{¶¥¬q¤F. 3. ¨Ï¥Î Make Makefile ¬O«Ø¥ß¹Lµ{ªº­«ÂI. ¦b¥¦ªº³Ì²³æªº§Î¦¡, Makefile ´N¬O­Ó script ,¥¦¬O¥Î¨Ó½sĶ©Î«Ø¥ß"¤G¤¸½X",®M¥óªº¥i°õ¦æ³¡¤À. Makefile¤]¥i¥H´£¨Ñ³nÅé®M ¥ó¤É¯Åªº¤u¨ã,¦Ó¤£»Ý­n­«·s½sĶ¨C¤@­Ó¦b®M¥ó¤¤ªº­ì©lÀÉ®×, ¦ý¨ä¦³¤£¦Pªº±¡ ªp(©Î¬O¤£¦Pªº¬ù©w). ¬Y¨Ç¯SÂI¬O, Makefile ¶}±Ò cc ©Î gcc. ³o¹ê»Ú¤W¬O­Ó«e³B²z¾¹, C (or C++) ½sĶ¾¹, ©M ³sµ²¾¹, «ö·Ó¨º­Ó¶¶§Ç. ³o¹Lµ{Âà´«­ì©l½X(source)¬°¥i¯u¥¿¥h°õ¦æ ªº¤G¤¸½X(binaries). ¤U«ü¥O make ³q±`¥u­nÁä¤J make. ³o³q±`«Ø¥ß°Q½×¤¤ªº®M¥ó©Ò¦³»Ý­nªº¥i°õ¦æ ÀÉ. µM¦Ó, make ¤]°µ¨ä¥L¤u§@,¹³¬O¦w¸ËÀɮצܦX¾Aªº¥Ø¿ý (make install) ¦Ó ¥B§R°£Âªº object ÀÉ®× (make clean). °õ¦æ make -n ¤¹³\¹wÄý«Ø¥ß¹Lµ{, ´N ¬O¦C¥X©Ò¦³ make ©Ò³ê°_ªº(triggered)©Ò¦³©R¥O, ¦ý¨S¦³¯uªº¥h°õ¦æ¥¦­Ì. ¥u¦³¦b³Ì²³æªº³nÅé¨Ï¥Î¤@¯ë©Êªº Makefile. ¸û½ÆÂøªº¦w¸Ë»Ý­n®Ú¾Ú¨ç¦¡ ®w(libraries), include ÀÉ®×¥H¤Î§A­Ó§O¾÷¾¹¸ê·½©Ò¦b¥Ø¿ý¨Ó¶q¨­©w»s. ³o¯S§O ¬O·í»Ý­n X11 libraries ¨Ó¦w¸Ë«Ø¥ß®É. Imake ©M xmkmf ¥i§¹¦¨³o¼Ëªº¤u§@. ¤Þ¥Î¦Û man page,Imakefile ¬O­Ó"¼ÒªO(template)"ªº Makefile. imake ¤u¨ã°Ñ ¦Ò Imakefile ®Ú¾Ú§Aªº¨t²Î³y¥X¦X¾Aªº Makefile. µM¦Ó,´X¥G¦b©Ò¦³ªº±¡ªp¤U, §A­n°õ¦æ xmkmf, ¥¦¬O­n¤U imake «ü¥O¥Îªº shell script, ¤]´N¬O­Ó«eºÝ¤¶ ­±(front end). ¹î¾\¤@¤U¤ºªþ¦b³nÅéÀɮ׶¡ªº README ©Î INSTALL ÀÉ®×¥H¨ú±o ¯S§Oªº«ü¥Ü. ¦Ü©ó§ó¸Ô²Óªº¨BÆJ¤ÀªR,½Ð¾\Ū imake ©M xmkmf ªº man pages. ­nª¾¹Dªº¬O xmkmf ©M make ¥i¯à»Ý­n¥H root ¨­¤À¨Ó¤U«ü¥O, ¯S§O¬O·í make install ¨Ó·h²¾¤G¤¸½X¨ì /usr/bin ©Î /usr/local/bin ¥Ø¿ý. ¥H¤@¯ë¨Ï¥ÎªÌªº ¨­¤À¦Ó¤£¨ã root Åv¤O ¨Ó¨Ï¥Î make ±N¥i¯à·|¾É­P write access denied ªº¿ù »~°T®§, ¦]¬°§A¯Ê¤Ö¼g¤J(write)¦Ü¨t²Î¥Ø¿ýªºÅv­­. ¤]Àˬd¤@¤U, ©Ò³y¥X¨Óªº¤G ¤¸½X¹ï§A»P¥ô¦ó¨ä¥L¾A¥Îªº¨Ï¥ÎªÌ¦³¾A¦Xªº°õ¦æ(execute)Åv­­. ¤U«ü¥O xmkmf ¨Ó¨Ï¥Î Imake ÀÉ®×, «Ø¥ß¤@­Ó·sªº¦Ó¥B¾A¦X§A¨t²Îªº Makefile. ¥¿±`¦a¤U«ü¥O xmkmf ³£·|ªþ¥[ -a ¤Þ¼Æ, ¦]¦Ó¦Û°Ê¦a°µ make Makefiles, make includes, ©M make depend ªº°Ê§@. ³o·|³]©wÅܼÆ(variables)©Mµ¹©w¨ç¦¡ ®w(library) ¦ì¸mµ¹½sĶ¾¹©M³sµ²¾¹. ¦³®É·|¨S¦³ Imake ÀÉ®×, ¤Þ¦Ó¥N¤§ªº¬O¦³ INSTALL ©M configure ªº script, ¤]·|¨ì³o¼Ëªº¥Øªº. ª`·Nªº¬O¦pªG§A­n°õ¦æ configure, ¨º­n¤U«ü¥O ./configure ¥H½T«O¦b¥Ø«e¥Ø¿ý¤U¥¿½Tªº script configure ¬O³Q©I¥s. ¦b¤j³¡¤Àªº±¡ªp, ¦bµo¦æ®M¥ó¤¤ªº README ÀÉ®×·|»¡©ú¦w ¸Ë¨BÆJ. ³q±`¤@­Ó¦nªº¤èªk¬O±q¥~Æ[À˵ø¤@¤U Makefile ¬O xmkmf ©Î ¨ä¤¤¤@­Ó¦w¸Ëªº scripts ©Ò³y¥X¨Óªº. Makefile ¥¿±`¤U·|¬°§Aªº¨t²Î¦Ó­×¥¿, ¦ý§A°¸¦Ó¥i¯à»Ý ­n"±Û§á(tweak)"©Î¤â°Ê¦a­×¥¿¿ù»~. §Aªº¤@¯ë¦w¸Ë¨BÆJ±N·|¬O: * Ū¤@¤U README ÀɮשM¨ä¥¦¦X¥Îªº¤å¥ó. * °õ¦æ xmkmf -a, ÁÙ¬O INSTALL ©Î configure script. * Àˬd¤@¤U Makefile. * ¦pªG»Ý­n, °õ¦æ¤@¤U make clean, make Makefiles, make includes, and make depend. * °õ¦æ make. * Àˬd¤@¤UÅv­­. * ¦pªG»Ý­n, °õ¦æ¤@¤U make install. 4. §JªA§xÃø ¦pªG¥Î xmkmf ©M/©Î make «Ü¦¨¥\¨S¦³¿ù»~, §A¥i¥HµÛ¤â©ó [4]next section. µM¦Ó, ¦b¯u¹ê¥Í¬¡, «Ü¤Ö¨Æ±¡¦b²Ä¤@¦¸´N¥¿½Tªº¤u§@. ³o´N¬O·í§Aªº¾÷´¼Â×´I ®É,­n«i©ó¹Á¸Õ. 4.1 ³sµ²¿ù»~ * ¦pªG make ¥¢±Ñ¦Ó¥X²{¦³ Link error: -lX11: No such file or directory, ¬Æ¦Ü¬O¦b¨Ï¥Î xmkmf «á. ³o¥i¯à·N¨ýµÛ Imake ÀɮרS¦³¾A·í¦a ¸Ë¦n. Àˬd Makefile ªº²Ä¤@³¡¤À¦³¨S¦³¹³³o¼Ëªº´X¦æ: LIB= -L/usr/X11/lib INCLUDE= -I/usr/X11/include/X11 LIBS= -lX11 -lc -lm -L ©M -I ¤Á´«¾¹(switches)·|³q§i½sĶ¾¹©M³sµ²¾¹¤À§O¥h­þùØ´M§ä library ©M include ÀÉ®×. ¦b³o¨Ò¤l, X11 libraries À³¸Ó¬O¦b /usr/X11/lib ¥Ø¿ý, ¦Ó X11 include ÀÉ®× À³¸Ó¬O¦b /usr/X11/include/X11¥Ø¿ý. ¦pªG³o¦b§Aªº¾÷¾¹¤W¬O¤£¹ïªº, ¥²¶·§ïÅÜ Makefile ¦Ó¥B¦A¸Õ¸Õ make. * ¦b«D±`¤Öªº±¡ªp, ¥H root ¨­¤À¶]¤@¤U ldconfig ¤]³\¬O­Óµª®×: # /etc/ldconfig -n /lib ±N·|§ó·s¦@¨É¦¡¨ç¦¡®w²Å¸¹³sµ² (shared library symbolic links). ³o¦b¥¿±`ªº±¡§Î¤U¤£¬O»Ý­nªº. * ¥Ø«e¥t¤@¥ó¨Æ¬O¦pªG xmkmf ¥¢±Ñ, «h¸Õ¸Õ¤U¦C script: make -DUseInstalled -I/usr/X386/lib/X11/config * ¦³®É­ì©l½X»Ý­n¨Ï¥Îª©ªº X11R5 libraries ¨Ó«Ø¥ß. ¦pªG§A¦³ R5 libs ¦b /usr/X11R6/lib (·í§A­º¥ý¦b¦w¸Ë Linux ®É, §A¬O¦³¿ï¾Ü¬O§_¦w¸Ë¥¦­Ì ªº), µM«á§A¥u»Ý­n½T©w,§A¦³³sµ²¨ì³nÅé©Ò»Ý­n«Ø¥ßªº¦a¤è. R5 libs ¬O¦³ libX11.so.3.1.0, libXaw.so.3.1.0, ©M libXt.so.3.1.0. ¤@¯ë§A»Ý­n³sµ² ¦Ü, ¹³¬O libX11.so.3 -> libX11.so.3.1.0. ¤j·§³nÅé¤]»Ý­n³o­Ó§Î¦¡³sµ² libX11.so -> libX11.so.3.1.0. ·íµM, ­n±N³o"Â_±¼(missing)"ªº³sµ²«Ø ¦n, ­n¥H root ¨­¤À¨Ï¥Î³o«ü¥O ln -s libX11.so.3.1.0 libX11.so. * ¬Y¨Ç®M¥ó·|­n¨D§A¥h¦w¸Ë¤@­Ó©Î¥H¤Wªº¤É¯Åª©¥». Á|¨Ò¦Ó¨¥, StarDivision GmbH ªº StarOffice ²Õ¥ó(suite)¬O´c¦W¬L¹ü(notorious)ªº­n¨D libc version 5.4.4 ©Î§ó·s. ¥H root¨­¤À, §A»Ý­n½Æ»s¤@­Ó©Î¥H¤Wªº¨ç¦¡ ®w(libraries)¦Ü¦X¾Aªº¥Ø¿ý, §R¥hªº¨ç¦¡®w(libraries),µM«á­«³]²Å¸¹³s µ². ¤p¤ß: ¦b³o­n®æ¥~ª`·N, ¦]¬°¦pªG§A§ËÁV, §A¥i¯à·|¥I¥X§Aªº¨t²Î¤£¯à ¹B§@ªº¥N»ù. §A³q±`¥i¥H§ä¨ì¤É¯Åªº¨ç¦¡®w(libraries)¦b [5]Sunsite. 4.2 ¨ä¥¦°ÝÃD * ¦b¦w¸Ë¦nªº Perl ©Î shell script µ¹§A¤@­Ó No such file or directory ¿ù»~°T®§. ¦b³o±¡ªp,ÀˬdÀÉ®×Åv­­¨Ó½T©wÀÉ®×¥i°õ¦æ ¥H¤ÎÀˬdÀÉ®×¼ÐÀY¬O §_§t¦³¨Ï¥Î shell ©Îµ{¦¡, «ü©ú script ©Ò¦b¦a¤è. Á|¨Ò¦Ó¨¥, script ¶} ©l¦p: #!/usr/local/bin/perl ¦pªG Perl ¹ê»Ú¸Ë¦b§Aªº /usr/bin ¥Ø¿ý, ¦Ó¤£¬O /usr/local/bin ¥Ø¿ý, ¨º»ò script µLªk°õ¦æ. ¦³¨â­Ó¤èªk¨Ó­×§ï. script ÀÉ®×¼ÐÀY§ï¦¨ #!/usr/bin/perl, ©Î¥Î²Å¸¹³sµ²¦Ü¥¿½Tªº¥Ø¿ý, ln -s /usr/bin/perl /usr/local/bin/perl. * ¬Y¨Ç X11 ³nÅé­n¨D¦³ Motif ¨ç¦¡®w(libraries)¤~¯à«Ø¥ß. ¦Ó¼Ð·Çªº Linux µo¦æ®M¥ó¨Ã¨S¦³¦w¸Ë Motif libraries, ¦Ó¥B¥Ø«e Motif ÁÙ­nÃB¥~ $100-$200 ªºªá¶O (ÁöµM§K¶O³nÅé [6]Lesstif ¦b¬Y¨Ç³õ¦X¤]¯à°÷¥Î). ¦pªG §A»Ý­n Motif ¨Ó«Ø¥ß¬Y¤@®M¥ó, ¦ý¯Ê¤Ö Motif libraries, ¨º»ò¤]³\¥i¥H¨ú ±o ÀRºA³sµ²ªº¤G¤¸½X(statically linked binaries). ÀRºA³sµ²¦b¤G¤¸½X¥» ¨­¯Ç¤J¨ç¦¡®w¦æµ{(library routines). ³o³y¦¨¤G¤¸½XÀɮפj¤F³\¦h, ¦ý¬O ½X¥i¦b¯Ê¤Ö¸Ó¨ç¦¡®wªº¨t²Î¤W°õ¦æ. * °õ¦æ configure script ·|³Ð³y©_©Çªº Makefile, ¨º¹³¬O»P§A©Ò­n³]ªk«Ø¥ß ªº®M¥ó­½¤£¬Û¤z. ³oªí¥Ü¶]µÛ¿ù»~ªº configure, ¨ä§ä¨ì§Aªº path ¤W¬Y³B ¨ä¥Lªº configure. ©Ò¥H­n¤U configure «ü¥O À³¸Ó­n¤U¦¨ ./configure §Y ¥Ø«e¥Ø¿ý¤Uªº. * ¬Y¨Çµ{¦¡·|­n¨D¦³ setuid root, ¬°¤F­n¥H¦³ root Åv¤O ¨Ó°õ¦æ. ­n¹F¦¨³o ¥Ø¿ýªº«ü¥O¬O ¥Hroot ¤U«ü¥O chmod u+s filename. (ª`·Nªº¬O³oµ{¦¡¤w¸g ¬O root ©Ò¾Ö¦³¤F). ³o¦b³]©wÀÉ®×Åv­­¤¤ªº setuid bit «Ü¦³¥Î. ³o¼Ë¥Î¦b ·íµ{¦¡¦b¦s¨ú¨t²ÎµwÅé,¹³¬O modem ©Î CD ROM drive, ©Î·í SVGA libs ³Q ¨Ï¦b©ó¥D±±¥x¼Ò¦¡(console mode), ¹³¬O¦b¤@­Ó¯S§O´c¦W¬L¹ü ªº(notorious)¼ÒÀÀ¾¹(emulation)®M¥ó. ¦pªGµ{¦¡¥¿³Q root °õ¦æ, ¦ýµ¹¤@ ¯ë¨Ï¥ÎªÌ¤@­Ó access denied ªº¿ù»~°T®§, ·Q¹³´N¬O³o¼Ë³y¦¨ªº. ĵ§i: ¤@­Ó¦³ setuid ¦¨ root ªºµ{¦¡¥i¯à´£¥X¹ï§Aªº¨t²Î¦³¦w¥þ¤Wªº­· ÀI. ³o­Óµ{¦¡¥i¥H root Åv¤O¨Ó¶]¦Ó©Ò¥H¦³¬Y¨Ç¯}®`ªº¼ç¦b©Ê. ¦b³]©w setuid bit «e, ½T©w§Aª¾¹D¸Óµ{¦¡¦b°µ¤°»ò, ¥²­n®É¬Ý¤@¤U­ì©l½X. 4.3 ±Û§á»P·L½Õ §A¥i¯à§Æ±æÀˬd Makefile ¨Ó½T©w¦³¿ï¥Î¹ï§A¨t²Î³Ì¨Î½sĶ¿ï¶µ. Á|¨Ò¨Ó»¡, ³] ©w -O2 ºX¼Ð¨Ó¿ï³Ì°ª¼h¯Åªº³Ì¨Î¤Æ¦Ó -fomit-frame-pointer ºX¼Ð¨Ó³y³Ì¤p¤G¤¸ ½X (ÁöµM debugging ·|¨S¦³¥´¶}). °£«D§Aª¾¹D§A¦b°µ¤°»ò, ¦Ó¥B¦b¥ô¦ó±¡ªp ¤U, °£«DÁ}­W«Ø¥ßªº¤u§@¤w§¹¦¨, §_«h¤£­nª±³o¨Ç. 4.4 ¥h­þ¨ú±o¶i¤@¨Bªº¨ó§U ¦b§Úªº¸gÅç, ¤j·§25%ªºÀ³¥Îµ{¦¡«Ø¥ß"§¹¥þ¨S¦³§xÃø". ¥t¥~¤j¬ù50%¯à"³Q»¡ªA" ªº«Ø¥ß, ­n¥I¥X§V¤Oªº½d³ò±qµL²á¨ì·¥¬°§xÃø. ¨º¤´µMªí¥Ü¦³¬Y¨Ç®M¥óµL½×¦p¦ó ³£µLªk«Ø¥ß. §Y¨Ï¨º¼Ë, ¨º¨Ç Intel ELF ©M/©Î a.out ¤G¤¸½X, ¤]¥i¯à¦b [7]Sunsite, [8]TSX-11 archive ©Î¨ä¥¦¦a¤è§ä¨ì. ¤]³\, ³nÅ骺³Ð³yªÌ¥i¥H´£ ¨Ñ½sĶ¦nªº¤G¤¸½Xµ¹§Aªº¯S§Oªº¾÷¾¹¨Ï¥Î. ª`·Nªº¬O¦pªG§A¨ú±o¹w¥ý½sĶ¦nªº¤G¤¸½X, §A·|»Ý­nÀˬd¬O§_»P§Aªº¨t²Î¬Û®e: * ³o¤G¤¸½X¥²¶·¦b§Aªº µwÅé¤W¶] (i.e., Intel x86). * ³o¤G¤¸½X¥²¶·»P§Aªº®Ö¤ß(kernel)¬Û®e (i.e., a.out ©Î ELF). * §Aªº¨ç¦¡®w(libraries)¥²¶·¬O³Ì·sªº. ¦pªG¥þ³£¥¢±Ñ, §A¥i¥H¦b¦X¾Aªº ·s»D¸s²Õ´M¨DÀ°¦£, ¹³¬O¦b [9]comp.os.linux.x ©Î [10]comp.os.linux.development. ¸U¤@§A¥u¬O¤£°÷©¯¹B ªº¸Ü, ¼K, ¸Õ¸Õ¤]¬O¦³½ìªº. 5. ³Ì«á¨BÆJ Ū¤@¤U³nÅé®M¥óªº¤å¥ó¨Ó¨M©w¬O§_¦³¬Y¨ÇÀô¹ÒÅܼƻݭn³] (¦b .bashrc ©Î .cshrc) ¥H¤Î ¬O§_ .Xdefaults ©M .Xresources Àɮ׻ݭn½Õ¾ã. ¥i¯à¦³­ÓÀ³¥Îµ{¦¡¤º©wªºÀÉ®×, ³q±`¥s°µ Xfoo.ad ¦b­ì¥»ªº Xfoo µo¦æ®M¥ó. ¦p ªG³o¼Ë, ½s¿è Xfoo.ad ÀÉ®×¾A¦X§Aªº¾÷¾¹, µM«á­«·s©R¦W (mv) ¦¨ Xfoo ¦Ó¥B ¥H root ¨­¤À ¦w¸Ë¥¦¨ì /usr/lib/X11/app-defaults ¥Ø¿ý, ¨S³o¼Ë°µ¥i¯à·|³y ¦¨³nÅé¦æ¬°«Ü©_©Ç, ¬Æ¦Ü©Úµ´°õ¦æ. ¤j¦h¼Æªº³nÅé®M¥óªþ¦³¤@­Ó©Î¥H¤Wªº®æ¦¡¤Æ man pages. ¥H root ¨­¤À, ½Æ»s Xfoo.man Àɮרì¦X¾Aªº /usr/man ¥Ø¿ý (man1 - man9), ¦Ó®Ú¾Ú¨º¦A­«·s©R¦W. Á|¨Ò¦Ó¨¥, ¦pªG Xfoo.man µ²ªG¬O¦b /usr/man/man4, ¨ºÀ³¸Ó©R¦W¬° Xfoo.4 (mv Xfoo.man Xfoo.4). ®Ú¾Ú¤@¯ë¬ù©w¨Ï¥ÎªÌªº©R¥OÂ\¦b man1, ¹CÀ¸¬O¦b man6, ¦ÓºÞ²zªº®M¥ó¬O¦b man8 (¬Ý¤@¤U man ¤å¥ó ¥H¨ú±o§ó¸Ô²Ó¸ê®Æ).·íµM,¦b §A¨t²Î§A¥i¥H¤£·Ó³o­Ó¬ù©w, ¥u­n§A³ßÅw. ¬Y¨Ç®M¥ó¤£·|¦w¸Ë¤G¤¸½X(binaries)¦b¦X¾Aªº¨t²Î¥Ø¿ý, ´«¥y¸Ü»¡, ¥L­Ì¨S¦³ install ¿ï¶µ¦b Makefile ¤¤. ¦pªG¬O³o±¡ªp, §A¥i¥H¥Î root ¨­¤À½Æ»s¤G¤¸ ½X(binaries)¨ì usr/local/bin ¥Ø¿ý¨Ó¤â°Ê¦w¸Ë¤G¤¸½X(binaries). ª`·Nªº¬O¬Y¨Ç©Î¥þ³¡¤W­z¨BÆJ,¦b¤j³¡¤À±¡§Î¤U,À³¸Ó·|¥Ñ make install ¨Ó¦Û°Ê ¾Þ§@. ¦pªG¬O³o¼Ë, README ©Î INSTALL ¤å¥óÀÉ·|´£¨ì³o­Ó. 6. ²Ä¤@­Ó¨Ò¤l: Xscrabble Matt Chapmanªº Xscrabble ¦ü¥G¹³¬O­Ó»á¦³½ìªºµ{¦¡, ¦]¬°§Ú´¿¬O­Ó³g°ýªº Scrabble™(«÷¦r¹CÀ¸)ª±®a.§Ú¤U¸ü¤U,¸ÑÀ£, ¦Ó¥B«Ø¥ß¥¦¥H README Àɮפ¤ ªº¤U¦C¨BÆJ: xmkmf make Makefiles make includes make ·íµM¥¦¤£¯à¥¿±`¹B§@... _________________________________________________________________ gcc -o xscrab -O2 -O -L/usr/X11R6/lib init.o xinit.o misc.o moves.o cmove.o main.o xutils.o mess.o popup.o widgets.o display.o user.o CircPerc.o -lXaw -lXmu -lXExExt -lXext -lX11 -lXt -lSM -lICE -lXExExt -lXext -lX11 -lXpm -L../Xc -lXc BarGraf.o(.text+0xe7): undefined reference to `XtAddConverter' BarGraf.o(.text+0x29a): undefined reference to `XSetClipMask' BarGraf.o(.text+0x2ff): undefined reference to `XSetClipRectangles' BarGraf.o(.text+0x375): undefined reference to `XDrawString' BarGraf.o(.text+0x3e7): undefined reference to `XDrawLine' etc. etc. etc... _________________________________________________________________ §Ú¦b [11]comp.os.linux.x ªº·s»D¸s²Õ¸ß°Ý¹L, ¦Ó¥B¦³¨Ç¤H¦n¤ßªº«ü¥X¦ü¥G Xt, Xaw, Xmu, ©M X11 libs ¨S¦³Åý³sµ²¾¹(linker)§ä±o¨ì. ¶â... ¦³¨â­Ó¥D­nªº Makefiles, ¦Ó¥B¦b src ¥Ø¿ý¤Uªº¨º­ÓÅý§Ú·P¿³½ì. ¦b Makefile ¤@¦æ¦³©w¸q LOCAL_LIBS ¦¨: LOCAL_LIBS = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) ³o©Ò«üªº libs ¨Ã¨S¦³³Q³sµ²¾¹§ä¨ì. §ä§ä¤U­Ó«ü¨ì LOCAL_LIBS ªº¦a¤è, §Ú¬Ý¨ì¸Ó¦b Makerfile ªº495¦æ: $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBS) $(LDLIBS) $(EXTRA_LOAD_FLAGS) ¦Ó²{¦b LDLIBS ¬O¤°»ò©O? LDLIBS = $(LDPOSTLIB) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) SYS_LIBRARIES ¬O: SYS_LIBRARIES = -lXpm -L../Xc -lXc ¬O­Ó! ´N¬O³o¼Ë¿ò¥¢ libraries. ¤j·§³sµ²¾¹»Ý­n¦b LOCAL_LIBS ¤§«e¬Ý¨ì LDLIBS... ©Ò¥H, ²Ä¤@¥ó¨Æ­n¹Á¸Õ¥h­× §ï Makefile ´N¬O§ï¼g¦b495¦æªº $(LOCAL_LIBS) ©M $(LDLIBS) , ©Ò¥H¥¦²{¦bÅÜ ¦¨: $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LDLIBS) $(LOCAL_LIBS) $(EXTRA_LOAD_FLAGS) ^^^^^^^^^^^^^^^^^^^^^^^ ¦b¤W­±ªº§ï«á,§Ú¸ÕµÛ¦A¦¸°õ¦æ make , Á@, ¥¦³o¦¸¥i¥¿±`¶]¤F. ·íµM, Xscrabble ¤´µM»Ý­n¤@¨Ç·L½Õ(fine tuning]»Pª±§Ë(twiddling), ¹³¬O­«·s©R¦W ¦r¨å¥H¤Î¼Ðµù¬Y¨Ç»²§Uªº±Ô­z¦b­ì©l½XÀɮפ§¤@, ¦ý¥¿¦]¬°¨º¼Ë,¥¦¤wµ¹§Ú¦n´X­Ó ¤p®Éªº®ø»º. §A¥i¥H±H e-mail [12]Matt Chapman, ¦Ó¥B±q¥Lªº [13]home page ¤U¸ü Xscrabble. _________________________________________________________________ Scrabble ¬O Milton Bradley Co., Inc. ªºµù¥U°Ó¼Ð. _________________________________________________________________ 7. ²Ä¤G­Ó¨Ò¤l: Xloadimage ³o­Ó¨Ò¤l´£¥X¸û²³æªº°ÝÃD. xloadimage µ{¦¡¥[¤J¨ì§Úªº¹Ï§Î¤u§@²Õ¦ü¥G¬O«Ü¦³ ¥Î. §Ú±q¤@¥»¥Ñ Mui ©M Quercia ©ÒµÛªº¦n®Ñ [14]X User Tools ©Òªþªº CD ¤W ªº­ì©l½X¥Ø¿ý(source directory), ª½±µ½Æ»s xloadi41.gz ÀɮפU¨Ó. ¦p¹w´Á ªº, ¥Î tar xzvf ¸Ñ¶}©Ò¦³ÀÉ®×. µM¦Ó, make ¥X²{¤F¥O¤H°Q¹½ªº¿ù»~¦Ó¥B¤¤Â_. _________________________________________________________________ gcc -c -O -fstrength-reduce -finline-functions -fforce-mem -fforce-addr -DSYSV -I/usr/X11R6/include -DSYSPATHFILE=\"/usr/lib/X11/Xloadimage\" mcidas.c In file included from /usr/include/stdlib.h:32, from image.h:23, from xloadimage.h:15, from mcidas.c:7: /usr/lib/gcc-lib/i486-linux/2.6.3/include/stddef.h:215: conflicting types for `wchar_t' /usr/X11R6/include/X11/Xlib.h:74: previous declaration of `wchar_t' make[1]: *** [mcidas.o] Error 1 make[1]: Leaving directory `/home/thegrendel/tst/xloadimage.4.1' make: *** [default] Error 2 _________________________________________________________________ ³o¿ù»~°T®§§t¦³³Ì®Ú¥»ªº½u¯Á. ¬Ý¤@¤UÀÉ®× image.h ªº23¦æ. _________________________________________________________________ #include _________________________________________________________________ °Ú«¢! ¦b xloadimage, wchar_t ­ì©l½Xªº¬Y³B¤w¸g­«½Æ©w¸q¤F¦b¼Ð·Ç include ÀÉ®× stdlib.h ¤w©w¸qªºªF¦è. ­º¥ý¸Õ¸Õ±N¦b image.h ªº23¦æ¼Ðµù(commenting out)°_¨Ó, ¤]³\ stdlib.h include ¬O¤£¤j»Ý­nªº. ¦¹®É, build ¹Lµ{¨S¦³¥ô¦ó­«¤j¿ù»~. xloadimage µ{¦¡²{¦b¥\¯à³£¥¿±`. 8. ²Ä¤T­Ó¨Ò¤l: Fortune ³Ì«á¨Ò¤l»Ý­n¬Y¨Ç C µ{¦¡³]­pª¾ÃÑ. ¤j³¡¤Àªº Linux ³nÅé¬O¥Î C ¼gªº, ¦Ó¥B¦Ü ¤Ö¾ÇÂI C ©úÅ㪺¹ï¥ô¦ó·Q³nÅé¦w¸Ëªº¤H·|¦³§U¯q. ´c¦W¬L¹üªº(notorious) fortune µ{¦¡¦b¨C¦¸ Linux ¶}¾÷°_¨Ó®É¨q¥X«ÕÀqªº¿Î»y "fortune cookie". ¤£©¯¦a (¦³ÂùÃö·N«äªº), ³]ªk¦b Red Hat µo¦æ®M¥ó 2.0.30 ªº®Ö¤ß¤U«Ø¥ß,¥X²{¤F ¤@°ïÄY­«ªº¿ù»~. _________________________________________________________________ ~/fortune# make all gcc -O2 -Wall -fomit-frame-pointer -pipe -c fortune.c -o fortune.o fortune.c: In function `add_dir': fortune.c:551: structure has no member named `d_namlen' fortune.c:553: structure has no member named `d_namlen' make[1]: *** [fortune.o] Error 1 make[1]: Leaving directory `/home/thegrendel/for/fortune/fortune' make: *** [fortune-bin] Error 2 _________________________________________________________________ ¬Ý¤@¤U fortune.c, ¦³ÃöÁpªº´X¦æ¦b³o. _________________________________________________________________ if (dirent->d_namlen == 0) continue; name = copy(dirent->d_name, dirent->d_namlen); _________________________________________________________________ §Ú­Ì»Ý­n§ä¥X dirent ªº structure, ¦ý¥¦¨S¦³«Å§i(declared)¦b fortune.c ÀÉ ®×¤¤, ·Q¥Î grep dirent ¨Ó¨q¥X¬O§_¦b¨ä¥¦­ì©l½XªºÀɮפ¤, ¦ý¤]¨S¦³. µM¦Ó, ¦b fortune.c Àɪº³Ì¤W¤è¦³¤U¦C³o¦æ. _________________________________________________________________ #include _________________________________________________________________ ³o¦ü¥G¬O¨t²Î¨ç¦¡®wªº include ÀÉ®×, ©Ò¥H­n§ä dirent.h ªº¦X²z¦ì¸m¬O¦b /usr/include. ¨Æ¹ê¤W, dirent.h ªº½T¦³¦b /usr/include ¤¤, ¦ý¸ÓÀɨS¦³¥]§t dirent ªº structure. µM¦Ó, °Ñ¦Ò¥t¤@­Ó dirent.h ÀÉ. _________________________________________________________________ #include _________________________________________________________________ ³Ì«á, ¥h /usr/include/linux/dirent.h, §Ú­Ì¥i§ä¨ì§Ú­Ì©Ò»Ý­n«Å§iªº structure. _________________________________________________________________ struct dirent { long d_ino; __kernel_off_t d_off; unsigned short d_reclen; char d_name[256]; /* We must not include limits.h! */ }; _________________________________________________________________ ¨¬°÷¦a½T©w, ³o­Ó structure «Å§i¨S¦³¥]§t d_namelen, ¦ý¦³¤@¹ï»P¨ä¬Û·íªº¿ï ¾Ü. ¨ä¤¤³Ì¥i¯àªº¬O d_reclen, ¦]¬° ³o­Ó structure member ªí¥Ü¬Y¼ËªF¦èªº length ¦Ó¥B¥¦¬O short integer. ¨ä¥L¤j²¤, d_ino, ¥i¯à¬O inode number, §P Â_¥¦ªº name ©M type. ¨Æ¹ê¤W, §Ú­Ì¤j·§¬O³B²z "directory entry" structure, ¦Ó¤¸¯Àªí¥ÜÀÉ®×ÄÝ©Ê, ¥¦ªº¦WºÙ, inode, ©M length (¥H blocks §@ ³æ¦ì). ³o¦ü¥G¹ï§Ú­Ìªº²q·Q«Ü¦X²z. §Ú­Ì½s¿èÀÉ®× fortune.c, ¦Ó¥B§ïÅܦb551¦æ©M553¦æªº d_namelen Åܦ¨ d_reclen. ¦A¸Õ¸Õ make all. Success. ³o¦¸«Ø¥ß¨S¦³¿ù»~. §Ú­Ì²{¦b¯à°÷±q fortune Àò±o "cheap thrills" 9. ­þùØ¥i§ä¨ì­ì©l½XÀÉ®× ²{¦b§A«Ü´÷±æªº¨Ï¥Î§A³Ì·sÀò±oªºª¾ÃѨӥ[¤J¤@¨Ç¤u¨ã©M¨ä¥¦¦nªF¦è¨ì§Aªº¨t ²Î, §A¥i¥H¦b½u¤W§ä¨ì¥¦­Ì, [15]Linux Applications and Utilities Page, ©Î ªÌ¦b«Ü¦X²z»ù¦ìªº CD ROM ªºÀÉ®×, ÂÇ¥Ñ [16]Red Hat, [17]InfoMagic, ¥H¤Î¨ä ¥¦ªº. ¤@­Ó²³¦h­ì©l½XªºÄ_®w¬O¦b [18]comp sources UNIX archive. «Ü¦h UNIX ­ì©l½Xµoªí¦b [19]alt.sources ·s»D¸s²Õ. ¦pªG§A­n§ä¯S§Oªº­ì©l½X ¥]¸Ëªº, §A¥i¥H¶K¦b¬ÛÃöªº [20]alt.sources.wanted ·s»D¸s²Õ. ¥t¥~¤@­Ó¤£¿ù ªº¦a¤è¬O¬d¬Ý [21]comp.os.linux.announce ·s»D¸s²Õ. ­n¨ú±o¦b [22]Unix sources ªº³q«H½×¾Â, ½Ð±H­Ó subscribe °T®§¨ì¨º. ¦Ü©ó [23]alt.sources ·s»D¸s²ÕªºÀɮ׬O¦b¤U­± ftp ¯¸: * [24]ftp.sterling.com/usenet/alt.sources/ * [25]wuarchive.wustl.edu/usenet/alt.sources/articles * [26]src.doc.ic.ac.uk/usenet/alt.sources/articles 10. µ²»y Á`µ², ¦Ê§é¤£¼¸·|¨Ï¤°»ò³£Åܦ¨¤£¤@¼Ë (¦Ó¥B°ªÃø«×®À§éªùÂe©úÅã·|¦³À°§U). ¨Ï ¥X¥þ¤O,±q¥¢±Ñ¤¤Àò±o¾Ç²ß§ó¬O­«­n. ¦b¨C­Ó¹L¥¢ªº¨B¥ï, ¨C­Ó¥¢±Ñ³y´N¤F¯à°÷´x ´¤ «Ø¥ß³nÅéÃÀ³N ªºª¾ÃÑ­ÓÅé. 11. °Ñ¦Ò»P¶i¤@¨B¾\Ū¸ê®Æ BORLAND C++ TOOLS AND UTILITIES GUIDE, Borland International, 1992, pp. 9-42. [Borland C++, ver. 3.1. ªºµo¦æ¤â¥U¤§¤@. µ¹¤F«Ü¦n¤¶²Ð¦b»yªk©M·§©À¤W, ¨Ï¥Î Borland ¦b DOS ¤U´Ý¾lªº¹ê§@.] DuBois, Paul: SOFTWARE PORTABILITY WITH IMAKE, O'Reilly and Associates, 1996, ISBN 1-56592-226-3. [³o¾Ú»¡¬O§¹¾ãªº imake °Ñ¦Ò¸ê®Æ, ÁöµM§Ú¦b¼g¥»¤å®É,ÁÙ¥¼¨ú±o.] Frisch, Aeleen: ESSENTIAL SYSTEM ADMINISTRATION, O'Reilly and Associates, 1995, ISBN 1-56592-127-5. [³o¬O¨ä¥¦¨ô¶Vªº¨t²ÎºÞ²z¤â¥U¤w¸g¦³·§²¤¼h­±ªº½Í¨ì«Ø¥ß³nÅé.] Lehey, Greg: PORTING UNIX SOFTWARE, O'Reilly and Associates, 1995, ISBN 1-56592-126-7. Mui, Linda ©M Valerie Quercia: X USER TOOLS, O'Reilly and Associates, 1994, ISBN 1-56592-019-8, pp. 734-760. Oram, Andrew ©M Steve Talbott: MANAGING PROJECTS WITH MAKE, O'Reilly and Associates, 1991, ISBN 0-937175-90-0. Peek, Jerry ©M Tim O'Reilly »P Mike Loukides: UNIX POWER TOOLS, O'Reilly and Associates / Random House, 1997, ISBN 1-56592-260-3. [«Ü´Îªº·§©À¨Ó·½, ¦Ó¥B¦³¤j¶q¨Ï¥Î¤u¨ã§A¥i¯à±q­ì©l½X¨Ó«Ø¥ß, ¨Ï¥Î¦b¥»¤å¤¤°Q½×ªº¤èªk.] Stallman, Richard M. ©M Roland McGrath: GNU MAKE, Free Software Foundation, 1995, ISBN 1-882114-78-7. [À³¸Ó¬O»Ý­n¾\Ūªº.] Welsh, Matt ©M Lar Kaufman: RUNNING LINUX, O'Reilly and Associates, 1996, ISBN 1-56592-151-8. [¤´µM¬O¥þ³¡ Linux °Ñ¦Ò¸ê®Æ³Ì¦nªº, ÁöµM¦b¬Y¨Ç¦a¤è¯Ê¤Ö¤ñ¸û²`¤J°Q½×.] ·íµMÁÙ¦³ make, imake, xmkmf, gcc, ldconfig, gzip, tar, ©M patch ªº man pages. References 1. mailto:thegrendel@theriver.com 2. http://personal.riverusers.com/~thegrendel/ 3. mailto:r6921068@ms.cc.ntu.edu.tw 4. file://localhost/tmp/zh-sgmltools.10754/Software-Building-HOWTO.txt.html#finalsteps 5. ftp://sunsite.unc.edu/ 6. http://www.lesstif.org/ 7. ftp://sunsite.unc.edu/ 8. ftp://tsx-11.mit.edu/ 9. news://comp.os.linux.x/ 10. news://comp.os.linux.development/ 11. news://comp.os.linux.x/ 12. mailto:matt@belgarath.demon.co.uk 13. http://www.belgarath.demon.co.uk/programs/index.html 14. file://localhost/tmp/zh-sgmltools.10754/Software-Building-HOWTO.txt.html#refs 15. http://www.redhat.com/linux-info/linux-app-list/linapps.html 16. http://www.redhat.com/ 17. mailto:orders@infomagic.com 18. ftp://ftp.vix.com/pub/usenet/comp.sources.unix/ 19. news://alt.sources/ 20. news://alt.sources.wanted/ 21. news://comp.os.linux.announce/ 22. mailto:unix-sources@pa.dec.com 23. news://alt.sources/ 24. ftp://ftp.sterling.com/usenet/alt.sources/ 25. ftp://wuarchive.wustl.edu/usenet/alt.sources/articles 26. ftp://src.doc.ic.ac.uk/usenet/alt.sources/articles