「ノンフリーアプリケーションパッケージガイドライン」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
 
1行目: 1行目:
  +
[[Category:パッケージ開発]]
#redirect[[en:Nonfree applications package guidelines]]
 
  +
[[en:Nonfree applications package guidelines]]
  +
{{Package Guidelines}}
  +
  +
アプリケーションによっては (特に Windows のアプリケーション) ソースや tarball が手に入らない場合があります。そのようなアプリケーションの多くはライセンスの制約があったり、あるいは無料で合法的にインストーラーを取得する方法が存在せず、自由に再配布することができません。当然それらのソフトウェアを[[公式リポジトリ]]に入れることはできませんが、[[AUR]] であれば私的にソフトウェアの[[makepkg|パッケージをビルド]]して [[pacman]] で管理するということが不可能ではありません。
  +
{{Note|この記事に書かれている情報はパッケージに依存しません。一般的なフリーではないソフトウェアに関する情報は [[Wine パッケージガイドライン]]を見てください。}}
  +
  +
== 根拠 ==
  +
パッケージになっていないソフトウェアもパッケージ化する理由は複数あります:
  +
* インストールやアンインストールの平易化
  +
:This is applicable even to the simplest of apps, which consist of a single script to be installed into {{Ic|/usr/bin}}. Instead of issuing:
  +
:{{bc|$ chmod +x ''filename''}}
  +
