about summary refs log tree commit diff
path: root/pkgs/applications/editors/jedit
diff options
context:
space:
mode:
authorTomaSajt <62384384+TomaSajt@users.noreply.github.com>2024-03-19 20:43:04 +0100
committerTomaSajt <62384384+TomaSajt@users.noreply.github.com>2024-04-23 08:17:56 +0200
commit142c5ec2dd6a78967efa4f81c48d1336b28565a9 (patch)
treeb79af35dd183cf4ae1cb2bd5fa535588a56c6f78 /pkgs/applications/editors/jedit
parent65d8de75bd039037e896b6c9c18c7f426f74d668 (diff)
jedit: 5.2.0 -> 5.6.0-unstable-2023-11-19, adopt and rewrite
Diffstat (limited to 'pkgs/applications/editors/jedit')
-rw-r--r--pkgs/applications/editors/jedit/build.xml.patch257
-rw-r--r--pkgs/applications/editors/jedit/default.nix151
2 files changed, 103 insertions, 305 deletions
diff --git a/pkgs/applications/editors/jedit/build.xml.patch b/pkgs/applications/editors/jedit/build.xml.patch
deleted file mode 100644
index 2f630f18ab76e..0000000000000
--- a/pkgs/applications/editors/jedit/build.xml.patch
+++ /dev/null
@@ -1,257 +0,0 @@
---- a/build.xml	2015-02-04 08:47:37.000000000 +0100
-+++ b/build.xml	2015-02-17 14:06:42.455283148 +0100
-@@ -43,16 +43,6 @@
- 	<property name="textAreaPackage"
- 		  location="../textarea"/>
- 
--	<!-- Ivy Properties -->
--	<property name="config.ivy.version"
--		  value="2.2.0"/>
--	<property name="ivy.jar.dir"
--		  location="${lib.dir}/ivy"/>
--	<property name="ivy.jar.filename"
--		  value="ivy-${config.ivy.version}.jar"/>
--	<property name="ivy.jar.file"
--		  location="${ivy.jar.dir}/${ivy.jar.filename}"/>
--
- 	<!-- Miscellaneous -->
- 	<property name="jar.filename"
- 		  value="${ant.project.name}.jar"/>
-@@ -90,51 +80,8 @@
- 			  value="true"/>
- 	</target>
- 
--	<target name="check-ivy"
--		depends="init">
--		<available property="ivy.jar.present"
--			   file="${ivy.jar.file}"
--			   type="file"/>
--	</target>
--
--	<target name="download-ivy"
--		depends="init,check-ivy"
--		unless="ivy.jar.present">
--		<mkdir dir="${ivy.jar.dir}"/>
--		<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${config.ivy.version}/ivy-${config.ivy.version}.jar"
--		     dest="${ivy.jar.file}"
--		     usetimestamp="true"/>
--	</target>
--
--	<target name="init-ivy"
--		depends="init,download-ivy"
--		unless="ivy.done">
--		<property name="ivy.retrieve.pattern"
--			  value="${lib.dir}/[conf]/[artifact](-[classifier]).[ext]"/>
--		<taskdef resource="org/apache/ivy/ant/antlib.xml"
--			 classpath="${ivy.jar.file}"
--			 loaderref="ivy.loader"
--			 uri="antlib:org.apache.ivy.ant"/>
--		<ivy:settings file="ivysettings.xml"/>
--	</target>
--
--	<target name="retrieve"
--		description="retrieve the dependencies"
--		depends="init,init-ivy"
--		unless="ivy.done">
--		<ivy:retrieve sync="true"/>
--		<ivy:retrieve pattern="${lib.dir}/ivy/[artifact]-[revision].[ext]"
--			      organisation="org.apache.ivy"
--			      module="ivy"
--			      revision="${config.ivy.version}"
--			      conf="default"
--			      inline="true"/>
--		<property name="ivy.done"
--			  value="true"/>
--	</target>
--
- 	<target name="setup"
--		depends="init,retrieve">
-+		depends="init">
- 		<taskdef resource="net/sf/antcontrib/antlib.xml"
- 			 uri="antlib:net.sf.antcontrib">
- 			<classpath>
-@@ -239,37 +186,6 @@
- 		</javac>
- 	</target>
- 
--	<target name="compile-test"
--		depends="init,retrieve,compile">
--		<mkdir dir="${classes.dir}/test"/>
--		<depend srcDir="${basedir}/test"
--			destDir="${classes.dir}/test"
--			cache="${classes.dir}"/>
--		<dependset>
--			<srcfilelist files="build.xml"/>
--			<srcfilelist files="ivy.xml"/>
--			<targetfileset dir="${classes.dir}/test"/>
--		</dependset>
--		<javac srcdir="test"
--		       destdir="${classes.dir}/test"
--		       debug="true"
--		       debuglevel="${config.build.debuglevel}"
--		       nowarn="${config.build.nowarn}"
--		       deprecation="${config.build.deprecation}"
--		       source="${target.java.version}"
--		       target="${target.java.version}"
--		       compiler="modern"
--		       encoding="UTF-8"
--		       includeAntRuntime="false">
--			<classpath id="classpath.test">
--				<fileset dir="${lib.dir}/test"
--					 includes="*.jar"/>
--				<pathelement location="${classes.dir}/core"/>
--			</classpath>
--			<compilerarg line="${config.build.compilerarg}"/>
--		</javac>
--	</target>
--
- 	<target name="prepare-textArea"
- 		depends="init">
- 		<delete includeemptydirs="true"
-@@ -423,33 +339,8 @@
- 		</javac>
- 	</target>
- 
--	<target name="test"
--		depends="init,retrieve,compile,compile-test"
--		description="run unit tests"
--		unless="skip.tests">
--		<delete dir="${build.dir}/test/raw-reports"/>
--		<mkdir dir="${build.dir}/test/raw-reports"/>
--		<junit printsummary="true"
--		       failureproperty="tests.failed"
--		       enabletestlistenerevents="true">
--			<classpath refid="classpath.test"/>
--			<classpath location="${classes.dir}/test"/>
--			<formatter type="xml"/>
--			<batchtest todir="${build.dir}/test/raw-reports">
--				<fileset dir="test"/>
--			</batchtest>
--		</junit>
--		<mkdir dir="${build.dir}/test/merged-reports"/>
--		<junitreport todir="${build.dir}/test/merged-reports">
--			<fileset dir="${build.dir}/test/raw-reports"/>
--			<report todir="${build.dir}/test/reports"/>
--		</junitreport>
--		<fail message="Unit test(s) failed! See reports at ${build.dir}/test/reports/index.html"
--		      if="tests.failed"/>
--	</target>
--
- 	<target name="build"
--		depends="init,retrieve,setup,compile"
-+		depends="init,setup,compile"
- 		description="build the jEdit JAR-file with full debug-information">
- 		<mkdir dir="${jar.location}"/>
- 		<jar destfile="${jar.location}/${jar.filename}"
-@@ -504,11 +395,10 @@
- 				</copy>
- 			</contrib:then>
- 		</contrib:if>
--		<antcall target="test" />
- 	</target>
- 
- 	<target name="build-exe-launcher"
--		depends="init,retrieve,setup,filter-package-files"
-+		depends="init,setup,filter-package-files"
- 		description="build the EXE launcher">
- 		<contrib:if>
- 			<os family="windows"/>
-@@ -622,7 +512,7 @@
- 	</target>
- 
- 	<target name="unpack-docbook-xsl"
--		depends="init,retrieve">
-+		depends="init">
- 		<unzip src="${lib.dir}/docbook/docbook-xsl-resources.zip"
- 		       dest="${build.dir}/docbook-xsl/"/>
- 	</target>
-@@ -668,7 +558,7 @@
- 	</presetdef>
- 
- 	<target name="generate-doc-faq"
--		depends="init,retrieve,setup,unpack-docbook-xsl">
-+		depends="init,setup,unpack-docbook-xsl">
- 		<dependset.html>
- 			<srcfileset dir="doc/FAQ"/>
- 			<targetfileset dir="${jar.location}/doc/FAQ"/>
-@@ -692,7 +582,7 @@
- 	</target>
- 
- 	<target name="generate-doc-news"
--		depends="init,retrieve,setup,unpack-docbook-xsl">
-+		depends="init,setup,unpack-docbook-xsl">
- 		<dependset.html>
- 			<srcfileset dir="doc/whatsnew"/>
- 			<targetfileset dir="${jar.location}/doc/whatsnew"/>
-@@ -716,7 +606,7 @@
- 	</target>
- 
- 	<target name="generate-doc-users-guide"
--		depends="init,retrieve,setup,unpack-docbook-xsl">
-+		depends="init,setup,unpack-docbook-xsl">
- 		<dependset.html>
- 			<srcfileset dir="doc/users-guide"/>
- 			<targetfileset dir="${jar.location}/doc/users-guide"/>
-@@ -851,7 +741,7 @@
- 	</target>
- 
- 	<target name="generate-pdf-users-guide"
--		depends="init,retrieve,setup,unpack-docbook-xsl">
-+		depends="init,setup,unpack-docbook-xsl">
- 		<fail message="Please set the property &quot;paper.type&quot;"
- 		      unless="paper.type"/>
- 		<contrib:switch value="${paper.type}">
-@@ -1154,7 +1044,7 @@
- 	</target>
- 
- 	<target name="compile-jarbundler"
--		depends="init,retrieve">
-+		depends="init">
- 		<mkdir dir="${classes.dir}/jarbundler"/>
- 		<depend srcDir="${basedir}"
- 			destDir="${classes.dir}/jarbundler"
-@@ -1180,7 +1070,7 @@
- 	</target>
- 
- 	<target name="dist-mac-finish"
--		depends="init,retrieve,setup"
-+		depends="init,setup"
- 		description="finish building the Mac OS X disk image (DMG-file) on Mac OS X">
- 		<fail message="The disk image (DMG-file) for easy distribution on Mac OS X can only be built on Mac OS X currently">
- 			<condition>
-@@ -1295,7 +1185,7 @@
- 	</target>
- 
- 	<target name="dist-mac"
--		depends="init,retrieve,setup,prepare-dist-files"
-+		depends="init,setup,prepare-dist-files"
- 		description="build the Mac OS X disk image (DMG-file)">
- 		<antcall target="compile-jarbundler">
- 			<param name="config.build.debuglevel"
-@@ -1411,7 +1301,7 @@
- 	</target>
- 
- 	<target name="prepare-dist-files"
--		depends="init,retrieve,setup">
-+		depends="init,setup">
- 		<antcall target="build">
- 			<param name="config.build.debuglevel"
- 			       value="lines,source"/>
-@@ -1592,7 +1482,7 @@
- 	</target>
- 
- 	<target name="dist-deb"
--		depends="init,retrieve,setup,prepare-dist-files"
-+		depends="init,setup,prepare-dist-files"
- 		description="build the DEB Package">
- 		<antcall target="compile-ar">
- 			<param name="config.build.debuglevel"
-@@ -1838,7 +1728,7 @@
- 	</target>
- 
- 	<target name="dist-sign-deb-Release"
--		depends="init,retrieve,setup"
-+		depends="init,setup"
- 		description="sign the DEB Release file">
- 		<contrib:if>
- 			<not>
diff --git a/pkgs/applications/editors/jedit/default.nix b/pkgs/applications/editors/jedit/default.nix
index fe9284873551e..8fdf8e7c8de26 100644
--- a/pkgs/applications/editors/jedit/default.nix
+++ b/pkgs/applications/editors/jedit/default.nix
@@ -1,63 +1,118 @@
-{ lib, stdenv, fetchurl, ant, jdk, commonsBsf, commonsLogging, bsh }:
+{
+  lib,
+  stdenv,
+  fetchsvn,
+  ant,
+  jdk,
+  jre,
+  xmlstarlet,
+  makeWrapper,
+  stripJavaArchivesHook,
+}:
 
