15 stripJavaArchivesHook,
49 assert !stdenv.hostPlatform.isDarwin;
53 rpath = lib.makeLibraryPath [
82 buildType = if debugBuild then "Debug" else "Release";
85 "aarch64-linux" = "linuxarm64";
86 "x86_64-linux" = "linux64";
88 .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
93 projectArch = "arm64";
98 projectArch = "x86_64";
99 targetArch = "x86_64";
103 inherit (arches) depsArch projectArch targetArch;
106 stdenv.mkDerivation rec {
107 pname = "jcef-jetbrains";
108 rev = "34dfd656652c24da31b89c39d0885f284722eeaa";
109 # This is the commit number
110 # Currently from the branch: https://github.com/JetBrains/jcef/tree/242
111 # Run `git rev-list --count HEAD`
114 nativeBuildInputs = [
123 stripJavaArchivesHook
134 src = fetchFromGitHub {
138 hash = "sha256-JlTGKqvgdBpBs2xtFMTVJ/ZksT1uME/8a2g7niH2sq8=";
142 # `cef_binary_${CEF_VERSION}_linux64_minimal`, where CEF_VERSION is from $src/CMakeLists.txt
143 name = "cef_binary_122.1.9+gd14e051+chromium-122.0.6261.94_${platform}_minimal";
146 "linuxarm64" = "sha256-wABtvz0JHitlkkB748I7yr02Oxs5lXvqDfrBAQiKWHU=";
147 "linux64" = "sha256-qlutM0IsE1emcMe/3p7kwMIK7ou1rZGvpUkrSMVPnCc=";
150 urlName = builtins.replaceStrings [ "+" ] [ "%2B" ] name;
153 url = "https://cef-builds.spotifycdn.com/${urlName}.tar.bz2";
156 # Find the hash in tools/buildtools/linux64/clang-format.sha1
157 clang-fmt = fetchurl {
158 url = "https://storage.googleapis.com/chromium-clang-format/dd736afb28430c9782750fc0fd5f0ed497399263";
159 hash = "sha256-4H6FVO9jdZtxH40CSfS+4VESAHgYgYxfCBFSMHdT0hE=";
167 cp -r ${cef-bin} third_party/cef/${cef-bin.name}
168 chmod +w -R third_party/cef/${cef-bin.name}
169 patchelf third_party/cef/${cef-bin.name}/${buildType}/libcef.so --set-rpath "${rpath}" --add-needed libudev.so
170 patchelf third_party/cef/${cef-bin.name}/${buildType}/libGLESv2.so --set-rpath "${rpath}" --add-needed libGL.so.1
171 patchelf third_party/cef/${cef-bin.name}/${buildType}/chrome-sandbox --set-interpreter $(cat $NIX_BINTOOLS/nix-support/dynamic-linker)
172 sed 's/-O0/-O2/' -i third_party/cef/${cef-bin.name}/cmake/cef_variables.cmake
175 -e 's|os.path.isdir(os.path.join(path, \x27.git\x27))|True|' \
176 -e 's|"%s rev-parse %s" % (git_exe, branch)|"echo '${rev}'"|' \
177 -e 's|"%s config --get remote.origin.url" % git_exe|"echo 'https://github.com/jetbrains/jcef'"|' \
178 -e 's|"%s rev-list --count %s" % (git_exe, branch)|"echo '${version}'"|' \
181 cp ${clang-fmt} tools/buildtools/linux64/clang-format
182 chmod +w tools/buildtools/linux64/clang-format
185 -e 's|include(cmake/vcpkg.cmake)||' \
186 -e 's|bring_vcpkg()||' \
187 -e 's|vcpkg_install_package(boost-filesystem boost-interprocess thrift)||' \
190 sed -e 's|vcpkg_bring_host_thrift()|set(THRIFT_COMPILER_HOST ${thrift}/bin/thrift)|' -i remote/CMakeLists.txt
195 cmake -G "Ninja" -DPROJECT_ARCH="${projectArch}" -DCMAKE_BUILD_TYPE=${buildType} ..
197 runHook postConfigure
206 export JCEF_ROOT_DIR=$(realpath ..)
207 ../tools/compile.sh ${platform} Release
210 # N.B. For new versions, manually synchronize the following
211 # definitions with jb/tools/common/create_modules.sh to include
212 # newly added modules
217 export JCEF_ROOT_DIR=$(realpath ..)
218 export THRIFT_DIR="$JCEF_ROOT_DIR"/third_party/thrift
219 export THRIFT_JAR=libthrift-0.19.0.jar
220 export OUT_NATIVE_DIR=$JCEF_ROOT_DIR/jcef_build/native/${buildType}
221 export JB_TOOLS_DIR=$(realpath ../jb/tools)
222 export JB_TOOLS_OS_DIR=$JB_TOOLS_DIR/linux
223 export OUT_CLS_DIR=$(realpath ../out/${platform})
224 export TARGET_ARCH=${targetArch} DEPS_ARCH=${depsArch}
226 export JOGAMP_DIR="$JCEF_ROOT_DIR"/third_party/jogamp/jar
228 mkdir -p $unpacked/{jogl,gluegen,jcef}
230 function extract_jar {
233 __content_dir="''${3:-.}"
234 __tmp=.tmp_extract_jar
235 rm -rf "$__tmp" && mkdir "$__tmp"
237 cd "$__tmp" || exit 1
240 rm -rf "$__tmp/META-INF"
241 rm -rf "$__dst_dir" && mkdir "$__dst_dir"
242 if [ -z "$__content_dir" ]
244 cp -R "$__tmp"/* "$__dst_dir"
246 cp -R "$__tmp"/"$__content_dir"/* "$__dst_dir"
252 cp "$JOGAMP_DIR"/gluegen-rt.jar .
253 cp "$JB_TOOLS_DIR"/common/gluegen-module-info.java module-info.java
254 javac --patch-module gluegen.rt=gluegen-rt.jar module-info.java
255 jar uf gluegen-rt.jar module-info.class
256 rm module-info.class module-info.java
259 # see https://github.com/JetBrains/jcef/commit/f3b787e3326c1915d663abded7f055c0866f32ec
260 + lib.optionalString (platform != "linuxarm64") ''
261 extract_jar "$JOGAMP_DIR"/gluegen-rt-natives-"$OS"-"$DEPS_ARCH".jar lib natives/"$OS"-"$DEPS_ARCH"
266 cp "$JOGAMP_DIR"/gluegen-rt.jar .
267 cp "$JOGAMP_DIR"/jogl-all.jar .
268 cp "$JB_TOOLS_OS_DIR"/jogl-module-info.java module-info.java
269 javac --module-path . --patch-module jogl.all=jogl-all.jar module-info.java
270 jar uf jogl-all.jar module-info.class
271 rm module-info.class module-info.java
274 # see https://github.com/JetBrains/jcef/commit/f3b787e3326c1915d663abded7f055c0866f32ec
275 + lib.optionalString (platform != "linuxarm64") ''
276 extract_jar "$JOGAMP_DIR"/jogl-all-natives-"$OS"-"$DEPS_ARCH".jar lib natives/"$OS"-"$DEPS_ARCH"
281 cp "$THRIFT_DIR"/"$THRIFT_JAR" .
282 cp "$JB_TOOLS_DIR"/common/thrift-module-info.java module-info.java
283 javac --patch-module org.apache.thrift=$THRIFT_JAR module-info.java
284 jar uf $THRIFT_JAR module-info.class
285 rm module-info.class module-info.java
286 cp "$OUT_CLS_DIR"/jcef.jar .
288 cp -R "$OUT_NATIVE_DIR"/* lib
292 bash "$JB_TOOLS_DIR"/common/create_version_file.sh $out
297 dontStrip = debugBuild;
301 jmod create --class-path gluegen-rt.jar --libs lib $out/jmods/gluegen.rt.jmod
303 jmod create --module-path . --class-path jogl-all.jar --libs lib $out/jmods/jogl.all.jmod
305 jmod create --module-path . --class-path jcef.jar --libs lib $out/jmods/jcef.jmod
306 jmod create --module-path . --class-path $THRIFT_JAR $out/jmods/org.apache.thrift.jmod
308 # stripJavaArchivesHook gets rid of jar file timestamps, but not of jmod file timestamps
309 # We have to manually call strip-nondeterminism to do this for jmod files too
310 find $out -name "*.jmod" -exec strip-nondeterminism --type jmod {} +
314 description = "Jetbrains' fork of JCEF";
315 license = lib.licenses.bsd3;
316 homepage = "https://github.com/JetBrains/JCEF";