:{{bc|# cp ''filename'' /usr/bin/}}
  +
:you can type just
  +
:{{bc|# makepkg -i}}
  +
:Most non-free applications are obviously much more complicated, but the burden of downloading an archive/installer from a homepage (often full of advertising), unpacking/decrypting it, hand-writing stereotypical launcher scripts and doing other similar tasks can be effectively lightened by a well-written packaging script.
  +
* pacman の機能の利用
  +
:The ability to track state, perform automatic updates of any installed piece of software, determine ownership of every single file, and store compressed packages in a well-organized cache is what makes GNU/Linux distributions so powerful.
  +
* コードや知識の共有
  +
:It is simpler to apply tweaks, fix bugs and seek/provide help in a single public place like AUR versus submitting patches to proprietary developers who may have ceased support or asking vague questions on general purpose forums.
  +
  +
== 一般的なルール ==
  +
=== 可能なかぎりフリーでないソフトウェアは避ける ===
  +
このガイドは脇に置いて、パッケージ化したいアプリケーションの代わりとなるアプリケーションが存在しないか検索 (あるいは作成) するのに時間を費やしたほうが有益です:
  +
# フリーでないソフトウェアのパッケージングは面倒であり大抵 [[The Arch Way]] に反しています
  +
# It is better to support software that is owned by us all than software that is owned by a company
  +
# It is better to support software that is actively maintained
  +
# It is better to support software that can be fixed if just one person out of millions cares enough
  +
  +
=== 可能なかぎりオープンソースのソフトウェアを使う ===
  +
多くの商用ゲーム ([[ゲーム一覧]]) はオープンソースのエンジンを使っており古いゲームの多くは [[Wikipedia:ScummVM|ScummVM]] などのエミュレータで遊ぶことができます。オープンソースエンジンとオリジナルのゲームアセットを使うことで、バイナリパッケージによる問題を回避したりバグを解決することが可能です。
  +
  +
=== Keep it simple ===
  +
If the packaging of some program requires more effort and hacks than buying and using the original version - do the simplest thing, it is Arch!
  +
  +
== パッケージの命名 ==
  +
Before choosing a name on your own, search in AUR for existing versions of the software you want to package. Try to use established naming conversion (e.g. do not create something like {{AUR|gish-hb}}{{Broken package link|{{aur-mirror|gish-hb}}}} when there are already {{AUR|aquaria-hib}}, {{AUR|penumbra-overture-hib}} and {{AUR|uplink-hib}}). Use suffix {{Ic|-bin}} '''always''' unless you are sure there will never be a source-based package—its creator would have to ask you (or in worst case TUs) to orphan existing package for him and you both will end up with PKGBUILDs cluttered with additional {{Ic|replaces}} and {{Ic|conflicts}}.
  +
  +
== ファイルの置き場所 ==
  +
Again, analyze existing packages (if present) and decide whether or not you want to conflict with them. Do not place things under {{Ic|/opt}} unless you want to use some ugly hacks like giving ownership {{Ic|root:games}} to the package directory (so users in group {{Ic|games}} running the game can write files in the game's own folder).
  +
  +
== 欠けているファイル ==
  +
For most commercial games there is no way to (legally) download game files, which is the preferable way to get them for normal packages. Even when it is possible to download files after providing a password (like with all [[Wikipedia:Humble Indie Bundle|Humble Indie Bundle]] games) asking user for this password and downloading somewhere in {{Ic|build}} function is not recommended for a variety of reasons (for example, the user may have no Internet access but have all files downloaded and stored locally). The following options should be considered:
  +
  +
* '''There is only one way to obtain files'''
  +
:* Software is distributed in archive/installer
  +
:Add the required file to {{Ic|sources}} array:
  +
:{{Bc|1=sources=(... "''originalname''::'''file://'''''originalname''")}}
  +
:This way the link to file in AUR web interface will look different from names of files included in source tarball.
  +
:Add following comment on package page:
  +
:{{bc|Need archive/installer to work.}}
  +
:and explain the details in PKGBUILD source.
  +
  +
:* Software is distributed on compact-disk
  +
:Add installer script and {{Ic|.install}} file to package contents, like in package {{AUR|tsukihime-en}}{{Broken package link|{{aur-mirror|tsukihime-en}}}}.
  +
  +
* '''There are several ways to obtain files'''
  +
Copying files from disk / downloading from Net / getting from archive during {{Ic|build}} phase may look like a good idea but it is not recommended because it limits the user's possibilities and makes package installation interactive (which is generally discouraged and just annoying). Again, a good installer script and {{Ic|.install}} file can work instead.
  +
  +
Few examples of various strategies for obtaining files required for package:
  +
* {{AUR|worldofgoo}} – dependency on user-provided file
  +
* {{AUR|umineko-en}}{{Broken package link|{{aur-mirror|umineko-en}}}} – combining files from freely available patch and user-provided compact-disk
  +
* {{AUR|worldofgoo-demo}}{{Broken package link|{{aur-mirror|worldofgoo-demo}}}} – autonomic fetching installer during build phase
  +
* {{AUR|ut2004-anthology}}{{Broken package link|{{aur-mirror|ut2004-anthology}}}} – searching for disk via mountpoints
  +
  +
== 高度なトピック ==
  +
=== カスタム DLAGENTS ===
  +
Some software authors aggressively protect their software from automatic downloading: ban certain "User-Agent" strings, create temporary links to files etc. You can still conveniently download this files by using {{Ic|DLAGENTS}} variable in PKGBUILD (see {{Ic|man makepkg.conf}}). This is used by some packages in [[official repositories]], for example {{Pkg|ttf-baekmuk}}.
  +
  +
Following one-liner disguises curl as the most popular browser among novice computer users:
  +
  +
DLAGENTS=("http::/usr/bin/curl -A 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)' -fLC - --retry 3 --retry-delay 3 -o %o %u")
  +
  +
And following allows to extract temporary link to file from download page:
  +
  +
DLAGENTS=("http::/usr/bin/wget -r -np -nd -H %u")
  +
  +
=== 解凍 ===
  +
Many proprietary programs are shipped in nasty installers which sometimes do not even run in Wine. Following tools may be of some help:
  +
* {{Pkg|unzip}} and {{Pkg|unrar}} unpack executable SFX archives, based on this formats
  +
* {{Pkg|cabextract}} can unpack most {{Ic|.cab}} files (including ones with {{Ic|.exe}} extension)
  +
* {{Pkg|unshield}} can extract CAB files from InstallShield installers
  +
* {{Pkg|p7zip}} unpacks not only many archive formats but also [[Wikipedia:NSIS|NSIS]]-based {{Ic|.exe}} installers
  +
** it even can extract single sections from common PE ({{Ic|.exe}} & {{Ic|.dll}}) files!
  +
* {{Pkg|upx}} is sometimes used to encrypt above-listed executables and can be used for decryption as well
  +
* {{AUR|innoextract}} can unpack {{Ic|.exe}} installers created with [[Wikipedia:Inno Setup|Inno Setup]] (used for example by GOG.com games)
  +
In order to determine exact type of file run {{Ic|file ''file_of_unknown_type''}}.
  +
  +
=== .desktop ファイル用のアイコンの取得 ===
  +
Proprietary software often have no separate icon files, so there is nothing to use in [[.desktop]] file creation. Happily {{Ic|.ico}} files can be easily extracted from executables with programs from {{Pkg|icoutils}} package. You can even do it on fly during {{Ic|build}} phase (example can be found in {{AUR|sugarsdelight}}{{Broken package link|{{aur-mirror|sugarsdelight}}}}).

2016年1月20日 (水) 16:29時点における版

アプリケーションによっては (特に Windows のアプリケーション) ソースや tarball が手に入らない場合があります。そのようなアプリケーションの多くはライセンスの制約があったり、あるいは無料で合法的にインストーラーを取得する方法が存在せず、自由に再配布することができません。当然それらのソフトウェアを公式リポジトリに入れることはできませんが、AUR であれば私的にソフトウェアのパッケージをビルドして pacman で管理するということが不可能ではありません。

ノート: この記事に書かれている情報はパッケージに依存しません。一般的なフリーではないソフトウェアに関する情報は Wine パッケージガイドラインを見てください。

根拠

パッケージになっていないソフトウェアもパッケージ化する理由は複数あります:

  • インストールやアンインストールの平易化
This is applicable even to the simplest of apps, which consist of a single script to be installed into /usr/bin. Instead of issuing:
$ chmod +x filename
# cp filename /usr/bin/
you can type just
# makepkg -i
Most non-free applications are obviously much more complicated, but the burden of downloading an archive/installer from a homepage (often full of advertising), unpacking/decrypting it, hand-writing stereotypical launcher scripts and doing other similar tasks can be effectively lightened by a well-written packaging script.
  • pacman の機能の利用
The ability to track state, perform automatic updates of any installed piece of software, determine ownership of every single file, and store compressed packages in a well-organized cache is what makes GNU/Linux distributions so powerful.
  • コードや知識の共有
It is simpler to apply tweaks, fix bugs and seek/provide help in a single public place like AUR versus submitting patches to proprietary developers who may have ceased support or asking vague questions on general purpose forums.

一般的なルール

可能なかぎりフリーでないソフトウェアは避ける

このガイドは脇に置いて、パッケージ化したいアプリケーションの代わりとなるアプリケーションが存在しないか検索 (あるいは作成) するのに時間を費やしたほうが有益です:

  1. フリーでないソフトウェアのパッケージングは面倒であり大抵 The Arch Way に反しています
  2. It is better to support software that is owned by us all than software that is owned by a company
  3. It is better to support software that is actively maintained
  4. It is better to support software that can be fixed if just one person out of millions cares enough

可能なかぎりオープンソースのソフトウェアを使う

多くの商用ゲーム (ゲーム一覧) はオープンソースのエンジンを使っており古いゲームの多くは ScummVM などのエミュレータで遊ぶことができます。オープンソースエンジンとオリジナルのゲームアセットを使うことで、バイナリパッケージによる問題を回避したりバグを解決することが可能です。

Keep it simple

If the packaging of some program requires more effort and hacks than buying and using the original version - do the simplest thing, it is Arch!

パッケージの命名

Before choosing a name on your own, search in AUR for existing versions of the software you want to package. Try to use established naming conversion (e.g. do not create something like gish-hbAUR[リンク切れ: アーカイブ: aur-mirror] when there are already aquaria-hibAUR, penumbra-overture-hibAUR and uplink-hibAUR). Use suffix -bin always unless you are sure there will never be a source-based package—its creator would have to ask you (or in worst case TUs) to orphan existing package for him and you both will end up with PKGBUILDs cluttered with additional replaces and conflicts.

ファイルの置き場所

Again, analyze existing packages (if present) and decide whether or not you want to conflict with them. Do not place things under /opt unless you want to use some ugly hacks like giving ownership root:games to the package directory (so users in group games running the game can write files in the game's own folder).

欠けているファイル

For most commercial games there is no way to (legally) download game files, which is the preferable way to get them for normal packages. Even when it is possible to download files after providing a password (like with all Humble Indie Bundle games) asking user for this password and downloading somewhere in build function is not recommended for a variety of reasons (for example, the user may have no Internet access but have all files downloaded and stored locally). The following options should be considered:

  • There is only one way to obtain files
  • Software is distributed in archive/installer
Add the required file to sources array:
sources=(... "originalname::file://originalname")
This way the link to file in AUR web interface will look different from names of files included in source tarball.
Add following comment on package page:
Need archive/installer to work.
and explain the details in PKGBUILD source.
  • Software is distributed on compact-disk
Add installer script and .install file to package contents, like in package tsukihime-enAUR[リンク切れ: アーカイブ: aur-mirror].
  • There are several ways to obtain files

Copying files from disk / downloading from Net / getting from archive during build phase may look like a good idea but it is not recommended because it limits the user's possibilities and makes package installation interactive (which is generally discouraged and just annoying). Again, a good installer script and .install file can work instead.

Few examples of various strategies for obtaining files required for package:

高度なトピック

カスタム DLAGENTS

Some software authors aggressively protect their software from automatic downloading: ban certain "User-Agent" strings, create temporary links to files etc. You can still conveniently download this files by using DLAGENTS variable in PKGBUILD (see man makepkg.conf). This is used by some packages in official repositories, for example ttf-baekmuk.

Following one-liner disguises curl as the most popular browser among novice computer users:

DLAGENTS=("http::/usr/bin/curl -A 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)' -fLC - --retry 3 --retry-delay 3 -o %o %u")

And following allows to extract temporary link to file from download page:

DLAGENTS=("http::/usr/bin/wget -r -np -nd -H %u")

解凍

Many proprietary programs are shipped in nasty installers which sometimes do not even run in Wine. Following tools may be of some help:

  • unzip and unrar unpack executable SFX archives, based on this formats
  • cabextract can unpack most .cab files (including ones with .exe extension)
  • unshield can extract CAB files from InstallShield installers
  • p7zip unpacks not only many archive formats but also NSIS-based .exe installers
    • it even can extract single sections from common PE (.exe & .dll) files!
  • upx is sometimes used to encrypt above-listed executables and can be used for decryption as well
  • innoextractAUR can unpack .exe installers created with Inno Setup (used for example by GOG.com games)

In order to determine exact type of file run file file_of_unknown_type.

.desktop ファイル用のアイコンの取得

Proprietary software often have no separate icon files, so there is nothing to use in .desktop file creation. Happily .ico files can be easily extracted from executables with programs from icoutils package. You can even do it on fly during build phase (example can be found in sugarsdelightAUR[リンク切れ: アーカイブ: aur-mirror]).