Professional Documents
Culture Documents
Mac Ports
Mac Ports
2008.04.24
Agenda
• MacPortsとは何か
• インストール方法と使い方
• Portfileの作り方
• プロジェクトへの参加方法
MacPortsとは何か
http://www.macports.org/
MacPorts is an easy to use system for compiling,
installing, and managing open source software.
オープンソースソフトウェアを
コンパイルしてインストールできるシステム
Similar to ...
http://www.finkproject.org/
Similar to ...
http://www.freebsd.org/ports/
Number of Packages
MacPorts 4,675
Flink 8,461
※2008.04.23時点
History
2002 - DarwinPorts
http://darwinports.com/
Part of OpenDarwin
Project
http://web.archive.org/web/20070507105243/http://
www.opendarwin.org/
2006 - Update
DarwinPorts
MacPorts
インストール方法
1. XCode Tools をインストールする
ADCに登録が必要
2. MacPorts Download Directoryから
MacPorts-1.x.x.dmgをダウンロード
3. MacPorts-1.x.x.pkgをインストール
4. portsツリーを最新にする
% sudo port -d selfupdate
% sudo port -d sync
使い方
/opt/local/bin/port
% sudo /opt/local/bin/port -h
Usage: port
[-bcdfiknopqRstuvx]
[-D portdir] [-F cmdfile] action
[privopts] [actionflags]
[[portname|pseudo-portname|port-url]
[@version] [+-variant]... [option=value]...]...
よく使うコマンド
• リポジトリを最新にする
% sudo /opt/local/bin/port <-d> selfupdate
• Leopard(10.5)の場合、zshが古いのでzsh-devel
を使う
• インストールされているportをすべてアップ
デートする
• emacsだけアップデートする
• contents: インストールされているportに
含まれているファイル一覧を表示する
• installed: インストールされているportを
表示する
• outdated: アップデートされているportを
表示する
• upgrade: portをアップグレードする
• dependents: インストールされているport
の依存関係を表示する
• livecheck: 開発者のサイトでアップデー
トされているか調べる
• activate: portを使えるように設定する(複
数のバージョンをインストールすると
きに使う)
Port Variants
• インストールオプションを表示する
% sudo /opt/local/bin/port variants postfix
• インストールオプションを明示的には
ずす
portarchivemode yes
• バイナリパッケージを作る
% sudo /opt/local/bin/port <-d> archive
port_name
/opt/local/var/macports/packages/darwin/
i386/zsh-4.2.7_0.i386.tgz
Portfileの作り方
• TCLスクリプトでPortFileを書く
Portfileの例(抜粋)
% cat /opt/local/var/macports/sources/rsync.macports.org/release/
ports/sysutils/screen/Portfile
# $Id $
PortSystem 1.0
name screen
version 4.0.3
homepage http://www.gnu.org/software/screen/
description Screen manager with VT100/ANSI terminal emulation
long_description Screen is a full-screen window manager that multiplexes a physical \
terminal between several processes (typically interactive shells). \
Each virtual terminal provides the functions of a DEC VT100 terminal \
and, in addition, several control functions from the ANSI X3.64 (ISO \
6429) and ISO 2022 standards (e.g. insert/delete line and support for \
multiple character sets). There is a scrollback history buffer for each \
virtual terminal and a copy-and-paste mechanism that allows moving text \
regions between windows.
categories sysutils
platforms darwin
maintainers digdog@macports.org
master_sites http://fresh.t-systems-sfr.com/unix/src/misc/ \
ftp://ftp.uni-erlangen.de/pub/utilities/screen/ \
http://www.cis.nctu.edu.tw/~is85005/dports/screen/:encoding
• Subversion IDのタグ
# $Id$
• Portfileの最初の行に書くおまじない
PortSystem 1.0
• Port名
name foo
• バージョン
version 1.23.45
• リビジョン
revision 1
• オプションキーワード(バージョンを区
別するときに使われる)
epoch 20080424
• 所属するカテゴリ
categories net security
• メンテナー
maintainers naoya cocoitiban
• 説明文
description A classic hoge program
• 詳しい説明文
long_description A long description ...
• ホームページ
homepage http://www.example.com/foo
• プラットフォーム
platforms darwin freebsd
Global Variants
prefix インストール場所
binpath 実行ファイルを探すパス
libpath TCLライブラリのパス
portpath PortFileのフルパス
filesdir ファイルディレクトリの相対パス
workpath 作業ディレクトリのパス
worksrcpath ソースコードを展開するフルパス
destroot ソフトウェアの配布パス
distpath ソフトウェアのダウンロードパス
install.user インストールユーザ
install.group インストールグループ
プラットフォームの
os.platform
識別子
os.arch ハードウェアの種類
os.version OSのバージョン
os.endian プロセッサのエンディアン
os.major OSのメジャーバージョン
x11prefix X11への相対パス
Installation Phases
1 fetch ソースコードのダウンロード
2 checksum チェックサム
3 extract ソースコードを展開
4 patch パッチをあてる
5 configure configureを実行
6 build makeを実行
7 test portに付属しているテストを実行
8 destroot make installを実行
9 archive バイナリアーカイブを作る
10 install インストールされた配布ファイルをコピーする
11 activate ハードリンクを作成する
さっそく作ってみる
• ローカルPortfileリポジトリを準備する
% sudo emacs /opt/local/etc/macports/sources.conf
file:///Users/Shared/macports
rsync://rsync.macports.org/release/ports/
• ディレクトリを作る
% cd /Users/Shared
% mkdir -p ports/misc/bat
% cd ports/misc/bat
• Portfileを作る
# $Id$
PortSystem 1.0
name bat
version 0.0.1
categories misc
maintainers bto
description bat
long_description bat
homepage http://labs.unoh.net/2006/10/global_standard_programming_wi.html
html
platforms darwin
master_sites http://labs.unoh.net/misc/autotools
% sudo /opt/local/bin/portindex
% ls
PortIndex misc/
• Portをインストーしてみる
% sudo /opt/local/bin/port search bat
• Type
defect: ビルドに失敗する問題など
enhancement: パッチがあるとき
• Full Description
{{{ 詳しい説明 }}}
• Priority
High / Normal / Low / Not set
• Component
base / guide / ports / server / website / wiki
• Keywords
チケットを検索するときのキーワード
• Cc
チケットを切った人とメンテナの連絡先
macports-tickets@lists.macosforge.org,
maintainer@example.com
• Milestone
Port Bugs など
• Version
対象のMacPortバージョン
• Assign To
アサインする人
新しいportを追加
• チケットを切る
• Typeをenhancementにする
• MilestoneをPort Submissionsにする
• PortFileをチケットに添付する
• コミット権限がほしいときは、PortMgr
チームにメールする
• PortMgr Team
James D. Berry
Markus W. Weissman
Thank you!