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.
This commit is contained in:
parent
07d23845c3
commit
d60127fd8c
5 changed files with 107 additions and 164 deletions
|
@ -1,57 +1,68 @@
|
|||
{ stdenv, fetchurl, qt4, qmake4Hook }:
|
||||
{ stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, makeWrapper }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "nifskope-1.1.3";
|
||||
name = "nifskope-${version}";
|
||||
version = "2.0.dev7";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/niftools/nifskope/releases/download/${name}/${name}.tar.bz2";
|
||||
sha256 = "0fcvrcjyvivww10sjhxamcip797b9ykbf5p3rm2k24xhkwdaqp72";
|
||||
src = fetchFromGitHub {
|
||||
owner = "niftools";
|
||||
repo = "nifskope";
|
||||
rev = "47b788d26ae0fa12e60e8e7a4f0fa945a510c7b2"; # `v${version}` doesn't work with submodules
|
||||
sha256 = "1wqpn53rkq28ws3apqghkzyrib4wis91x171ns64g8kp4q6mfczi";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
patches = [ ./gcc-6.patch ];
|
||||
patches = [
|
||||
./external-lib-paths.patch
|
||||
(substituteAll {
|
||||
src = ./qttools-bins.patch;
|
||||
qttools = "${qttools.dev}/bin";
|
||||
})
|
||||
];
|
||||
|
||||
buildInputs = [ qt4 ];
|
||||
buildInputs = [ qtbase qttools libGLU.dev makeWrapper ];
|
||||
nativeBuildInputs = [ qmake ];
|
||||
|
||||
nativeBuildInputs = [ qmake4Hook ];
|
||||
|
||||
preConfigure =
|
||||
''
|
||||
for i in *.cpp gl/*.cpp widgets/*.cpp; do
|
||||
substituteInPlace $i --replace /usr/share/nifskope $out/share/nifskope
|
||||
done
|
||||
'';
|
||||
|
||||
qmakeFlags = [ "-after TARGET=nifskope" ];
|
||||
preConfigure = ''
|
||||
shopt -s globstar
|
||||
for i in **/*.cpp; do
|
||||
substituteInPlace $i --replace /usr/share/nifskope $out/share/nifskope
|
||||
done
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
hardeningDisable = [ "format" ];
|
||||
# Inspired by install/linux-install/nifskope.spec.in.
|
||||
installPhase = let
|
||||
qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
|
||||
in ''
|
||||
runHook preInstall
|
||||
|
||||
# Inspired by linux-install/nifskope.spec.in.
|
||||
installPhase =
|
||||
''
|
||||
d=$out/share/nifskope
|
||||
mkdir -p $out/bin $out/share/applications $out/share/pixmaps $d/{shaders,doc,lang}
|
||||
cp release/nifskope $out/bin/
|
||||
cp nifskope.png $out/share/pixmaps/
|
||||
cp nif.xml kfm.xml style.qss $d/
|
||||
cp shaders/*.frag shaders/*.prog shaders/*.vert $d/shaders/
|
||||
cp doc/*.html doc/docsys.css doc/favicon.ico $d/doc/
|
||||
cp lang/*.ts lang/*.tm $d/lang/
|
||||
d=$out/share/nifskope
|
||||
mkdir -p $out/bin $out/share/applications $out/share/pixmaps $d/{shaders,lang}
|
||||
cp release/NifSkope $out/bin/
|
||||
cp ./res/nifskope.png $out/share/pixmaps/
|
||||
cp release/{nif.xml,kfm.xml,style.qss} $d/
|
||||
cp res/shaders/*.frag res/shaders/*.prog res/shaders/*.vert $d/shaders/
|
||||
cp ./res/lang/*.ts ./res/lang/*.tm $d/lang/
|
||||
cp ./install/linux-install/nifskope.desktop $out/share/applications
|
||||
|
||||
substituteInPlace nifskope.desktop \
|
||||
--replace 'Exec=nifskope' "Exec=$out/bin/nifskope" \
|
||||
--replace 'Icon=nifskope' "Icon=$out/share/pixmaps/nifskope.png"
|
||||
cp nifskope.desktop $out/share/applications/
|
||||
substituteInPlace $out/share/applications/nifskope.desktop \
|
||||
--replace 'Exec=nifskope' "Exec=$out/bin/NifSkope" \
|
||||
--replace 'Icon=nifskope' "Icon=$out/share/pixmaps/nifskope.png"
|
||||
|
||||
find $out/share -type f -exec chmod -x {} \;
|
||||
''; # */
|
||||
find $out/share -type f -exec chmod -x {} \;
|
||||
|
||||
meta = {
|
||||
homepage = https://github.com/niftools/nifskope/;
|
||||
wrapProgram $out/bin/NifSkope --prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-${qtVersion}/plugins"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://niftools.sourceforge.net/wiki/NifSkope;
|
||||
description = "A tool for analyzing and editing NetImmerse/Gamebryo '*.nif' files";
|
||||
maintainers = [ stdenv.lib.maintainers.eelco ];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
maintainers = with maintainers; [ eelco ma27 ];
|
||||
platforms = platforms.linux;
|
||||
license = licenses.bsd3;
|
||||
};
|
||||
}
|
||||
|
|
33
pkgs/tools/graphics/nifskope/external-lib-paths.patch
Normal file
33
pkgs/tools/graphics/nifskope/external-lib-paths.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
diff --git a/NifSkope.pro b/NifSkope.pro
|
||||
index 1c0bc5a..cc29fc5 100644
|
||||
--- a/NifSkope.pro
|
||||
+++ b/NifSkope.pro
|
||||
@@ -330,14 +330,14 @@ nvtristrip {
|
||||
}
|
||||
|
||||
qhull {
|
||||
- !*msvc*:QMAKE_CFLAGS += -isystem ../nifskope/lib/qhull/src
|
||||
- !*msvc*:QMAKE_CXXFLAGS += -isystem ../nifskope/lib/qhull/src
|
||||
+ !*msvc*:QMAKE_CFLAGS += -isystem ./lib/qhull/src
|
||||
+ !*msvc*:QMAKE_CXXFLAGS += -isystem ./lib/qhull/src
|
||||
else:INCLUDEPATH += lib/qhull/src
|
||||
HEADERS += $$files($$PWD/lib/qhull/src/libqhull/*.h, false)
|
||||
}
|
||||
|
||||
gli {
|
||||
- !*msvc*:QMAKE_CXXFLAGS += -isystem ../nifskope/lib/gli/gli -isystem ../nifskope/lib/gli/external
|
||||
+ !*msvc*:QMAKE_CXXFLAGS += -isystem ./lib/gli/gli -isystem ./lib/gli/external
|
||||
else:INCLUDEPATH += lib/gli/gli lib/gli/external
|
||||
HEADERS += $$files($$PWD/lib/gli/gli/*.hpp, true)
|
||||
HEADERS += $$files($$PWD/lib/gli/gli/*.inl, true)
|
||||
@@ -346,8 +346,8 @@ gli {
|
||||
}
|
||||
|
||||
zlib {
|
||||
- !*msvc*:QMAKE_CFLAGS += -isystem ../nifskope/lib/zlib
|
||||
- !*msvc*:QMAKE_CXXFLAGS += -isystem ../nifskope/lib/zlib
|
||||
+ !*msvc*:QMAKE_CFLAGS += -isystem ./lib/zlib
|
||||
+ !*msvc*:QMAKE_CXXFLAGS += -isystem ./lib/zlib
|
||||
else:INCLUDEPATH += lib/zlib
|
||||
HEADERS += $$files($$PWD/lib/zlib/*.h, false)
|
||||
SOURCES += $$files($$PWD/lib/zlib/*.c, false)
|
|
@ -1,123 +0,0 @@
|
|||
Based on https://github.com/niftools/nifskope/commit/7261b0a119a549b11006d8e41ba990d706171f1c
|
||||
|
||||
diff -ru -x '*~' nifskope-1.1.3-orig/gl/dds/ColorBlock.cpp nifskope-1.1.3/gl/dds/ColorBlock.cpp
|
||||
--- nifskope-1.1.3-orig/gl/dds/ColorBlock.cpp 2012-11-17 23:40:31.000000000 +0100
|
||||
+++ nifskope-1.1.3/gl/dds/ColorBlock.cpp 2017-09-10 10:50:36.766909836 +0200
|
||||
@@ -78,8 +78,8 @@
|
||||
|
||||
void ColorBlock::init(const Image * img, uint x, uint y)
|
||||
{
|
||||
- const uint bw = min(img->width() - x, 4U);
|
||||
- const uint bh = min(img->height() - y, 4U);
|
||||
+ const uint bw = std::min(img->width() - x, 4U);
|
||||
+ const uint bh = std::min(img->height() - y, 4U);
|
||||
|
||||
static int remainder[] = {
|
||||
0, 0, 0, 0,
|
||||
diff -ru -x '*~' nifskope-1.1.3-orig/gl/dds/Common.h nifskope-1.1.3/gl/dds/Common.h
|
||||
--- nifskope-1.1.3-orig/gl/dds/Common.h 2012-11-17 23:40:31.000000000 +0100
|
||||
+++ nifskope-1.1.3/gl/dds/Common.h 2017-09-10 10:48:08.462099032 +0200
|
||||
@@ -33,14 +33,10 @@
|
||||
#ifndef _DDS_COMMON_H
|
||||
#define _DDS_COMMON_H
|
||||
|
||||
-#ifndef min
|
||||
-#define min(a,b) ((a) <= (b) ? (a) : (b))
|
||||
-#endif
|
||||
-#ifndef max
|
||||
-#define max(a,b) ((a) >= (b) ? (a) : (b))
|
||||
-#endif
|
||||
+#include <algorithm>
|
||||
+
|
||||
#ifndef clamp
|
||||
-#define clamp(x,a,b) min(max((x), (a)), (b))
|
||||
+#define clamp(x,a,b) std::min( std::max( (x), (a) ), (b) )
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
diff -ru -x '*~' nifskope-1.1.3-orig/gl/dds/DirectDrawSurface.cpp nifskope-1.1.3/gl/dds/DirectDrawSurface.cpp
|
||||
--- nifskope-1.1.3-orig/gl/dds/DirectDrawSurface.cpp 2012-11-17 23:40:31.000000000 +0100
|
||||
+++ nifskope-1.1.3/gl/dds/DirectDrawSurface.cpp 2017-09-10 10:48:45.912056969 +0200
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "DirectDrawSurface.h"
|
||||
#include "BlockDXT.h"
|
||||
#include "PixelFormat.h"
|
||||
+#include "Common.h"
|
||||
|
||||
#include <stdio.h> // printf
|
||||
#include <math.h> // sqrt
|
||||
@@ -685,8 +686,8 @@
|
||||
// Compute width and height.
|
||||
for (uint m = 0; m < mipmap; m++)
|
||||
{
|
||||
- w = max(1U, w / 2);
|
||||
- h = max(1U, h / 2);
|
||||
+ w = std::max(1U, w / 2);
|
||||
+ h = std::max(1U, h / 2);
|
||||
}
|
||||
|
||||
img->allocate(w, h);
|
||||
@@ -787,9 +788,9 @@
|
||||
readBlock(&block);
|
||||
|
||||
// Write color block.
|
||||
- for (uint y = 0; y < min(4U, h-4*by); y++)
|
||||
+ for (uint y = 0; y < std::min(4U, h-4*by); y++)
|
||||
{
|
||||
- for (uint x = 0; x < min(4U, w-4*bx); x++)
|
||||
+ for (uint x = 0; x < std::min(4U, w-4*bx); x++)
|
||||
{
|
||||
img->pixel(4*bx+x, 4*by+y) = block.color(x, y);
|
||||
}
|
||||
@@ -909,9 +910,9 @@
|
||||
|
||||
for (uint m = 0; m < mipmap; m++)
|
||||
{
|
||||
- w = max(1U, w / 2);
|
||||
- h = max(1U, h / 2);
|
||||
- d = max(1U, d / 2);
|
||||
+ w = std::max(1U, w / 2);
|
||||
+ h = std::max(1U, h / 2);
|
||||
+ d = std::max(1U, d / 2);
|
||||
}
|
||||
|
||||
if (header.pf.flags & DDPF_FOURCC)
|
||||
diff -ru -x '*~' nifskope-1.1.3-orig/gl/gltexloaders.cpp nifskope-1.1.3/gl/gltexloaders.cpp
|
||||
--- nifskope-1.1.3-orig/gl/gltexloaders.cpp 2012-11-17 23:40:31.000000000 +0100
|
||||
+++ nifskope-1.1.3/gl/gltexloaders.cpp 2017-09-10 10:51:23.586839810 +0200
|
||||
@@ -1736,8 +1736,8 @@
|
||||
|
||||
// generate next offset, resize
|
||||
mipmapOffset += mipmapWidth * mipmapHeight * 4;
|
||||
- mipmapWidth = max( 1, mipmapWidth / 2 );
|
||||
- mipmapHeight = max( 1, mipmapHeight / 2 );
|
||||
+ mipmapWidth = std::max( 1, mipmapWidth / 2 );
|
||||
+ mipmapHeight = std::max( 1, mipmapHeight / 2 );
|
||||
}
|
||||
|
||||
// set total pixel size
|
||||
@@ -1932,11 +1932,11 @@
|
||||
{
|
||||
if ( ddsHeader.ddsPixelFormat.dwFourCC == FOURCC_DXT1 )
|
||||
{
|
||||
- mipmapOffset += max( 8, ( mipmapWidth * mipmapHeight / 2 ) );
|
||||
+ mipmapOffset += std::max( 8, ( mipmapWidth * mipmapHeight / 2 ) );
|
||||
}
|
||||
else if ( ddsHeader.ddsPixelFormat.dwFourCC == FOURCC_DXT5 )
|
||||
{
|
||||
- mipmapOffset += max( 16, ( mipmapWidth * mipmapHeight ) );
|
||||
+ mipmapOffset += std::max( 16, ( mipmapWidth * mipmapHeight ) );
|
||||
}
|
||||
}
|
||||
else if ( ddsHeader.ddsPixelFormat.dwBPP == 24 )
|
||||
@@ -1947,8 +1947,8 @@
|
||||
{
|
||||
mipmapOffset += ( mipmapWidth * mipmapHeight * 4 );
|
||||
}
|
||||
- mipmapWidth = max( 1, mipmapWidth / 2 );
|
||||
- mipmapHeight = max( 1, mipmapHeight / 2 );
|
||||
+ mipmapWidth = std::max( 1, mipmapWidth / 2 );
|
||||
+ mipmapHeight = std::max( 1, mipmapHeight / 2 );
|
||||
}
|
||||
|
||||
nif->set<quint32>( iData, "Num Pixels", mipmapOffset );
|
22
pkgs/tools/graphics/nifskope/qttools-bins.patch
Normal file
22
pkgs/tools/graphics/nifskope/qttools-bins.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
diff --git a/NifSkope_targets.pri b/NifSkope_targets.pri
|
||||
index 05324c2..d8389b1 100644
|
||||
--- a/NifSkope_targets.pri
|
||||
+++ b/NifSkope_targets.pri
|
||||
@@ -11,7 +11,7 @@ else:EXE = ""
|
||||
## lupdate / lrelease
|
||||
###############################
|
||||
|
||||
-QMAKE_LUPDATE = $$[QT_INSTALL_BINS]/lupdate$${EXE}
|
||||
+QMAKE_LUPDATE = @qttools@/lupdate$${EXE}
|
||||
exists($$QMAKE_LUPDATE) {
|
||||
# Make target for Updating .ts
|
||||
updatets.target = updatets
|
||||
@@ -23,7 +23,7 @@ exists($$QMAKE_LUPDATE) {
|
||||
message("lupdate could not be found, ignoring make target")
|
||||
}
|
||||
|
||||
-QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease$${EXE}
|
||||
+QMAKE_LRELEASE = @qttools@/lrelease$${EXE}
|
||||
exists($$QMAKE_LRELEASE) {
|
||||
# Build Step for Releasing .ts->.qm
|
||||
updateqm.input = TRANSLATIONS
|
|
@ -4066,7 +4066,7 @@ with pkgs;
|
|||
|
||||
niff = callPackage ../tools/package-management/niff { };
|
||||
|
||||
nifskope = callPackage ../tools/graphics/nifskope { };
|
||||
nifskope = libsForQt59.callPackage ../tools/graphics/nifskope { };
|
||||
|
||||
nilfs-utils = callPackage ../tools/filesystems/nilfs-utils {};
|
||||
|
||||
|
|
Loading…
Reference in a new issue