diff --git a/pkgs/games/qgo/default.nix b/pkgs/games/qgo/default.nix new file mode 100644 index 000000000000..b6a76001ad09 --- /dev/null +++ b/pkgs/games/qgo/default.nix @@ -0,0 +1,48 @@ +{ stdenv, fetchFromGitHub, makeWrapper, qmake, qt56 }: + +stdenv.mkDerivation rec { + name = "qgo-${version}"; + version = "unstable-2016-06-23"; + + meta = with stdenv.lib; { + description = "A Go client based on Qt5"; + longDescription = '' + qGo is a Go Client based on Qt 5. It supports playing online at + IGS-compatible servers (including some special tweaks for WING and LGS, + also NNGS was reported to work) and locally against gnugo (or other + GTP-compliant engines). It also has rudimentary support for editing SGF + files and parital support for CyberORO/WBaduk, Tygem, Tom, and eWeiqi + (developers of these backends are currently inactive, everybody is welcome + to take them over). + + Go is an ancient Chinese board game. It's called "圍棋(Wei Qi)" in + Chinese, "囲碁(Yi Go)" in Japanese, "바둑(Baduk)" in Korean. + ''; + homepage = "https://github.com/pzorin/qgo"; + license = licenses.gpl2; + maintainers = with maintainers; [ zalakain ]; + }; + + src = fetchFromGitHub { + owner = "pzorin"; + repo = "qgo"; + rev = "1e65b0c74914e534ea4d040f8f0ef8908383e374"; + sha256 = "1xzkayclmhsi07p9mnbf8185jw8n5ikxp2mik3x8qz1i6rmrfl5b"; + }; + + patches = [ ./fix-paths.patch ]; + postPatch = '' + sed -i 's|@out@|'"''${out}"'|g' src/src.pro src/defines.h + ''; + nativeBuildInputs = [ makeWrapper qmake ]; + # qt58 does not provide platform plugins + # We need lib/qt*/plugins/platforms/libqxcb.so + buildInputs = with qt56; [ qtbase.out qtmultimedia qttranslations ]; + enableParallelBuilding = true; + postFixup = '' + # libQt5XcbQpa is a platform plugin dependency and doesn't get linked + patchelf --add-needed libQt5XcbQpa.so.5 $out/bin/qgo + wrapProgram $out/bin/qgo \ + --set QT_QPA_PLATFORM_PLUGIN_PATH "${qt56.qtbase}/lib/qt-5.6/plugins/platforms/" + ''; +} diff --git a/pkgs/games/qgo/fix-paths.patch b/pkgs/games/qgo/fix-paths.patch new file mode 100644 index 000000000000..c1d1e399ec1a --- /dev/null +++ b/pkgs/games/qgo/fix-paths.patch @@ -0,0 +1,50 @@ +diff --git a/src/defines.h b/src/defines.h +index 5d40955..82d0627 100644 +--- a/src/defines.h ++++ b/src/defines.h +@@ -48,7 +48,7 @@ + * GNUgo default level + */ + #define DEFAULT_ENGINE "gnugo" +-#define DEFAULT_ENGINE_PATH "/usr/games/" ++#define DEFAULT_ENGINE_PATH "" + #define DEFAULT_ENGINE_OPTIONS "--mode gtp --quiet --level 10" + + +@@ -220,8 +220,8 @@ extern QString applicationPath; + #define SOUND_PATH_PREFIX "qGo.app/Contents/Resources/Sounds/" + #define TRANSLATIONS_PATH "qGo.app/Contents/Resources/Translations/" + #else +- #define SOUND_PATH_PREFIX "/usr/share/qgo/sounds/" +- #define TRANSLATIONS_PATH "/usr/share/qgo/languages" ++ #define SOUND_PATH_PREFIX "/@out@/share/qgo/sounds/" ++ #define TRANSLATIONS_PATH "/@out@/share/qgo/languages" + #endif + + #endif +diff --git a/src/src.pro b/src/src.pro +index f989ce7..b7d691f 100644 +--- a/src/src.pro ++++ b/src/src.pro +@@ -165,17 +165,17 @@ SOURCES += displayboard.cpp \ + newgamedialog.cpp + + unix*:!macx-* { +- QGO_INSTALL_PATH = /usr/share/qgo +- QGO_INSTALL_BIN_PATH = /usr/bin ++ QGO_INSTALL_PATH = @out@/share/qgo ++ QGO_INSTALL_BIN_PATH = /@out@/bin + +- icon.path = /usr/share/pixmaps ++ icon.path = @out@/share/pixmaps + icon.files = resources/pics/qgo.png + icon.files += resources/pics/qgo_16x16.xpm + icon.files += resources/pics/qgo_32x32.xpm + icon.files += resources/pics/qgo_48x48.png + icon.files += resources/pics/qgo_48x48.xpm + INSTALLS += icon +- desktopfile.path = /usr/share/applications ++ desktopfile.path = @out@/share/applications + desktopfile.files = qgo.desktop + INSTALLS += desktopfile + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 510141161376..4964553e7d26 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12937,6 +12937,8 @@ with pkgs; poppler_data = callPackage ../data/misc/poppler-data { }; + qgo = libsForQt5.callPackage ../games/qgo { }; + quattrocento = callPackage ../data/fonts/quattrocento {}; quattrocento-sans = callPackage ../data/fonts/quattrocento-sans {};