66
Naoya NAKAZAWA 2008.04.24

Mac Ports

Embed Size (px)

DESCRIPTION

About Mac Ports (Japanese).

Citation preview

Page 1: Mac Ports

Naoya NAKAZAWA2008.04.24

Page 2: Mac Ports

Agenda

• MacPortsとは何か

• インストール方法と使い方

• Portfileの作り方

• プロジェクトへの参加方法

Page 3: Mac Ports

MacPortsとは何か

Page 5: Mac Ports

MacPorts is an easy to use system for compiling, installing, and managing open source software.

オープンソースソフトウェアをコンパイルしてインストールできるシステム

Page 8: Mac Ports

Number of Packages

MacPorts 4,675

Flink 8,461

FreeBSD Ports 18,361

※2008.04.23時点

Page 9: Mac Ports

History

Page 12: Mac Ports

2006 - Update

DarwinPorts

MacPorts

Page 13: Mac Ports

インストール方法

Page 14: Mac Ports

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

Page 15: Mac Ports

使い方

Page 16: Mac Ports

/opt/local/bin/port

% sudo /opt/local/bin/port -hUsage: port [-bcdfiknopqRstuvx] [-D portdir] [-F cmdfile] action [privopts] [actionflags] [[portname|pseudo-portname|port-url] [@version] [+-variant]... [option=value]...]...

Page 17: Mac Ports

よく使うコマンド

Page 18: Mac Ports

• リポジトリを最新にする

% sudo /opt/local/bin/port <-d> selfupdate

% sudo /opt/local/bin/port <-d> sync

Page 19: Mac Ports

• portをインストールする

% sudo /opt/local/bin/port <-v> install foo

% sudo /opt/local/bin/port install zsh-devel screen emacs

• Leopard(10.5)の場合、zshが古いのでzsh-devel

を使う

Page 20: Mac Ports

• インストールされているportをすべてアップデートする

% sudo /opt/local/bin/port upgrade outdated

• emacsだけアップデートする

% sudo /opt/local/bin/port upgrade emacs

Page 21: Mac Ports

その他のオプション

Page 22: Mac Ports

• selfupdate: リポジトリと同期する

• sync: 新しいportだけ取得する

• list: 利用可能なportを一覧表示する

• search: port名から部分一致検索する

Page 23: Mac Ports

• info: port情報を表示する

• deps: 依存しているportを表示する

• variants: インストールするときに利用可能なオプションを表示する

Page 24: Mac Ports

• install: portをインストールする

• clean: 中間ファイルを削除する

• uninstall: portをアンインストールする

% sudo /opt/local/bin/port uninstall <port_name> @version

• contents: インストールされているportに含まれているファイル一覧を表示する

Page 25: Mac Ports

• installed: インストールされているportを表示する

• outdated: アップデートされているportを表示する

• upgrade: portをアップグレードする

Page 26: Mac Ports

• dependents: インストールされているport

の依存関係を表示する

• livecheck: 開発者のサイトでアップデートされているか調べる

• activate: portを使えるように設定する(複数のバージョンをインストールするときに使う)

Page 27: Mac Ports

Port Variants

Page 28: Mac Ports

• インストールオプションを表示する

% sudo /opt/local/bin/port variants postfix

postfix has the variants: universal pcre: add pcre support tls: add tls supporti via openssl sasl: add sasl support via cyrus-sasl2

Page 29: Mac Ports

• インストールオプションを指定する

% sudo /opt/local/bin/port <-v> postfix +sasl

• インストールオプションを明示的にはずす

% sudo /opt/local/bin/port <-v> postfix -sasl

Page 30: Mac Ports

Binary Archives

Page 31: Mac Ports

• アーカイブモードを有効にする

/opt/local/etc/macports/macports.conf

portarchivemode yes

Page 32: Mac Ports

• バイナリパッケージを作る

% sudo /opt/local/bin/port <-d> archive port_name

% sudo /opt/local/bin/port <-d> archive zsh

/opt/local/var/macports/packages/darwin/i386/zsh-4.2.7_0.i386.tgz

Page 33: Mac Ports

Portfileの作り方

Page 34: Mac Ports

• TCLスクリプトでPortFileを書く

Page 35: Mac Ports

Portfileの例(抜粋)

% cat /opt/local/var/macports/sources/rsync.macports.org/release/ports/sysutils/screen/Portfile

Page 36: Mac Ports

# $Id $

PortSystem 1.0

name screenversion 4.0.3homepage http://www.gnu.org/software/screen/description Screen manager with VT100/ANSI terminal emulationlong_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 sysutilsplatforms darwinmaintainers [email protected]_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

