swt: 4.5 -> 4.33 & more (#347022)

This commit is contained in:
Doron Behar
2024-10-20 20:02:32 +03:00
committed by GitHub
11 changed files with 114 additions and 160 deletions

View File

@@ -1,48 +0,0 @@
{ lib, stdenv, fetchurl, swt, jre, makeWrapper, alsa-lib, jack2, fluidsynth, libpulseaudio, nixosTests }:
let metadata = assert stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux";
if stdenv.hostPlatform.system == "i686-linux" then
{ arch = "x86"; sha256 = "sha256-k4FQrt72VNb5FdYMzxskcVhKlvx8MZelUlLCItxDB7c="; }
else
{ arch = "x86_64"; sha256 = "sha256-mj5wVQlY2xFzdulvMdb5Qb5HGwr7RElzIkpOLjaAfGA="; };
in stdenv.mkDerivation rec {
version = "1.5.5";
pname = "tuxguitar";
src = fetchurl {
url = "mirror://sourceforge/${pname}/${pname}-${version}-linux-${metadata.arch}.tar.gz";
sha256 = metadata.sha256;
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin
cp -r dist lib share $out/
cp tuxguitar.sh $out/bin/tuxguitar
ln -s $out/dist $out/bin/dist
ln -s $out/lib $out/bin/lib
ln -s $out/share $out/bin/share
wrapProgram $out/bin/tuxguitar \
--set JAVA "${jre}/bin/java" \
--prefix LD_LIBRARY_PATH : "$out/lib/:${lib.makeLibraryPath [ swt alsa-lib jack2 fluidsynth libpulseaudio ]}" \
--prefix CLASSPATH : "${swt}/jars/swt.jar:$out/lib/tuxguitar.jar:$out/lib/itext.jar"
'';
passthru.tests = { inherit (nixosTests) tuxguitar; };
meta = with lib; {
description = "Multitrack guitar tablature editor";
longDescription = ''
TuxGuitar is a multitrack guitar tablature editor and player written
in Java-SWT. It can open GuitarPro, PowerTab and TablEdit files.
'';
homepage = "http://www.tuxguitar.com.ar/";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.lgpl2;
maintainers = [ maintainers.ardumont ];
platforms = platforms.linux;
};
}

View File

@@ -26,5 +26,8 @@ stdenv.mkDerivation rec {
license = licenses.unfree;
platforms = platforms.all;
maintainers = [ ];
# Doesn't launch, gives java related incompatibilities errors. Probably
# related to swt. Same error happens with swt_jdk8
broken = true;
};
}

View File

@@ -4,11 +4,12 @@
, ant
# executable fails to start for jdk > 17
, jdk17
, swt
, makeWrapper
, strip-nondeterminism
}:
stdenv.mkDerivation (finalAttrs: {
}: let
swt-jdk17 = swt.override { jdk = jdk17; };
in stdenv.mkDerivation (finalAttrs: {
pname = "dataexplorer";
version = "3.9.0";
@@ -40,12 +41,15 @@ stdenv.mkDerivation (finalAttrs: {
runHook preInstall
ant -Dprefix=$out/share/ -f build/build.xml install
# Use SWT from nixpkgs
ln -sf '${swt-jdk17}/jars/swt.jar' "$out/share/DataExplorer/java/ext/swt.jar"
# The sources contain a wrapper script in $out/share/DataExplorer/DataExplorer
# but it hardcodes bash shebang and does not pin the java path.
# So we create our own wrapper, using similar cmdline args as upstream.
mkdir -p $out/bin
makeWrapper ${jdk17}/bin/java $out/bin/DataExplorer \
--prefix LD_LIBRARY_PATH : '${swt-jdk17}/lib' \
--add-flags "-Xms64m -Xmx3092m -jar $out/share/DataExplorer/DataExplorer.jar" \
--set SWT_GTK3 0

View File

@@ -9,7 +9,6 @@
autoPatchelfHook,
wrapGAppsHook3,
gtk3,
swt,
glib,
webkitgtk_4_0,
glib-networking,
@@ -65,11 +64,9 @@ stdenvNoCC.mkDerivation (finalAttrs: {
makeWrapper $out/opt/dbeaver/dbeaver $out/bin/dbeaver \
--prefix PATH : "${openjdk17}/bin" \
--set JAVA_HOME "${openjdk17.home}" \
--prefix CLASSPATH : "$out/dbeaver/plugins/*:${swt}/jars/swt.jar" \
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
--prefix LD_LIBRARY_PATH : "$out/lib:${
lib.makeLibraryPath [
swt
gtk3
glib
webkitgtk_4_0

View File

@@ -9,7 +9,6 @@
makeDesktopItem,
openjdk17,
stdenvNoCC,
swt,
webkitgtk_4_0,
wrapGAppsHook3,
gitUpdater,
@@ -29,7 +28,6 @@ let
glib-networking
gtk3
libsecret
swt
webkitgtk_4_0
];
in
@@ -56,7 +54,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
makeWrapper $out/portfolio/PortfolioPerformance $out/bin/portfolio \
--prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
--prefix CLASSPATH : "${swt}/jars/swt.jar" \
--prefix PATH : ${openjdk17}/bin
# Create desktop item

View File

@@ -1,8 +0,0 @@
--- a/make_linux.mak
+++ b/make_linux.mak
@@ -63,4 +63,4 @@
AWT_LFLAGS = -shared ${SWT_LFLAGS}
-AWT_LIBS = -L$(AWT_LIB_PATH) -ljawt
+AWT_LIBS = `pkg-config --libs x11` -L$(AWT_LIB_PATH) -ljawt

View File

@@ -1,14 +0,0 @@
--- a/make_linux.mak
+++ b/make_linux.mak
@@ -53,9 +53,4 @@
-# Do not use pkg-config to get libs because it includes unnecessary dependencies (i.e. pangoxft-1.0)
-GTKCFLAGS = `pkg-config --cflags gtk+-$(GTK_VERSION) gtk+-unix-print-$(GTK_VERSION)`
+GTKCFLAGS = `pkg-config --cflags gtk+-$(GTK_VERSION) gthread-2.0 gtk+-unix-print-$(GTK_VERSION) x11 xtst`
+GTKLIBS = `pkg-config --libs gtk+-$(GTK_VERSION) gthread-2.0 gtk+-unix-print-$(GTK_VERSION) x11 xtst`
-ifeq ($(GTK_VERSION), 3.0)
-GTKLIBS = `pkg-config --libs-only-L gtk+-$(GTK_VERSION) gthread-2.0` $(XLIB64) -L/usr/X11R6/lib -lgtk-3 -lgdk-3 -lcairo -lgthread-2.0 -lXtst
-else
-GTKLIBS = `pkg-config --libs-only-L gtk+-$(GTK_VERSION) gthread-2.0` $(XLIB64) -L/usr/X11R6/lib -lgtk-x11-$(GTK_VERSION) -lgthread-2.0 -lXtst
-endif

View File

@@ -1,13 +1,9 @@
{
atk,
fetchzip,
gtk2,
gtk3,
jdk,
lib,
libGL,
libGLU,
libXt,
libXtst,
pkg-config,
stdenv,
stripJavaArchivesHook,
@@ -15,18 +11,16 @@
stdenv.mkDerivation (finalAttrs: {
pname = "swt";
version = "4.5";
fullVersion = "${finalAttrs.version}-201506032000";
version = "4.33";
fullVersion = "${finalAttrs.version}-202409030240";
hardeningDisable = [ "format" ];
passthru.srcMetadataByPlatform = {
x86_64-linux.platform = "gtk-linux-x86_64";
x86_64-linux.hash = "sha256-JhzRCrVzsM2NBf65l6CDZdgchlbECHGUg0J0bQVT2Z0=";
i686-linux.platform = "gtk-linux-x86";
i686-linux.hash = "sha256-C7H1CUFkl7GPpqDFSzYnlLWa1XcawI2hbtsn9fIJio0=";
x86_64-linux.hash = "sha256-0OUr+jpwTx5/eoA6Uo2E9/SBAtf+IMMiSVRhOfaWFhE=";
x86_64-darwin.platform = "cocoa-macosx-x86_64";
x86_64-darwin.hash = "sha256-CrSFkrlnSP2uQzRrRzv8F0lXEA7TNK9RFe2neDjtXnI=";
x86_64-darwin.hash = "sha256-n948C/YPF55WPYvub3re/wARLP1Wk+XhJiIuI0YQH5c=";
};
passthru.srcMetadata =
finalAttrs.passthru.srcMetadataByPlatform.${stdenv.hostPlatform.system} or null;
@@ -56,84 +50,41 @@ stdenv.mkDerivation (finalAttrs: {
};
nativeBuildInputs = [
jdk
stripJavaArchivesHook
pkg-config
];
buildInputs = [
atk
gtk2
jdk
libGL
gtk3
libGLU
libXtst
] ++ lib.optionals (lib.hasPrefix "8u" jdk.version) [ libXt ];
patches = [
./awt-libs.patch
./gtk-libs.patch
];
prePatch = ''
# clear whitespace from makefiles (since we match on EOL later)
sed -i 's/ \+$//' ./*.mak
SWT_JAVA_HOME = jdk;
AWT_LIB_PATH = "${jdk}/lib/openjdk/lib";
# Used by the makefile which is responsible for the shared objects only
OUTPUT_DIR = "${placeholder "out"}/lib";
# GTK4 is not supported yet. Waiting for:
# https://github.com/eclipse-platform/eclipse.platform.swt/pull/1482
makeFlags = "gtk3";
preBuild = ''
cd library
mkdir -p ${finalAttrs.OUTPUT_DIR}
'';
postPatch =
let
makefile-sed = builtins.toFile "swt-makefile.sed" ''
# fix pkg-config invocations in CFLAGS/LIBS pairs.
#
# change:
# FOOCFLAGS = `pkg-config --cflags `foo bar`
# FOOLIBS = `pkg-config --libs-only-L foo` -lbaz
# into:
# FOOCFLAGS = `pkg-config --cflags foo bar`
# FOOLIBS = `pkg-config --libs foo bar`
#
# the latter works more consistently.
/^[A-Z0-9_]\+CFLAGS = `pkg-config --cflags [^`]\+`$/ {
N
s/${''
^\([A-Z0-9_]\+\)CFLAGS = `pkg-config --cflags \(.\+\)`\
\1LIBS = `pkg-config --libs-only-L .\+$''}/${''
\1CFLAGS = `pkg-config --cflags \2`\
\1LIBS = `pkg-config --libs \2`''}/
}
# fix WebKit libs not being there
s/\$(WEBKIT_LIB) \$(WEBKIT_OBJECTS)$/\0 `pkg-config --libs glib-2.0`/g
'';
in
''
declare -a makefiles=(./*.mak)
sed -i -f ${makefile-sed} "''${makefiles[@]}"
# assign Makefile variables eagerly & change backticks to `$(shell )`
sed -i -e 's/ = `\([^`]\+\)`/ := $(shell \1)/' \
-e 's/`\([^`]\+\)`/$(shell \1)/' \
"''${makefiles[@]}"
'';
buildPhase = ''
runHook preBuild
export JAVA_HOME=${jdk}
./build.sh
# Build the jar
postBuild = ''
cd ../
mkdir out
find org/ -name '*.java' -type f -exec javac -d out/ {} +
runHook postBuild
find org/ -name '*.java' -type f -exec javac -encoding utf8 -d out/ {} +
# Copy non Java resource files
find org/ -not -name '*.java' -not -name '*.html' -type f -exec cp {} out/{} \;
'';
# The makefile doesn't have an install target, the installation of the shared
# objects is part of the `all` target.
installPhase = ''
runHook preInstall
if [[ -n "$prefix" ]]; then
install -d -- "$prefix"
fi
install -Dm 644 -t "$out/lib" -- *.so
install -d -- "$out/jars"
install -m 644 -t out -- version.txt
(cd out && jar -c *) > "$out/jars/swt.jar"
@@ -147,8 +98,14 @@ stdenv.mkDerivation (finalAttrs: {
A widget toolkit for Java to access the user-interface facilities of
the operating systems on which it is implemented.
'';
license = lib.licenses.epl10;
license = with lib.licenses; [
# All of these are located in the about_files directory of the source
ijg
lgpl21
mpl11
mpl20
];
maintainers = [ ];
platforms = lib.platforms.linux;
platforms = lib.attrNames finalAttrs.passthru.srcMetadataByPlatform;
};
})

View File

@@ -0,0 +1,69 @@
{
lib,
stdenv,
fetchurl,
swt,
jre,
makeWrapper,
alsa-lib,
jack2,
fluidsynth,
libpulseaudio,
lilv,
nixosTests,
}:
stdenv.mkDerivation (finalAttrs: {
version = "1.6.4";
pname = "tuxguitar";
src = fetchurl {
url = "https://github.com/helge17/tuxguitar/releases/download/${finalAttrs.version}/tuxguitar-${finalAttrs.version}-linux-swt-amd64.tar.gz";
hash = "sha256-FD1+7jV69E9AfTczjD6DOGD+pPlscg4o8A9ADBUM9B4=";
};
nativeBuildInputs = [
makeWrapper
];
installPhase = ''
mkdir -p $out/bin
cp -r dist lib share $out/
cp tuxguitar.sh $out/bin/tuxguitar
ln -s $out/dist $out/bin/dist
ln -s $out/lib $out/bin/lib
ln -s $out/share $out/bin/share
wrapProgram $out/bin/tuxguitar \
--set JAVA "${jre}/bin/java" \
--prefix LD_LIBRARY_PATH : "$out/lib/:${
lib.makeLibraryPath [
swt
alsa-lib
jack2
fluidsynth
libpulseaudio
lilv
]
}" \
--prefix CLASSPATH : "${swt}/jars/swt.jar:$out/lib/tuxguitar.jar:$out/lib/itext.jar"
'';
passthru.tests = {
nixos = nixosTests.tuxguitar;
};
meta = {
description = "Multitrack guitar tablature editor";
longDescription = ''
TuxGuitar is a multitrack guitar tablature editor and player written
in Java-SWT. It can open GuitarPro, PowerTab and TablEdit files.
'';
homepage = "http://www.tuxguitar.com.ar/";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.lgpl2;
maintainers = with lib.maintainers; [ ardumont ];
platforms = [ "x86_64-linux" ];
};
})

View File

@@ -51,5 +51,7 @@ stdenv.mkDerivation rec {
license = licenses.gpl2Only;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ kylesferrazza totoroot ];
# Very similar issue to hdfview, see: https://github.com/NixOS/nixpkgs/issues/340048
broken = true;
};
}

View File

@@ -32988,11 +32988,6 @@ with pkgs;
tuxedo-rs = callPackage ../os-specific/linux/tuxedo-rs { };
tuxguitar = callPackage ../applications/editors/music/tuxguitar {
jre = jre8;
swt = swt_jdk8;
};
twmn = libsForQt5.callPackage ../applications/misc/twmn { };
testssl = callPackage ../applications/networking/testssl { };