about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-01-04 23:46:14 +0100
committerGitHub <noreply@github.com>2024-01-04 23:46:14 +0100
commit160cff599b4cb21b8d124aaaf2862797d9f7f560 (patch)
tree7e83925536c5cf2a035f56dbb866b6dab0bfef05 /pkgs
parent7afe9bc384ce9f8832e77f8b72157ab50b656aa8 (diff)
parentca8e544e4e3db7bba1c18eab0cb62505782086cc (diff)
Merge pull request #278530 from TomaSajt/calcoo
calcoo: make deterministic and clean up
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/calcoo/0001-javac-encoding.diff21
-rw-r--r--pkgs/applications/misc/calcoo/default.nix32
2 files changed, 15 insertions, 38 deletions
diff --git a/pkgs/applications/misc/calcoo/0001-javac-encoding.diff b/pkgs/applications/misc/calcoo/0001-javac-encoding.diff
deleted file mode 100644
index c16616b3dd044..0000000000000
--- a/pkgs/applications/misc/calcoo/0001-javac-encoding.diff
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -Naur calcoo-2.1.0-old/build.xml calcoo-2.1.0-new/build.xml
---- calcoo-2.1.0-old/build.xml	1969-12-31 21:00:01.000000000 -0300
-+++ calcoo-2.1.0-new/build.xml	2022-04-16 15:41:59.763861191 -0300
-@@ -16,7 +16,7 @@
-     <!-- Create the build directory structure used by compile -->

-     <mkdir dir="${build}"/>

-     <!-- Compile the java code from ${src} into ${build} -->

--    <javac srcdir="${src}" destdir="${build}" includeantruntime="false"/>

-+    <javac srcdir="${src}" destdir="${build}" includeantruntime="false" encoding="iso-8859-1"/>

-   </target>

- 

-   <target name="copyresource" depends="compile">

-@@ -31,7 +31,7 @@
-   <target name="testcompile">

-     <mkdir dir="${testbuild}"/>

-     <!-- Compile the java code from ${testsrc} into ${testbuild} -->

--    <javac srcdir="${testsrc}" destdir="${testbuild}" includeantruntime="false">

-+    <javac srcdir="${testsrc}" destdir="${testbuild}" includeantruntime="false" encoding="iso-8859-1">

- 		<classpath>

- 			<pathelement location="${junitpath}\junit.jar"/>

- 			<pathelement location="${junitpath}\hamcrest-core.jar"/>

diff --git a/pkgs/applications/misc/calcoo/default.nix b/pkgs/applications/misc/calcoo/default.nix
index b0fc6da5eb465..5f90b4bb23636 100644
--- a/pkgs/applications/misc/calcoo/default.nix
+++ b/pkgs/applications/misc/calcoo/default.nix
@@ -2,57 +2,55 @@
 , stdenv
 , fetchzip
 , ant
+, canonicalize-jars-hook
 , jdk
 , makeWrapper
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "calcoo";
   version = "2.1.0";
 
   src = fetchzip {
-    url = "mirror://sourceforge/project/calcoo/calcoo/${version}/${pname}-${version}.zip";
+    url = "mirror://sourceforge/calcoo/calcoo-${finalAttrs.version}.zip";
     hash = "sha256-Bdavj7RaI5CkWiOJY+TPRIRfNelfW5qdl/74J1KZPI0=";
   };
 
-  patches = [
-    # Sets javac encoding option on build.xml
-    ./0001-javac-encoding.diff
-  ];
-
   nativeBuildInputs = [
     ant
+    canonicalize-jars-hook
     jdk
     makeWrapper
   ];
 
   dontConfigure = true;
 
+  env.JAVA_TOOL_OPTIONS = "-Dfile.encoding=iso-8859-1";
+
   buildPhase = ''
     runHook preBuild
-
     ant
-
     runHook postBuild
   '';
 
   installPhase = ''
     runHook preInstall
 
-    mkdir -p $out/bin $out/share/${pname}
-    mv dist/lib/calcoo.jar $out/share/${pname}
+    install -Dm644 dist/lib/calcoo.jar -t $out/share/calcoo
 
     makeWrapper ${jdk}/bin/java $out/bin/calcoo \
-    --add-flags "-jar $out/share/${pname}/calcoo.jar"
+        --add-flags "-jar $out/share/calcoo/calcoo.jar"
 
     runHook postInstall
   '';
 
-  meta = with lib; {
-    homepage = "https://calcoo.sourceforge.net/";
+  meta = {
+    changelog = "https://calcoo.sourceforge.net/changelog.html";
     description = "RPN and algebraic scientific calculator";
-    license = licenses.gpl2Plus;
-    maintainers = with maintainers; [ AndersonTorres ];
+    homepage = "https://calcoo.sourceforge.net/";
+    license = lib.licenses.gpl2Plus;
+    mainProgram = "calcoo";
+    maintainers = with lib.maintainers; [ AndersonTorres ];
     inherit (jdk.meta) platforms;
   };
-}
+})