macOSでコンパイル可能に

This commit is contained in:
2026-05-27 14:59:34 +09:00
parent 9b544ce55d
commit 4e51644fa1
5 changed files with 67 additions and 0 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
hexagon hexagon
hexagon.exe hexagon.exe
hexagon-* hexagon-*
Hexagon.app

BIN
macos/Hexagon.icns Executable file

Binary file not shown.

22
macos/Info.plist Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Hexagon</string>
<key>CFBundleIdentifier</key>
<string>moe.technicalsuwako.hexagon</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleExecutable</key>
<string>hexagon</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
<key>CFBundleIconFile</key>
<string>Hexagon.icns</string>
</dict>
</plist>

12
macos/hexagon.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
ADIR="$(dirname "$DIR")"
BIN="$ADIR/MacOS/hexagon_real"
osascript <<EOF
tell application "Terminal"
activate
do script "\"$BIN\"; exit"
end tell
EOF

32
make-macos.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
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
strip hexagon
mkdir -p Hexagon.app/Contents/MacOS
mkdir -p Hexagon.app/Contents/Resources
mkdir -p Hexagon.app/Contents/Frameworks
cp macos/Hexagon.icns Hexagon.app/Contents/Resources/
cp macos/Info.plist Hexagon.app/Contents/
mv hexagon Hexagon.app/Contents/MacOS/hexagon_real
cp macos/hexagon.sh Hexagon.app/Contents/MacOS/hexagon
chmod +x Hexagon.app/Contents/MacOS/hexagon
chmod +x Hexagon.app/Contents/MacOS/hexagon_real
cd Hexagon.app/Contents/MacOS
install_name_tool -change \
/opt/homebrew/opt/ncurses/lib/libncursesw.6.dylib \
@executable_path/../Frameworks/libncursesw.6.dylib \
hexagon_real
cp /opt/homebrew/opt/ncurses/lib/libncursesw.6.dylib \
../Frameworks/
install_name_tool -id @rpath/libncursesw.6.dylib \
../Frameworks/libncursesw.6.dylib
cd ../../..
codesign --force --deep --sign - Hexagon.app/Contents/MacOS/hexagon_real
codesign --force --deep --sign - Hexagon.app/Contents/Frameworks/libncursesw.6.dylib
tar zcfv hexagon-macos-aarch64.tar.gz Hexagon.app
rm -rf Hexagon.app