-let
-  version = "5.2.0";
-  bcpg = fetchurl {
-    url = "mirror://maven/org/bouncycastle/bcpg-jdk16/1.46/bcpg-jdk16-1.46.jar";
-    sha256 = "16xhmwks4l65m5x150nd23y5lyppha9sa5fj65rzhxw66gbli82d";
-  };
-  jsr305 = fetchurl {
-    url = "mirror://maven/com/google/code/findbugs/jsr305/2.0.0/jsr305-2.0.0.jar";
-    sha256 = "0s74pv8qjc42c7q8nbc0c3b1hgx0bmk3b8vbk1z80p4bbgx56zqy";
-  };
-in
-
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   pname = "jedit";
-  inherit version;
-  src = fetchurl {
-    url = "mirror://sourceforge/jedit/jedit${version}source.tar.bz2";
-    sha256 = "03wmbh90rl5lsc35d7jwcp9j5qyyzq1nccxf4fal8bmnx8n4si0x";
+  version = "5.6.0-unstable-2023-11-19";
+
+  src = fetchsvn {
+    url = "https://svn.code.sf.net/p/jedit/svn/jEdit/trunk";
+    rev = "25703";
+    hash = "sha256-z1KTZqKl6Dlqayw/3h/JvHQK3kSfio02R8V6aCb4g4Q=";
   };
 
-  buildInputs = [ ant jdk commonsBsf commonsLogging ];
+  ivyDeps = stdenv.mkDerivation {
+    name = "${finalAttrs.pname}-${finalAttrs.version}-ivy-deps";
+    inherit (finalAttrs) src;
+
+    nativeBuildInputs = [
+      ant
+      jdk
+      xmlstarlet
+    ];
 
-  # This patch removes from the build process:
-  #  - the automatic download of dependencies (see configurePhase);
-  #  - the tests
-  patches = [ ./build.xml.patch ];
+    # set defaultCacheDir to something that can exist
+    # this directory won't get copied, but needs to be set properly
+    configurePhase = ''
+      runHook preConfigure
 
-  configurePhase = ''
-    mkdir -p lib/ant-contrib/ lib/scripting lib/compile lib/default-plugins
-    cp ${ant}/lib/ant/lib/ant-contrib-*.jar lib/ant-contrib/
-    cp ${bsh} ${bcpg} lib/scripting/
-    cp ${jsr305} lib/compile/
+      xmlstarlet ed --subnode /ivysettings -t elem -n caches ivysettings.xml \
+          | xmlstarlet ed --insert /ivysettings/caches -t attr -n defaultCacheDir -v "$(pwd)/ivy-cache" \
+          > ivysettings.xml.tmp
+      mv ivysettings.xml.tmp ivysettings.xml
+
+      runHook postConfigure
+    '';
+
+    buildPhase = ''
+      runHook preBuild
+      ant retrieve
+      runHook postBuild
+    '';
+
+    installPhase = ''
+      runHook preInstall
+      mkdir -p $out/lib
+      cp -r lib/* $out/lib
+      runHook postInstall
+    '';
+
+    outputHashMode = "recursive";
+    outputHashAlgo = "sha256";
+    outputHash = "sha256-J5i5IhXlXw84y/4K6Vt84au4eVXVLupmtfscO+y1Fi0=";
+  };
+
+  # ignore a test failing because of the build environment
+  postPatch = ''
+    substituteInPlace test/org/gjt/sp/jedit/MiscUtilitiesTest.java \
+        --replace-fail "public class MiscUtilitiesTest" "@org.junit.Ignore public class MiscUtilitiesTest"
   '';
 
-  buildPhase = "ant build";
+  nativeBuildInputs = [
+    ant
+    jdk
+    makeWrapper
+    stripJavaArchivesHook
+  ];
+
+  buildPhase = ''
+    runHook preBuild
+    ln -s ${finalAttrs.ivyDeps}/lib ./lib
+    ant build -Divy.done=true
+    runHook postBuild
+  '';
 
   installPhase = ''
+    runHook preInstall
+
     mkdir -p $out/share/jEdit
-    cp -r build/jedit.jar doc icons keymaps macros modes startup $out/share/jEdit
-
-    sed -i "s|Icon=.*|Icon=$out/share/jEdit/icons/jedit-icon48.png|g" package-files/linux/deb/jedit.desktop
-    mkdir -p $out/share/applications
-    mv package-files/linux/deb/jedit.desktop $out/share/applications/jedit.desktop
-
-    # specify the correct JAVA_HOME
-    sed -i '1a JAVA_HOME=${jdk}' package-files/linux/jedit
-    sed -i "s|/usr/share/jEdit/@jar.filename@|$out/share/jEdit/jedit.jar|g" package-files/linux/jedit
-    mkdir -p $out/bin
-    cp package-files/linux/jedit $out/bin/jedit
-    chmod +x $out/bin/jedit
+    cp -r build/jedit.jar doc keymaps macros modes startup $out/share/jEdit
+
+    install -Dm644 icons/jedit-icon48.png $out/share/icons/hicolor/48x48/apps/jedit.png
+    install -Dm644 package-files/linux/deb/jedit.desktop -t $out/share/applications
+
+    sed -i $out/share/applications/jedit.desktop \
+        -e "s|Icon=.*|Icon=jedit|g" \
+        -e "s|Exec=.*|Exec=jedit|g"
+
+    install -Dm755 package-files/linux/jedit -t $out/bin
+    substituteInPlace $out/bin/jedit \
+        --replace-fail "/usr/share/jEdit/@jar.filename@" "$out/share/jEdit/jedit.jar"
+
+    wrapProgram $out/bin/jedit --set JAVA_HOME ${jre}
+
+    runHook postInstall
   '';
 
-  meta = with lib; {
-    description = "Mature programmer's text editor (Java based)";
+  meta = {
+    description = "A programmer's text editor written in Java";
     homepage = "http://www.jedit.org";
-    sourceProvenance = with sourceTypes; [ binaryBytecode ];
-    license = licenses.gpl2;
-    platforms = platforms.unix;
-    maintainers = [ ];
+    license = lib.licenses.gpl2Only;
+    mainProgram = "jedit";
+    maintainers = with lib.maintainers; [ tomasajt ];
+    platforms = lib.platforms.unix;
+    sourceProvenance = with lib.sourceTypes; [
+      fromSource
+      binaryBytecode # ivyDeps contains .jar dependencies
+    ];
   };
-}
+})