Cygwin の GCC 840 をパッケージ化する » 履歴 » バージョン 2
開発 次郎, 2026/05/16 23:37
| 1 | 1 | 開発 次郎 | h1. Cygwin の GCC 840 をパッケージ化する |
|---|---|---|---|
| 2 | 2 | 開発 次郎 | |
| 3 | h2. cygport をインストール |
||
| 4 | |||
| 5 | <pre><code class="bash"> |
||
| 6 | /setup-x86_64.exe \ |
||
| 7 | --quiet-mode \ |
||
| 8 | --no-desktop \ |
||
| 9 | --no-shortcuts \ |
||
| 10 | --upgrade-also \ |
||
| 11 | --site https://mirrors.kernel.org/sourceware/cygwin/ \ |
||
| 12 | --packages cygport |
||
| 13 | </code></pre> |
||
| 14 | |||
| 15 | h2. パッケージ用ディレクトリを作成 |
||
| 16 | |||
| 17 | <pre><code class="bash"> |
||
| 18 | mkdir ~/gcc8-cygport |
||
| 19 | cd ~/gcc8-cygport |
||
| 20 | </code></pre> |
||
| 21 | |||
| 22 | h2. cygport ファイルを作成(gcc8.cygport) |
||
| 23 | |||
| 24 | <pre><code class="bash"> |
||
| 25 | nano gcc8.cygport |
||
| 26 | </code></pre> |
||
| 27 | |||
| 28 | * 内容: |
||
| 29 | <pre><code class="text"> |
||
| 30 | bash |
||
| 31 | NAME="gcc8" |
||
| 32 | VERSION="8.4.0" |
||
| 33 | RELEASE="1" |
||
| 34 | CATEGORY="Devel" |
||
| 35 | SUMMARY="GCC 8.4.0 compiler (custom build)" |
||
| 36 | DESCRIPTION="Custom-built GCC 8.4.0 with long double=80bit support." |
||
| 37 | HOMEPAGE="https://gcc.gnu.org/" |
||
| 38 | SRC_URI="" |
||
| 39 | PKG_NAMES="gcc8" |
||
| 40 | |||
| 41 | # インストール済みの GCC をパッケージ化する |
||
| 42 | src_install() { |
||
| 43 | mkdir -p ${D}/usr/local/gcc-8.4 |
||
| 44 | cp -a /usr/local/gcc-8.4/* ${D}/usr/local/gcc-8.4/ |
||
| 45 | } |
||
| 46 | </code></pre> |
||
| 47 | |||
| 48 | * ポイント: |
||
| 49 | ** SRC_URI="" → ソースからビルドしない |
||
| 50 | ** src_install() → 既にインストール済みの GCC をコピーしてパッケージ化 |
||
| 51 | ** /usr/local/gcc-8.4 → あなたが昨日インストールした場所 |
||
| 52 | |||
| 53 | h2. cygport を実行してパッケージ生成 |
||
| 54 | |||
| 55 | <pre><code class="bash"> |
||
| 56 | cygport gcc8.cygport package |
||
| 57 | </code></pre> |
||
| 58 | |||
| 59 | * 成功すると: |
||
| 60 | ** <pre><code class="text"> |
||
| 61 | gcc8-8.4.0-1.tar.xz |
||
| 62 | gcc8-8.4.0-1-src.tar.xz |
||
| 63 | gcc8-8.4.0-1.hint |
||
| 64 | </code></pre> |
||
| 65 | が ~/gcc8-cygport の下に生成されます。 |
||
| 66 | |||
| 67 | h2. パッケージをローカルリポジトリに配置 |
||
| 68 | |||
| 69 | <pre><code class="bash"> |
||
| 70 | mkdir -p ~/cygwin-local/x86_64/release/gcc8 |
||
| 71 | cp gcc8-8.4.0-1* ~/cygwin-local/x86_64/release/gcc8/ |
||
| 72 | </code></pre> |
||
| 73 | |||
| 74 | * 構造: |
||
| 75 | ** <pre><code class="text"> |
||
| 76 | cygwin-local/ |
||
| 77 | └─ x86_64/ |
||
| 78 | └─ release/ |
||
| 79 | └─ gcc8/ |
||
| 80 | ├─ gcc8-8.4.0-1.tar.xz |
||
| 81 | ├─ gcc8-8.4.0-1-src.tar.xz |
||
| 82 | └─ setup.hint |
||
| 83 | </code></pre> |
||
| 84 | |||
| 85 | h2. setup-x86_64.exe でインストール |
||
| 86 | |||
| 87 | * 他の PC で: |
||
| 88 | <pre><code class="bash"> |
||
| 89 | setup-x86_64.exe --local-install --local-package-dir X:\path\to\cygwin-local |
||
| 90 | </code></pre> |
||
| 91 | * または GUI で: |
||
| 92 | ** setup-x86_64.exe を起動 |
||
| 93 | ** 「Install from Local Directory」を選択 |
||
| 94 | ** cygwin-local を指定 |
||
| 95 | ** パッケージ一覧に gcc8 が現れる |
||
| 96 | ** インストール |
||
| 97 | ** → 公式パッケージと同じ UI で GCC 8.4.0 がインストールされる |