mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
shipwright: darwin build, add maintainer
This commit is contained in:
parent
ce1013bc7a
commit
b81447c631
37
pkgs/games/shipwright/darwin-fixes.patch
Normal file
37
pkgs/games/shipwright/darwin-fixes.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2c8644af..157758c9 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -166,17 +166,13 @@ endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_custom_target(CreateOSXIcons
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/soh.iconset
|
||||
- COMMAND sips -z 16 16 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16.png
|
||||
- COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16x16@2x.png
|
||||
- COMMAND sips -z 32 32 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32.png
|
||||
- COMMAND sips -z 64 64 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32x32@2x.png
|
||||
- COMMAND sips -z 128 128 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128.png
|
||||
- COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128x128@2x.png
|
||||
- COMMAND sips -z 256 256 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256.png
|
||||
- COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256x256@2x.png
|
||||
- COMMAND sips -z 512 512 soh/macosx/sohIcon.png --out ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512.png
|
||||
- COMMAND cp soh/macosx/sohIcon.png ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512x512@2x.png
|
||||
- COMMAND iconutil -c icns -o ${CMAKE_BINARY_DIR}/macosx/soh.icns ${CMAKE_BINARY_DIR}/macosx/soh.iconset
|
||||
+ COMMAND convert soh/macosx/sohIcon.png -resize 16x16 ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_16.png
|
||||
+ COMMAND convert soh/macosx/sohIcon.png -resize 32x32 ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_32.png
|
||||
+ COMMAND convert soh/macosx/sohIcon.png -resize 64x64 ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_64.png
|
||||
+ COMMAND convert soh/macosx/sohIcon.png -resize 128x128 ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_128.png
|
||||
+ COMMAND convert soh/macosx/sohIcon.png -resize 256x256 ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_256.png
|
||||
+ COMMAND convert soh/macosx/sohIcon.png -resize 512x512 ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_512.png
|
||||
+ COMMAND png2icns ${CMAKE_BINARY_DIR}/macosx/soh.icns ${CMAKE_BINARY_DIR}/macosx/soh.iconset/icon_{16,32,64,128,256,512}.png
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Creating OSX icons ..."
|
||||
)
|
||||
@@ -201,7 +197,6 @@ install(DIRECTORY ${CMAKE_BINARY_DIR}/assets
|
||||
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
- fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\")
|
||||
")
|
||||
|
||||
endif()
|
|
@ -24,8 +24,13 @@
|
|||
, imagemagick
|
||||
, gnome
|
||||
, makeWrapper
|
||||
, darwin
|
||||
, libicns
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (darwin.apple_sdk_11_0.frameworks)
|
||||
IOSurface Metal QuartzCore Cocoa AVFoundation;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "shipwright";
|
||||
version = "8.0.5";
|
||||
|
@ -38,6 +43,10 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
patches = [
|
||||
./darwin-fixes.patch
|
||||
];
|
||||
|
||||
# This would get fetched at build time otherwise, see:
|
||||
# https://github.com/HarbourMasters/Shipwright/blob/e46c60a7a1396374e23f7a1f7122ddf9efcadff7/soh/CMakeLists.txt#L736
|
||||
gamecontrollerdb = fetchurl {
|
||||
|
@ -50,27 +59,39 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
cmake
|
||||
ninja
|
||||
pkg-config
|
||||
lsb-release
|
||||
python3
|
||||
imagemagick
|
||||
copyDesktopItems
|
||||
makeWrapper
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
lsb-release
|
||||
copyDesktopItems
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
libicns
|
||||
darwin.sigtool
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
boost
|
||||
glew
|
||||
SDL2
|
||||
SDL2_net
|
||||
libpng
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
libX11
|
||||
libXrandr
|
||||
libXinerama
|
||||
libXcursor
|
||||
libXi
|
||||
libXext
|
||||
glew
|
||||
SDL2
|
||||
SDL2_net
|
||||
libpulseaudio
|
||||
libpng
|
||||
gnome.zenity
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
IOSurface
|
||||
Metal
|
||||
QuartzCore
|
||||
Cocoa
|
||||
AVFoundation
|
||||
darwin.apple_sdk_11_0.libs.simd
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
|
@ -78,6 +99,9 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
(lib.cmakeBool "NON_PORTABLE" true)
|
||||
];
|
||||
|
||||
env.NIX_CFLAGS_COMPILE =
|
||||
lib.optionalString stdenv.isDarwin "-Wno-int-conversion -Wno-implicit-int";
|
||||
|
||||
dontAddPrefix = true;
|
||||
|
||||
# Linking fails without this
|
||||
|
@ -90,18 +114,60 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
popd
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
preInstall = lib.optionalString stdenv.isLinux ''
|
||||
# Cmake likes it here for its install paths
|
||||
cp ../OTRExporter/soh.otr ..
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
cp ../OTRExporter/soh.otr soh/soh.otr
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
postInstall = lib.optionalString stdenv.isLinux ''
|
||||
mkdir -p $out/bin
|
||||
ln -s $out/lib/soh.elf $out/bin/soh
|
||||
install -Dm644 ../soh/macosx/sohIcon.png $out/share/pixmaps/soh.png
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
# Recreate the macOS bundle (without using cpack)
|
||||
# We mirror the structure of the bundle distributed by the project
|
||||
|
||||
mkdir -p $out/Applications/soh.app/Contents
|
||||
cp $src/soh/macosx/Info.plist.in $out/Applications/soh.app/Contents/Info.plist
|
||||
substituteInPlace $out/Applications/soh.app/Contents/Info.plist \
|
||||
--replace-fail "@CMAKE_PROJECT_VERSION@" "${finalAttrs.version}"
|
||||
|
||||
mv $out/MacOS $out/Applications/soh.app/Contents/MacOS
|
||||
|
||||
# Wrapper
|
||||
cp $src/soh/macosx/soh-macos.sh.in $out/Applications/soh.app/Contents/MacOS/soh
|
||||
chmod +x $out/Applications/soh.app/Contents/MacOS/soh
|
||||
patchShebangs $out/Applications/soh.app/Contents/MacOS/soh
|
||||
|
||||
# "lib" contains all resources that are in "Resources" in the official bundle.
|
||||
# We move them to the right place and symlink them back to $out/lib,
|
||||
# as that's where the game expects them.
|
||||
mv $out/Resources $out/Applications/soh.app/Contents/Resources
|
||||
mv $out/lib/** $out/Applications/soh.app/Contents/Resources
|
||||
rm -rf $out/lib
|
||||
ln -s $out/Applications/soh.app/Contents/Resources $out/lib
|
||||
|
||||
# Copy icons
|
||||
cp -r ../build/macosx/soh.icns $out/Applications/soh.app/Contents/Resources/soh.icns
|
||||
|
||||
# Fix executable
|
||||
install_name_tool -change @executable_path/../Frameworks/libSDL2-2.0.0.dylib \
|
||||
${SDL2}/lib/libSDL2-2.0.0.dylib \
|
||||
$out/Applications/soh.app/Contents/Resources/soh-macos
|
||||
install_name_tool -change @executable_path/../Frameworks/libGLEW.2.2.0.dylib \
|
||||
${glew}/lib/libGLEW.2.2.0.dylib \
|
||||
$out/Applications/soh.app/Contents/Resources/soh-macos
|
||||
install_name_tool -change @executable_path/../Frameworks/libpng16.16.dylib \
|
||||
${libpng}/lib/libpng16.16.dylib \
|
||||
$out/Applications/soh.app/Contents/Resources/soh-macos
|
||||
|
||||
# Codesign (ad-hoc)
|
||||
codesign -f -s - $out/Applications/soh.app/Contents/Resources/soh-macos
|
||||
'';
|
||||
|
||||
fixupPhase = ''
|
||||
fixupPhase = lib.optionalString stdenv.isLinux ''
|
||||
wrapProgram $out/lib/soh.elf --prefix PATH ":" ${lib.makeBinPath [ gnome.zenity ]}
|
||||
'';
|
||||
|
||||
|
@ -121,8 +187,8 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
homepage = "https://github.com/HarbourMasters/Shipwright";
|
||||
description = "A PC port of Ocarina of Time with modern controls, widescreen, high-resolution, and more";
|
||||
mainProgram = "soh";
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with lib.maintainers; [ ivar j0lol ];
|
||||
platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
|
||||
maintainers = with lib.maintainers; [ ivar j0lol matteopacini ];
|
||||
license = with lib.licenses; [
|
||||
# OTRExporter, OTRGui, ZAPDTR, libultraship
|
||||
mit
|
||||
|
|
|
@ -36251,7 +36251,9 @@ with pkgs;
|
|||
|
||||
keeperrl = callPackage ../games/keeperrl { };
|
||||
|
||||
shipwright = callPackage ../games/shipwright { };
|
||||
shipwright = callPackage ../games/shipwright {
|
||||
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
|
||||
};
|
||||
|
||||
wipeout-rewrite = callPackage ../games/wipeout-rewrite {
|
||||
inherit (darwin.apple_sdk.frameworks) Foundation;
|
||||
|
|
Loading…
Reference in a new issue