Freebsd Porter 手冊
Total Page:16
File Type:pdf, Size:1020Kb
FreeBSD Porter 手冊 The FreeBSD Documentation Project FreeBSD Porter 手冊 由 修訂: 1b0aa22683 2016-03-29 01:37:53 +0000 由 Kevin Lo. 版權 © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 The FreeBSD Documentation Project 版權所有 Redistribution and use in source (XML DocBook) and 'compiled' forms (XML, HTML, PDF, PostScript, RTF and so forth) with or without modication, are permitted provided that the following conditions are met: 1. Redistributions of source code (XML DocBook) must retain the above copyright notice, this list of conditions and the following disclaimer as the rst lines of this le unmodied. 2. Redistributions in compiled form (transformed to other DTDs, converted to PDF, PostScript, RTF and other formats) must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 重要 THIS DOCUMENTATION IS PROVIDED BY THE FREEBSD DOCUMENTATION PROJECT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD DOCUMENTATION PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. FreeBSD 是 FreeBSD 基金會的註冊商標。 UNIX 是 The Open Group 在美國和其他國家的註冊商標。 Sun, Sun Microsystems, Java, Java Virtual Machine, JDK, JRE, JSP, JVM, Netra, OpenJDK, Solaris, StarOce, SunOS 和 VirtualBox 是 Sun Microsystems, Inc. 在美國和其他國家的註冊商標。 Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this document, and the FreeBSD Project was aware of the trademark claim, the designations have been followed by the “™” or the “®” symbol. ii 內容目錄 1. 楔子 ...................................................................................................................................... 1 2. 製作新的 Port ......................................................................................................................... 3 3. 打造 Port 快速上手篇 .............................................................................................................. 5 3.1. 編寫 Makefile ........................................................................................................... 5 3.2. 撰寫說明檔 .................................................................................................................. 6 3.3. 產生 checksum 檔 ......................................................................................................... 7 3.4. 測試 Port ..................................................................................................................... 8 3.5. 以 portlint 來作檢查 Port ............................................................................................. 8 3.6. 提交新的 Port .............................................................................................................. 8 4. Slow Porting .......................................................................................................................... 11 4.1. How Things Work ......................................................................................................... 11 4.2. 取得原始碼 ................................................................................................................ 12 4.3. Modifying the Port ....................................................................................................... 12 4.4. Patching ..................................................................................................................... 13 4.5. 設定 .......................................................................................................................... 15 4.6. 處理使用者輸入 .......................................................................................................... 15 5. 設定 Makele ........................................................................................................................ 17 5.1. The Original Source ...................................................................................................... 17 5.2. 命名 .......................................................................................................................... 17 5.3. 分類 .......................................................................................................................... 22 5.4. The Distribution Files .................................................................................................... 27 5.5. MAINTAINER ................................................................................................................ 41 5.6. COMMENT ..................................................................................................................... 42 5.7. PORTSCOUT .................................................................................................................. 42 5.8. 相依性 ....................................................................................................................... 42 5.9. MASTERDIR .................................................................................................................. 48 5.10. Man Pages ................................................................................................................. 49 5.11. Info Files ................................................................................................................... 49 5.12. Makele Options ......................................................................................................... 49 5.13. Specifying the Working Directory ................................................................................... 62 5.14. Conict Handling ........................................................................................................ 62 5.15. Installing Files ............................................................................................................ 63 6. Special Considerations ............................................................................................................. 67 6.1. Staging ...................................................................................................................... 67 6.2. Bundled Libraries ......................................................................................................... 67 6.3. 共用函式庫 ................................................................................................................ 69 6.4. Ports with Distribution Restrictions or Legal Concerns .......................................................... 69 6.5. Building Mechanisms .................................................................................................... 71 6.6. 使用 GNU Autotools ..................................................................................................... 73 6.7. 使用 GNU gettext ....................................................................................................... 74 6.8. 使用 Perl .................................................................................................................... 75 6.9. 使用 X11 .................................................................................................................... 77 6.10. 使用 GNOME ............................................................................................................. 79 6.11. GNOME 元件 ............................................................................................................. 81 6.12. 使用 Qt .................................................................................................................... 84 6.13. 使用 KDE .................................................................................................................. 87 6.14. 使用 Java .................................................................................................................. 88 6.15. 網路應用程式, Apache 和 PHP ..................................................................................... 91 6.16. 使用 Python .............................................................................................................. 94 6.17. 使用 Tcl/Tk ............................................................................................................... 95 6.18. 使用 Emacs ............................................................................................................... 95 6.19. 使用 Ruby ................................................................................................................. 96 6.20. 使用 SDL .................................................................................................................. 96 6.21. 使用 wxWidgets ......................................................................................................... 97 6.22. 使用 Lua ................................................................................................................. 102 6.23. 使用 iconv .............................................................................................................. 103 內容目錄 6.24. 使用 Xfce ...............................................................................................................