nixpkgs/pkgs/tools/system/java-service-wrapper/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

67 lines
1.7 KiB
Nix

{ lib
, stdenv
, fetchurl
, jdk
, ant
, cunit
, ncurses
}:
stdenv.mkDerivation rec {
pname = "java-service-wrapper";
version = "3.5.59";
src = fetchurl {
url = "https://wrapper.tanukisoftware.com/download/${version}/wrapper_${version}_src.tar.gz";
hash = "sha256-O0fn+s3RIIriVw6sMB2nSKAGtVF0Tz6Ns4Jb9OpcbgY=";
};
strictDeps = true;
buildInputs = [ cunit ncurses ];
nativeBuildInputs = [ ant jdk ];
postConfigure = ''
substituteInPlace default.properties \
--replace "javac.target.version=1.4" "javac.target.version=8"
'';
buildPhase = ''
runHook preBuild
export JAVA_HOME=${jdk}/lib/openjdk/
export JAVA_TOOL_OPTIONS=-Djava.home=$JAVA_HOME
export CLASSPATH=${jdk}/lib/openjdk/lib/tools.jar
ant -f build.xml -Dbits=${if stdenv.hostPlatform.isi686 then "32" else "64"}
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib}
cp bin/wrapper $out/bin/wrapper
cp lib/wrapper.jar $out/lib/wrapper.jar
cp lib/libwrapper.so $out/lib/libwrapper.so
runHook postInstall
'';
meta = with lib; {
description = "Enables a Java Application to be run as a Windows Service or Unix Daemon";
homepage = "https://wrapper.tanukisoftware.com/";
changelog = "https://wrapper.tanukisoftware.com/doc/english/release-notes.html#${version}";
license = licenses.gpl2Only;
platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
maintainers = [ maintainers.suhr ];
mainProgram = "wrapper";
# Broken for Musl at 2024-01-17. Errors as:
# logger.c:81:12: fatal error: gnu/libc-version.h: No such file or directory
# Tracking issue: https://github.com/NixOS/nixpkgs/issues/281557
broken = stdenv.hostPlatform.isMusl;
};
}