jetbrains.jdk: fix build on aarch64-linux
This commit is contained in:
parent
af62462a93
commit
6def0080d7
2 changed files with 52 additions and 17 deletions
|
@ -27,6 +27,13 @@
|
|||
, udev
|
||||
}:
|
||||
|
||||
let
|
||||
arch = {
|
||||
"aarch64-linux" = "aarch64";
|
||||
"x86_64-linux" = "x64";
|
||||
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
cpu = stdenv.hostPlatform.parsed.cpu.name;
|
||||
in
|
||||
openjdk17.overrideAttrs (oldAttrs: rec {
|
||||
pname = "jetbrains-jdk-jcef";
|
||||
javaVersion = "17.0.7";
|
||||
|
@ -57,22 +64,22 @@ openjdk17.overrideAttrs (oldAttrs: rec {
|
|||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir -p jcef_linux_x64/jmods
|
||||
cp ${jetbrains.jcef}/* jcef_linux_x64/jmods
|
||||
mkdir -p jcef_linux_${arch}/jmods
|
||||
cp ${jetbrains.jcef}/* jcef_linux_${arch}/jmods
|
||||
|
||||
sed \
|
||||
-e "s/OPENJDK_TAG=.*/OPENJDK_TAG=${openjdkTag}/" \
|
||||
-e "s/SOURCE_DATE_EPOCH=.*//" \
|
||||
-e "s/export SOURCE_DATE_EPOCH//" \
|
||||
-i jb/project/tools/common/scripts/common.sh
|
||||
sed -i "s/STATIC_CONF_ARGS/STATIC_CONF_ARGS \$configureFlags/" jb/project/tools/linux/scripts/mkimages_x64.sh
|
||||
sed -i "s/STATIC_CONF_ARGS/STATIC_CONF_ARGS \$configureFlags/" jb/project/tools/linux/scripts/mkimages_${arch}.sh
|
||||
sed \
|
||||
-e "s/create_image_bundle \"jb/#/" \
|
||||
-e "s/echo Creating /exit 0 #/" \
|
||||
-i jb/project/tools/linux/scripts/mkimages_x64.sh
|
||||
-i jb/project/tools/linux/scripts/mkimages_${arch}.sh
|
||||
|
||||
patchShebangs .
|
||||
./jb/project/tools/linux/scripts/mkimages_x64.sh ${build} ${if debugBuild then "fd" else "jcef"}
|
||||
./jb/project/tools/linux/scripts/mkimages_${arch}.sh ${build} ${if debugBuild then "fd" else "jcef"}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
@ -84,9 +91,9 @@ openjdk17.overrideAttrs (oldAttrs: rec {
|
|||
in ''
|
||||
runHook preInstall
|
||||
|
||||
mv build/linux-x86_64-server-${buildType}/images/jdk/man build/linux-x86_64-server-${buildType}/images/jbrsdk${jcefSuffix}-${javaVersion}-linux-x64${debugSuffix}-b${build}
|
||||
rm -rf build/linux-x86_64-server-${buildType}/images/jdk
|
||||
mv build/linux-x86_64-server-${buildType}/images/jbrsdk${jcefSuffix}-${javaVersion}-linux-x64${debugSuffix}-b${build} build/linux-x86_64-server-${buildType}/images/jdk
|
||||
mv build/linux-${cpu}-server-${buildType}/images/jdk/man build/linux-${cpu}-server-${buildType}/images/jbrsdk${jcefSuffix}-${javaVersion}-linux-${arch}${debugSuffix}-b${build}
|
||||
rm -rf build/linux-${cpu}-server-${buildType}/images/jdk
|
||||
mv build/linux-${cpu}-server-${buildType}/images/jbrsdk${jcefSuffix}-${javaVersion}-linux-${arch}${debugSuffix}-b${build} build/linux-${cpu}-server-${buildType}/images/jdk
|
||||
'' + oldAttrs.installPhase + "runHook postInstall";
|
||||
|
||||
postInstall = ''
|
||||
|
|
|
@ -73,6 +73,23 @@ let rpath = lib.makeLibraryPath [
|
|||
];
|
||||
|
||||
buildType = if debugBuild then "Debug" else "Release";
|
||||
platform = {
|
||||
"aarch64-linux" = "linuxarm64";
|
||||
"x86_64-linux" = "linux64";
|
||||
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
arches = {
|
||||
"linuxarm64" = {
|
||||
depsArch = "arm64";
|
||||
projectArch = "arm64";
|
||||
targetArch = "arm64";
|
||||
};
|
||||
"linux64" = {
|
||||
depsArch = "amd64";
|
||||
projectArch = "x86_64";
|
||||
targetArch = "x86_64";
|
||||
};
|
||||
}.${platform};
|
||||
inherit (arches) depsArch projectArch targetArch;
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "jcef-jetbrains";
|
||||
|
@ -92,12 +109,15 @@ in stdenv.mkDerivation rec {
|
|||
hash = "sha256-3HuW8upR/bZoK8euVti2KpCZh9xxfqgyHmgoG1NjxOI=";
|
||||
};
|
||||
cef-bin = let
|
||||
fileName = "cef_binary_111.2.1+g870da30+chromium-111.0.5563.64_linux64_minimal";
|
||||
urlName = builtins.replaceStrings ["+"] ["%2B"] fileName;
|
||||
in fetchzip rec {
|
||||
name = fileName;
|
||||
name = "cef_binary_111.2.1+g870da30+chromium-111.0.5563.64_${platform}_minimal";
|
||||
hash = {
|
||||
"linuxarm64" = "sha256-gCDIfWsysXE8lHn7H+YM3Jag+mdbWwTQpJf0GKdXEVs=";
|
||||
"linux64" = "sha256-r+zXTmDN5s/bYLvbCnHufYdXIqQmCDlbWgs5pdOpLTw=";
|
||||
}.${platform};
|
||||
urlName = builtins.replaceStrings ["+"] ["%2B"] name;
|
||||
in fetchzip {
|
||||
url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2";
|
||||
hash = "sha256-r+zXTmDN5s/bYLvbCnHufYdXIqQmCDlbWgs5pdOpLTw=";
|
||||
inherit name hash;
|
||||
};
|
||||
clang-fmt = fetchurl {
|
||||
url = "https://storage.googleapis.com/chromium-clang-format/dd736afb28430c9782750fc0fd5f0ed497399263";
|
||||
|
@ -128,7 +148,7 @@ in stdenv.mkDerivation rec {
|
|||
mkdir jcef_build
|
||||
cd jcef_build
|
||||
|
||||
cmake -G "Ninja" -DPROJECT_ARCH="x86_64" -DCMAKE_BUILD_TYPE=${buildType} ..
|
||||
cmake -G "Ninja" -DPROJECT_ARCH="${projectArch}" -DCMAKE_BUILD_TYPE=${buildType} ..
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
@ -137,7 +157,7 @@ in stdenv.mkDerivation rec {
|
|||
|
||||
postBuild = ''
|
||||
export JCEF_ROOT_DIR=$(realpath ..)
|
||||
../tools/compile.sh linux64 Release
|
||||
../tools/compile.sh ${platform} Release
|
||||
'';
|
||||
|
||||
# Mostly taken from jb/tools/common/create_modules.sh
|
||||
|
@ -148,8 +168,8 @@ in stdenv.mkDerivation rec {
|
|||
export OUT_NATIVE_DIR=$JCEF_ROOT_DIR/jcef_build/native/${buildType}
|
||||
export JB_TOOLS_DIR=$(realpath ../jb/tools)
|
||||
export JB_TOOLS_OS_DIR=$JB_TOOLS_DIR/linux
|
||||
export OUT_CLS_DIR=$(realpath ../out/linux64)
|
||||
export TARGET_ARCH=x86_64 DEPS_ARCH=amd64
|
||||
export OUT_CLS_DIR=$(realpath ../out/${platform})
|
||||
export TARGET_ARCH=${targetArch} DEPS_ARCH=${depsArch}
|
||||
export OS=linux
|
||||
export JOGAMP_DIR="$JCEF_ROOT_DIR"/third_party/jogamp/jar
|
||||
|
||||
|
@ -183,7 +203,11 @@ in stdenv.mkDerivation rec {
|
|||
jar uf gluegen-rt.jar module-info.class
|
||||
rm module-info.class module-info.java
|
||||
mkdir lib
|
||||
''
|
||||
# see https://github.com/JetBrains/jcef/commit/f3b787e3326c1915d663abded7f055c0866f32ec
|
||||
+ lib.optionalString (platform != "linuxarm64") ''
|
||||
extract_jar "$JOGAMP_DIR"/gluegen-rt-natives-"$OS"-"$DEPS_ARCH".jar lib natives/"$OS"-"$DEPS_ARCH"
|
||||
'' + ''
|
||||
|
||||
cd ../jogl
|
||||
cp "$JOGAMP_DIR"/gluegen-rt.jar .
|
||||
|
@ -193,7 +217,11 @@ in stdenv.mkDerivation rec {
|
|||
jar uf jogl-all.jar module-info.class
|
||||
rm module-info.class module-info.java
|
||||
mkdir lib
|
||||
''
|
||||
# see https://github.com/JetBrains/jcef/commit/f3b787e3326c1915d663abded7f055c0866f32ec
|
||||
+ lib.optionalString (platform != "linuxarm64") ''
|
||||
extract_jar "$JOGAMP_DIR"/jogl-all-natives-"$OS"-"$DEPS_ARCH".jar lib natives/"$OS"-"$DEPS_ARCH"
|
||||
'' + ''
|
||||
|
||||
cd ../jcef
|
||||
cp "$OUT_CLS_DIR"/jcef.jar .
|
||||
|
|
Loading…
Reference in a new issue