Page 37: Mac Ports

• Subversion IDのタグ

# $Id$

• Portfileの最初の行に書くおまじない

PortSystem 1.0

• Port名

name foo

Page 38: Mac Ports

• バージョン

version 1.23.45

• リビジョン

revision 1

• オプションキーワード(バージョンを区別するときに使われる)

epoch 20080424

Page 39: Mac Ports

• 所属するカテゴリ

categories net security

• メンテナー

maintainers naoya cocoitiban

• 説明文

description A classic hoge program

Page 40: Mac Ports

• 詳しい説明文

long_description A long description ...

• ホームページ

homepage http://www.example.com/foo

• プラットフォーム

platforms darwin freebsd

Page 41: Mac Ports

Global Variants

Page 42: Mac Ports

prefix インストール場所

binpath 実行ファイルを探すパス

libpath TCLライブラリのパス

portpath PortFileのフルパス

filesdir ファイルディレクトリの相対パス

workpath 作業ディレクトリのパス

worksrcpath ソースコードを展開するフルパス

destroot ソフトウェアの配布パス

distpath ソフトウェアのダウンロードパス

Page 43: Mac Ports

install.user インストールユーザ

install.group インストールグループ

os.platformプラットフォームの

識別子

os.arch ハードウェアの種類

os.version OSのバージョン

os.endian プロセッサのエンディアン

os.major OSのメジャーバージョン

x11prefix X11への相対パス

Page 44: Mac Ports

Installation Phases

Page 45: Mac Ports

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 ハードリンクを作成する

Page 46: Mac Ports

さっそく作ってみる

Page 47: Mac Ports

• ローカルPortfileリポジトリを準備する

% sudo emacs /opt/local/etc/macports/sources.conf

file:///Users/Shared/macports

rsync://rsync.macports.org/release/ports/

Page 48: Mac Ports

• ディレクトリを作る

% cd /Users/Shared

% mkdir -p ports/misc/bat

% cd ports/misc/bat

Page 49: Mac Ports

• Portfileを作る# $Id$

PortSystem 1.0

name batversion 0.0.1categories miscmaintainers btodescription batlong_description bathomepage http://labs.unoh.net/2006/10/global_standard_programming_wi.htmlhtmlplatforms darwinmaster_sites http://labs.unoh.net/misc/autotools

checksums md5 dd15d8257a84d8d9cc4edadf5dec4b4a \ sha1 67d95834dff4776175798d03553e3574c4fd2e61 \ rmd160 41c93ce881e62563b210f29131f5ae011c81a652

Page 50: Mac Ports

• checksumを計算する

% md5 bat-0.0.1.tar.gz

% openssl sha1 bat-0.0.1.tar.gz

% openssl rmd160 bat-0.0.1.tar.gz

Page 51: Mac Ports

• Portインデックスを更新する

% cd /Users/Shared/ports

% sudo /opt/local/bin/portindex

% ls

PortIndex misc/

Page 52: Mac Ports

• Portをインストーしてみる

% sudo /opt/local/bin/port search bat

bat misc/bat 0.0.1 bat

% sudo /opt/local/bin/port bat install

---> Unpacking tgz archive for bat 0.0.1_0---> Installing bat 0.0.1_0---> Activating bat 0.0.1_0---> Cleaning bat

Page 53: Mac Ports

プロジェクトへの参加方法

Page 54: Mac Ports

MacOS forgeTrac + Wordpress

Page 56: Mac Ports

Tracでチケットを切る

Page 57: Mac Ports

決まり事

Page 58: Mac Ports

• Summary

BUG: <port_name> 簡単な説明

• Type

defect: ビルドに失敗する問題など

enhancement: パッチがあるとき

Page 59: Mac Ports

• Full Description

{{{ 詳しい説明 }}}

• Priority

High / Normal / Low / Not set

• Component

base / guide / ports / server / website / wiki

Page 60: Mac Ports

• Keywords

チケットを検索するときのキーワード

• Cc

チケットを切った人とメンテナの連絡先

[email protected],[email protected]

Page 61: Mac Ports

• Milestone

Port Bugs など

• Version

対象のMacPortバージョン

• Assign To

アサインする人

Page 62: Mac Ports

新しいportを追加

Page 63: Mac Ports

• チケットを切る

• Typeをenhancementにする

• MilestoneをPort Submissionsにする

• PortFileをチケットに添付する

Page 64: Mac Ports

• コミット権限がほしいときは、PortMgr

チームにメールする

Page 65: Mac Ports

• PortMgr Team

James D. Berry

Juan Manuel Palacios

Markus W. Weissman

Page 66: Mac Ports

Thank you!