git.iko.soy/typeable/nixpkgs
on master help sign in
nifskope: 1.1.3 -> 2.0.dev7

`nifskope` v2 contains a lot of new features and a new, QT5-based UI (see https://github.com/niftools/nifskope/releases). Additionally the 2.0 sourcetree exists for quite a while and after some short user tests it seems fairly stable. The following aspects have been changed: * Use QT 5.9 rather than QT4 (see #33248). * GCC7 support from upstream (gcc6 patch not needed anymore, build on GCC7 works fine), disabled `-Werror=format-security` can be used again as compiler flag. * Patched broken paths in `NifSkope_targets.pri` to point to the proper dependencies (otherwise `<gli.hpp>` and `qhull` couldn't be found). * Patched paths in `NifSkope.pro` to `lupdate` and `lrelease` (default `QT_*` paths point to `libsForQt5x.qtbase` which doesn't contain the needed binaries, instead they need to point to `libsForQt5x.qttools`). * Added myself as maintainer.

commitd60127fd8c43b0c8c4dc572dc53464ee28a24f56 authorMaximilian Bosch <maximilian@mbosch.me> dateMon 18 Jun 2018, 00:07 (8 years ago) parent07d2384
5 files changed+110−167
pkgs/tools/graphics/nifskope/default.nix+54−43 pkgs/tools/graphics/nifskope/external-lib-paths.patch+33 pkgs/tools/graphics/nifskope/gcc-6.patch−123 pkgs/tools/graphics/nifskope/qttools-bins.patch+22 pkgs/top-level/all-packages.nix+1−1
pkgs/tools/graphics/nifskope/default.nix+54−43
@@ -1,57 +1,68 @@
1−{ stdenv, fetchurl, qt4, qmake4Hook }:
1+{ stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, makeWrapper }:
22
33stdenv.mkDerivation rec {
4− name = "nifskope-1.1.3";
4+ name = "nifskope-${version}";
5+ version = "2.0.dev7";
56
6− src = fetchurl {
7− url = "https://github.com/niftools/nifskope/releases/download/${name}/${name}.tar.bz2";
8− sha256 = "0fcvrcjyvivww10sjhxamcip797b9ykbf5p3rm2k24xhkwdaqp72";
7+ src = fetchFromGitHub {
8+ owner = "niftools";
9+ repo = "nifskope";
10+ rev = "47b788d26ae0fa12e60e8e7a4f0fa945a510c7b2"; # `v${version}` doesn't work with submodules
11+ sha256 = "1wqpn53rkq28ws3apqghkzyrib4wis91x171ns64g8kp4q6mfczi";
12+ fetchSubmodules = true;
913 };
1014
11− patches = [ ./gcc-6.patch ];
15+ patches = [
16+ ./external-lib-paths.patch
17+ (substituteAll {
18+ src = ./qttools-bins.patch;
19+ qttools = "${qttools.dev}/bin";
20+ })
21+ ];
1222
13− buildInputs = [ qt4 ];
23+ buildInputs = [ qtbase qttools libGLU.dev makeWrapper ];
24+ nativeBuildInputs = [ qmake ];
1425
15− nativeBuildInputs = [ qmake4Hook ];
26+ preConfigure = ''
27+ shopt -s globstar
28+ for i in **/*.cpp; do
29+ substituteInPlace $i --replace /usr/share/nifskope $out/share/nifskope
30+ done
31+ '';
1632
17− preConfigure =
18− ''
19− for i in *.cpp gl/*.cpp widgets/*.cpp; do
20− substituteInPlace $i --replace /usr/share/nifskope $out/share/nifskope
21− done
22− '';
33+ enableParallelBuilding = true;
2334
24− qmakeFlags = [ "-after TARGET=nifskope" ];
35+ # Inspired by install/linux-install/nifskope.spec.in.
36+ installPhase = let
37+ qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
38+ in ''
39+ runHook preInstall
2540
26− enableParallelBuilding = true;
41+ d=$out/share/nifskope
42+ mkdir -p $out/bin $out/share/applications $out/share/pixmaps $d/{shaders,lang}
43+ cp release/NifSkope $out/bin/
44+ cp ./res/nifskope.png $out/share/pixmaps/
45+ cp release/{nif.xml,kfm.xml,style.qss} $d/
46+ cp res/shaders/*.frag res/shaders/*.prog res/shaders/*.vert $d/shaders/
47+ cp ./res/lang/*.ts ./res/lang/*.tm $d/lang/
48+ cp ./install/linux-install/nifskope.desktop $out/share/applications
49+
50+ substituteInPlace $out/share/applications/nifskope.desktop \
51+ --replace 'Exec=nifskope' "Exec=$out/bin/NifSkope" \
52+ --replace 'Icon=nifskope' "Icon=$out/share/pixmaps/nifskope.png"
53+
54+ find $out/share -type f -exec chmod -x {} \;
55+
56+ wrapProgram $out/bin/NifSkope --prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-${qtVersion}/plugins"
57+
58+ runHook postInstall
59+ '';
2760
28− hardeningDisable = [ "format" ];
29−
30− # Inspired by linux-install/nifskope.spec.in.
31− installPhase =
32− ''
33− d=$out/share/nifskope
34− mkdir -p $out/bin $out/share/applications $out/share/pixmaps $d/{shaders,doc,lang}
35− cp release/nifskope $out/bin/
36− cp nifskope.png $out/share/pixmaps/
37− cp nif.xml kfm.xml style.qss $d/
38− cp shaders/*.frag shaders/*.prog shaders/*.vert $d/shaders/
39− cp doc/*.html doc/docsys.css doc/favicon.ico $d/doc/
40− cp lang/*.ts lang/*.tm $d/lang/
41−
42− substituteInPlace nifskope.desktop \
43− --replace 'Exec=nifskope' "Exec=$out/bin/nifskope" \
44− --replace 'Icon=nifskope' "Icon=$out/share/pixmaps/nifskope.png"
45− cp nifskope.desktop $out/share/applications/
46−
47− find $out/share -type f -exec chmod -x {} \;
48− ''; # */
49−
50− meta = {
51− homepage = https://github.com/niftools/nifskope/;
61+ meta = with stdenv.lib; {
62+ homepage = http://niftools.sourceforge.net/wiki/NifSkope;
5263 description = "A tool for analyzing and editing NetImmerse/Gamebryo '*.nif' files";
53− maintainers = [ stdenv.lib.maintainers.eelco ];
54− platforms = stdenv.lib.platforms.linux;
55− license = stdenv.lib.licenses.bsd3;
64+ maintainers = with maintainers; [ eelco ma27 ];
65+ platforms = platforms.linux;
66+ license = licenses.bsd3;
5667 };
5768}
pkgs/tools/graphics/nifskope/external-lib-paths.patchnew file+33
@@ -0,0 +1,33 @@
1+diff --git a/NifSkope.pro b/NifSkope.pro
2+index 1c0bc5a..cc29fc5 100644
3+--- a/NifSkope.pro
4++++ b/NifSkope.pro
5+@@ -330,14 +330,14 @@ nvtristrip {
6+ }
7+
8+ qhull {
9+- !*msvc*:QMAKE_CFLAGS += -isystem ../nifskope/lib/qhull/src
10+- !*msvc*:QMAKE_CXXFLAGS += -isystem ../nifskope/lib/qhull/src
11++ !*msvc*:QMAKE_CFLAGS += -isystem ./lib/qhull/src
12++ !*msvc*:QMAKE_CXXFLAGS += -isystem ./lib/qhull/src
13+ else:INCLUDEPATH += lib/qhull/src
14+ HEADERS += $$files($$PWD/lib/qhull/src/libqhull/*.h, false)
15+ }
16+
17+ gli {
18+- !*msvc*:QMAKE_CXXFLAGS += -isystem ../nifskope/lib/gli/gli -isystem ../nifskope/lib/gli/external
19++ !*msvc*:QMAKE_CXXFLAGS += -isystem ./lib/gli/gli -isystem ./lib/gli/external
20+ else:INCLUDEPATH += lib/gli/gli lib/gli/external
21+ HEADERS += $$files($$PWD/lib/gli/gli/*.hpp, true)
22+ HEADERS += $$files($$PWD/lib/gli/gli/*.inl, true)
23+@@ -346,8 +346,8 @@ gli {
24+ }
25+
26+ zlib {
27+- !*msvc*:QMAKE_CFLAGS += -isystem ../nifskope/lib/zlib
28+- !*msvc*:QMAKE_CXXFLAGS += -isystem ../nifskope/lib/zlib
29++ !*msvc*:QMAKE_CFLAGS += -isystem ./lib/zlib
30++ !*msvc*:QMAKE_CXXFLAGS += -isystem ./lib/zlib
31+ else:INCLUDEPATH += lib/zlib
32+ HEADERS += $$files($$PWD/lib/zlib/*.h, false)
33+ SOURCES += $$files($$PWD/lib/zlib/*.c, false)
pkgs/tools/graphics/nifskope/gcc-6.patchdeleted−123
@@ -1,123 +0,0 @@
1−Based on https://github.com/niftools/nifskope/commit/7261b0a119a549b11006d8e41ba990d706171f1c
2−
3−diff -ru -x '*~' nifskope-1.1.3-orig/gl/dds/ColorBlock.cpp nifskope-1.1.3/gl/dds/ColorBlock.cpp
4−--- nifskope-1.1.3-orig/gl/dds/ColorBlock.cpp 2012-11-17 23:40:31.000000000 +0100
5−+++ nifskope-1.1.3/gl/dds/ColorBlock.cpp 2017-09-10 10:50:36.766909836 +0200
6−@@ -78,8 +78,8 @@
7−
8− void ColorBlock::init(const Image * img, uint x, uint y)
9− {
10−- const uint bw = min(img->width() - x, 4U);
11−- const uint bh = min(img->height() - y, 4U);
12−+ const uint bw = std::min(img->width() - x, 4U);
13−+ const uint bh = std::min(img->height() - y, 4U);
14−
15− static int remainder[] = {
16− 0, 0, 0, 0,
17−diff -ru -x '*~' nifskope-1.1.3-orig/gl/dds/Common.h nifskope-1.1.3/gl/dds/Common.h
18−--- nifskope-1.1.3-orig/gl/dds/Common.h 2012-11-17 23:40:31.000000000 +0100
19−+++ nifskope-1.1.3/gl/dds/Common.h 2017-09-10 10:48:08.462099032 +0200
20−@@ -33,14 +33,10 @@
21− #ifndef _DDS_COMMON_H
22− #define _DDS_COMMON_H
23−
24−-#ifndef min
25−-#define min(a,b) ((a) <= (b) ? (a) : (b))
26−-#endif
27−-#ifndef max
28−-#define max(a,b) ((a) >= (b) ? (a) : (b))
29−-#endif
30−+#include <algorithm>
31−+
32− #ifndef clamp
33−-#define clamp(x,a,b) min(max((x), (a)), (b))
34−+#define clamp(x,a,b) std::min( std::max( (x), (a) ), (b) )
35− #endif
36−
37− template<typename T>
38−diff -ru -x '*~' nifskope-1.1.3-orig/gl/dds/DirectDrawSurface.cpp nifskope-1.1.3/gl/dds/DirectDrawSurface.cpp
39−--- nifskope-1.1.3-orig/gl/dds/DirectDrawSurface.cpp 2012-11-17 23:40:31.000000000 +0100
40−+++ nifskope-1.1.3/gl/dds/DirectDrawSurface.cpp 2017-09-10 10:48:45.912056969 +0200
41−@@ -63,6 +63,7 @@
42− #include "DirectDrawSurface.h"
43− #include "BlockDXT.h"
44− #include "PixelFormat.h"
45−+#include "Common.h"
46−
47− #include <stdio.h> // printf
48− #include <math.h> // sqrt
49−@@ -685,8 +686,8 @@
50− // Compute width and height.
51− for (uint m = 0; m < mipmap; m++)
52− {
53−- w = max(1U, w / 2);
54−- h = max(1U, h / 2);
55−+ w = std::max(1U, w / 2);
56−+ h = std::max(1U, h / 2);
57− }
58−
59− img->allocate(w, h);
60−@@ -787,9 +788,9 @@
61− readBlock(&block);
62−
63− // Write color block.
64−- for (uint y = 0; y < min(4U, h-4*by); y++)
65−+ for (uint y = 0; y < std::min(4U, h-4*by); y++)
66− {
67−- for (uint x = 0; x < min(4U, w-4*bx); x++)
68−+ for (uint x = 0; x < std::min(4U, w-4*bx); x++)
69− {
70− img->pixel(4*bx+x, 4*by+y) = block.color(x, y);
71− }
72−@@ -909,9 +910,9 @@
73−
74− for (uint m = 0; m < mipmap; m++)
75− {
76−- w = max(1U, w / 2);
77−- h = max(1U, h / 2);
78−- d = max(1U, d / 2);
79−+ w = std::max(1U, w / 2);
80−+ h = std::max(1U, h / 2);
81−+ d = std::max(1U, d / 2);
82− }
83−
84− if (header.pf.flags & DDPF_FOURCC)
85−diff -ru -x '*~' nifskope-1.1.3-orig/gl/gltexloaders.cpp nifskope-1.1.3/gl/gltexloaders.cpp
86−--- nifskope-1.1.3-orig/gl/gltexloaders.cpp 2012-11-17 23:40:31.000000000 +0100
87−+++ nifskope-1.1.3/gl/gltexloaders.cpp 2017-09-10 10:51:23.586839810 +0200
88−@@ -1736,8 +1736,8 @@
89−
90− // generate next offset, resize
91− mipmapOffset += mipmapWidth * mipmapHeight * 4;
92−- mipmapWidth = max( 1, mipmapWidth / 2 );
93−- mipmapHeight = max( 1, mipmapHeight / 2 );
94−+ mipmapWidth = std::max( 1, mipmapWidth / 2 );
95−+ mipmapHeight = std::max( 1, mipmapHeight / 2 );
96− }
97−
98− // set total pixel size
99−@@ -1932,11 +1932,11 @@
100− {
101− if ( ddsHeader.ddsPixelFormat.dwFourCC == FOURCC_DXT1 )
102− {
103−- mipmapOffset += max( 8, ( mipmapWidth * mipmapHeight / 2 ) );
104−+ mipmapOffset += std::max( 8, ( mipmapWidth * mipmapHeight / 2 ) );
105− }
106− else if ( ddsHeader.ddsPixelFormat.dwFourCC == FOURCC_DXT5 )
107− {
108−- mipmapOffset += max( 16, ( mipmapWidth * mipmapHeight ) );
109−+ mipmapOffset += std::max( 16, ( mipmapWidth * mipmapHeight ) );
110− }
111− }
112− else if ( ddsHeader.ddsPixelFormat.dwBPP == 24 )
113−@@ -1947,8 +1947,8 @@
114− {
115− mipmapOffset += ( mipmapWidth * mipmapHeight * 4 );
116− }
117−- mipmapWidth = max( 1, mipmapWidth / 2 );
118−- mipmapHeight = max( 1, mipmapHeight / 2 );
119−+ mipmapWidth = std::max( 1, mipmapWidth / 2 );
120−+ mipmapHeight = std::max( 1, mipmapHeight / 2 );
121− }
122−
123− nif->set<quint32>( iData, "Num Pixels", mipmapOffset );
pkgs/tools/graphics/nifskope/qttools-bins.patchnew file+22
@@ -0,0 +1,22 @@
1+diff --git a/NifSkope_targets.pri b/NifSkope_targets.pri
2+index 05324c2..d8389b1 100644
3+--- a/NifSkope_targets.pri
4++++ b/NifSkope_targets.pri
5+@@ -11,7 +11,7 @@ else:EXE = ""
6+ ## lupdate / lrelease
7+ ###############################
8+
9+-QMAKE_LUPDATE = $$[QT_INSTALL_BINS]/lupdate$${EXE}
10++QMAKE_LUPDATE = @qttools@/lupdate$${EXE}
11+ exists($$QMAKE_LUPDATE) {
12+ # Make target for Updating .ts
13+ updatets.target = updatets
14+@@ -23,7 +23,7 @@ exists($$QMAKE_LUPDATE) {
15+ message("lupdate could not be found, ignoring make target")
16+ }
17+
18+-QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease$${EXE}
19++QMAKE_LRELEASE = @qttools@/lrelease$${EXE}
20+ exists($$QMAKE_LRELEASE) {
21+ # Build Step for Releasing .ts->.qm
22+ updateqm.input = TRANSLATIONS
pkgs/top-level/all-packages.nix+1−1
@@ -4066,7 +4066,7 @@ with pkgs;
40664066
40674067 niff = callPackage ../tools/package-management/niff { };
40684068
4069− nifskope = callPackage ../tools/graphics/nifskope { };
4069+ nifskope = libsForQt59.callPackage ../tools/graphics/nifskope { };
40704070
40714071 nilfs-utils = callPackage ../tools/filesystems/nilfs-utils {};
40724072