macOSでコンパイル可能に
諏訪子 <suwako@076.moe>、2026-05-27 14:59
コミット 4e51644fa168a9e1913d45b96bf08e063506fcbb
・親 9b544ce
・ファイルを見る
5個のファイル、+67 -0
変更
.gitignore
| @@ -2,3 +2,4 @@ | ||
| 2 | 2 | hexagon |
| 3 | 3 | hexagon.exe |
| 4 | 4 | hexagon-* |
| 5 | +Hexagon.app |
バイナリファイル
| @@ -0,0 +1,22 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| 3 | +<plist version="1.0"> | |
| 4 | +<dict> | |
| 5 | + <key>CFBundleName</key> | |
| 6 | + <string>Hexagon</string> | |
| 7 | + <key>CFBundleIdentifier</key> | |
| 8 | + <string>moe.technicalsuwako.hexagon</string> | |
| 9 | + <key>CFBundleVersion</key> | |
| 10 | + <string>1.0</string> | |
| 11 | + <key>CFBundleShortVersionString</key> | |
| 12 | + <string>1.0</string> | |
| 13 | + <key>CFBundleExecutable</key> | |
| 14 | + <string>hexagon</string> | |
| 15 | + <key>CFBundlePackageType</key> | |
| 16 | + <string>APPL</string> | |
| 17 | + <key>LSMinimumSystemVersion</key> | |
| 18 | + <string>11.0</string> | |
| 19 | + <key>CFBundleIconFile</key> | |
| 20 | + <string>Hexagon.icns</string> | |
| 21 | +</dict> | |
| 22 | +</plist> |
| @@ -0,0 +1,12 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | +DIR="$(cd "$(dirname "$0")" && pwd)" | |
| 3 | +ADIR="$(dirname "$DIR")" | |
| 4 | + | |
| 5 | +BIN="$ADIR/MacOS/hexagon_real" | |
| 6 | + | |
| 7 | +osascript <<EOF | |
| 8 | +tell application "Terminal" | |
| 9 | + activate | |
| 10 | + do script "\"$BIN\"; exit" | |
| 11 | +end tell | |
| 12 | +EOF |
| @@ -0,0 +1,32 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | + | |
| 3 | +c++ -O3 -I/usr/include -I/usr/local/include -L/usr/lib -L/usr/local/lib -I/opt/homebrew/opt/ncurses/include -L/opt/homebrew/opt/ncurses/lib -o hexagon main.cc src/*.cc -std=c++17 -lncursesw | |
| 4 | +strip hexagon | |
| 5 | + | |
| 6 | +mkdir -p Hexagon.app/Contents/MacOS | |
| 7 | +mkdir -p Hexagon.app/Contents/Resources | |
| 8 | +mkdir -p Hexagon.app/Contents/Frameworks | |
| 9 | +cp macos/Hexagon.icns Hexagon.app/Contents/Resources/ | |
| 10 | +cp macos/Info.plist Hexagon.app/Contents/ | |
| 11 | +mv hexagon Hexagon.app/Contents/MacOS/hexagon_real | |
| 12 | +cp macos/hexagon.sh Hexagon.app/Contents/MacOS/hexagon | |
| 13 | +chmod +x Hexagon.app/Contents/MacOS/hexagon | |
| 14 | +chmod +x Hexagon.app/Contents/MacOS/hexagon_real | |
| 15 | + | |
| 16 | +cd Hexagon.app/Contents/MacOS | |
| 17 | +install_name_tool -change \ | |
| 18 | + /opt/homebrew/opt/ncurses/lib/libncursesw.6.dylib \ | |
| 19 | + @executable_path/../Frameworks/libncursesw.6.dylib \ | |
| 20 | + hexagon_real | |
| 21 | + | |
| 22 | +cp /opt/homebrew/opt/ncurses/lib/libncursesw.6.dylib \ | |
| 23 | + ../Frameworks/ | |
| 24 | +install_name_tool -id @rpath/libncursesw.6.dylib \ | |
| 25 | + ../Frameworks/libncursesw.6.dylib | |
| 26 | + | |
| 27 | +cd ../../.. | |
| 28 | +codesign --force --deep --sign - Hexagon.app/Contents/MacOS/hexagon_real | |
| 29 | +codesign --force --deep --sign - Hexagon.app/Contents/Frameworks/libncursesw.6.dylib | |
| 30 | + | |
| 31 | +tar zcfv hexagon-macos-aarch64.tar.gz Hexagon.app | |
| 32 | +rm -rf Hexagon.app |