mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[platform] arch-independent names of Linux binary artifacts
GitOrigin-RevId: cf35459a0cce96ba1b21b8462c784933f51d58e5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6fbd1c32a7
commit
825c930c50
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
set -euo pipefail
|
||||
|
||||
VER="${1:-}"
|
||||
@@ -6,33 +7,19 @@ if [ -z "${VER:-}" ]; then
|
||||
VER=$(date "+%Y%m%d.%H%M")
|
||||
fi
|
||||
|
||||
rm -f fsnotifier
|
||||
${CC:-clang} -O2 -Wall -Wextra -Wpedantic -D "VERSION=\"$VER\"" -std=c11 main.c inotify.c util.c -o fsnotifier && \
|
||||
chmod 755 fsnotifier || \
|
||||
exit 1
|
||||
|
||||
# ensuring supported builds are compatible with RHEL/CentOS 7
|
||||
MAX_GLIBC_VERSION="2.17"
|
||||
ARCH=$(uname -m)
|
||||
|
||||
# To make sure it's compatible with old Linux distributions, e.g. CentOS 7
|
||||
max_allowed_glibc_version="2.17"
|
||||
|
||||
build_fsnotifier() {
|
||||
[ -f "$1" ] && rm "$1"
|
||||
${CC:-clang} -O2 -Wall -Wextra -Wpedantic -D "VERSION=\"$VER\"" -std=c11 main.c inotify.c util.c -o "$1"
|
||||
chmod 755 "$1"
|
||||
echo "Checking $1 for glibc version compatibility..."
|
||||
glibc_version="$(objdump -x "$1" | grep -o "GLIBC_.*" | sort | uniq | cut -d _ -f 2 | sort -V | tail -n 1)"
|
||||
newest=$(printf "%s\n%s\n" "$max_allowed_glibc_version" "$glibc_version" | sort -V | tail -n 1)
|
||||
if [ "$newest" != "$max_allowed_glibc_version" ]; then
|
||||
echo "ERROR: $1 uses glibc version $glibc_version which is newer than $max_allowed_glibc_version"
|
||||
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ] || [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
glibc_version="$(objdump -x fsnotifier | grep -o "GLIBC_.*" | sort | uniq | cut -d _ -f 2 | sort -V | tail -n 1)"
|
||||
newest=$(printf "%s\n%s\n" "$MAX_GLIBC_VERSION" "$glibc_version" | sort -V | tail -n 1)
|
||||
if [ "$newest" != "$MAX_GLIBC_VERSION" ]; then
|
||||
echo "ERROR: fsnotifier uses glibc version $glibc_version which is newer than $MAX_GLIBC_VERSION"
|
||||
exit 1
|
||||
else
|
||||
echo "OK: $1 uses glibc version $glibc_version"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
|
||||
echo "*** Compiling amd64 version (fsnotifier) ..."
|
||||
build_fsnotifier fsnotifier
|
||||
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
echo "*** Compiling aarch64 version (fsnotifier-aarch64)..."
|
||||
build_fsnotifier fsnotifier-aarch64
|
||||
else
|
||||
echo "*** Compiling platform-specific version (fsnotifier-$ARCH)..."
|
||||
build_fsnotifier "fsnotifier-$ARCH"
|
||||
fi
|
||||
|
||||
@@ -6,8 +6,8 @@ package org.jetbrains.intellij.build
|
||||
import com.intellij.util.system.CpuArch
|
||||
|
||||
@Suppress("EnumEntryName")
|
||||
enum class JvmArchitecture(@JvmField val fileSuffix: String) {
|
||||
x64("64"), aarch64("aarch64");
|
||||
enum class JvmArchitecture(@JvmField val fileSuffix: String, @JvmField val dirName: String) {
|
||||
x64("64", "amd64"), aarch64("aarch64", "aarch64");
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
|
||||
@@ -34,22 +34,13 @@ class LinuxDistributionBuilder(private val context: BuildContext,
|
||||
override fun copyFilesForOsDistribution(targetPath: Path, arch: JvmArchitecture) {
|
||||
spanBuilder("copy files for os distribution").setAttribute("os", targetOs.osName).setAttribute("arch", arch.name).useWithScope {
|
||||
val distBinDir = targetPath.resolve("bin")
|
||||
@Suppress("SpellCheckingInspection")
|
||||
val bins = when (arch) {
|
||||
JvmArchitecture.aarch64 -> listOf(
|
||||
"fsnotifier-aarch64",
|
||||
"libdbm-aarch64.so",
|
||||
"restart.py",
|
||||
)
|
||||
JvmArchitecture.x64 -> listOf(
|
||||
"fsnotifier",
|
||||
"libdbm-x86_64.so",
|
||||
"restart.py",
|
||||
)
|
||||
}
|
||||
val sourceBinDir = context.paths.communityHomeDir.resolve("bin/linux")
|
||||
for (bin in bins) {
|
||||
copyFileToDir(sourceBinDir.resolve(bin), distBinDir)
|
||||
copyFileToDir(sourceBinDir.resolve("restart.py"), distBinDir)
|
||||
if (arch == JvmArchitecture.x64 || arch == JvmArchitecture.aarch64) {
|
||||
@Suppress("SpellCheckingInspection")
|
||||
listOf("fsnotifier", "libdbm.so").forEach {
|
||||
copyFileToDir(sourceBinDir.resolve("${arch.dirName}/${it}"), distBinDir)
|
||||
}
|
||||
}
|
||||
unpackPty4jNative(context, targetPath, "linux")
|
||||
generateBuildTxt(context, targetPath)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.wm.impl;
|
||||
|
||||
import com.intellij.diagnostic.LoadingState;
|
||||
@@ -792,6 +792,7 @@ public final class GlobalMenuLinux implements LinuxGlobalMenuEventHandler, Dispo
|
||||
private static GlobalMenuLib _loadLibrary() {
|
||||
Application app;
|
||||
if (!SystemInfo.isLinux ||
|
||||
!(CpuArch.isIntel64() || CpuArch.isArm64()) ||
|
||||
(app = ApplicationManager.getApplication()) == null || app.isUnitTestMode() || app.isHeadlessEnvironment() ||
|
||||
Registry.is("linux.native.menu.force.disable") ||
|
||||
(LoadingState.COMPONENTS_REGISTERED.isOccurred() && !Experiments.getInstance().isFeatureEnabled("linux.native.menu")) ||
|
||||
@@ -801,20 +802,7 @@ public final class GlobalMenuLinux implements LinuxGlobalMenuEventHandler, Dispo
|
||||
}
|
||||
|
||||
try {
|
||||
String libName;
|
||||
if (CpuArch.isIntel64()) {
|
||||
libName = "libdbm-x86_64.so";
|
||||
}
|
||||
else if (CpuArch.isArm64()) {
|
||||
libName = "libdbm-aarch64.so";
|
||||
}
|
||||
else {
|
||||
String msg = "No DBM library for current arch (" + CpuArch.CURRENT + ") found";
|
||||
assert false : msg;
|
||||
LOG.warn(msg);
|
||||
return null;
|
||||
}
|
||||
Path lib = PathManager.findBinFile(libName);
|
||||
@SuppressWarnings("SpellCheckingInspection") Path lib = PathManager.findBinFile("libdbm.so");
|
||||
assert lib != null : "DBM lib missing; bin=" + Arrays.toString(new File(PathManager.getBinPath()).list());
|
||||
return Native.load(lib.toString(), GlobalMenuLib.class, Collections.singletonMap("jna.encoding", "UTF8"));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.util.SystemInfoRt;
|
||||
import com.intellij.openapi.util.text.StringUtilRt;
|
||||
import com.intellij.openapi.util.text.Strings;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.system.CpuArch;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -180,6 +181,15 @@ public final class PathManager {
|
||||
dir = dir.resolve(osSuffix);
|
||||
if (Files.isDirectory(dir)) {
|
||||
binDirs.add(dir);
|
||||
if (SystemInfoRt.isLinux) {
|
||||
String arch = CpuArch.isIntel64() ? "amd64" : CpuArch.isArm64() ? "aarch64" : null;
|
||||
if (arch != null) {
|
||||
dir = dir.resolve(arch);
|
||||
if (Files.isDirectory(dir)) {
|
||||
binDirs.add(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,12 +149,9 @@ public class NativeFileWatcherImpl extends PluggableFileWatcher {
|
||||
else if (SystemInfo.isMac) {
|
||||
name = "fsnotifier";
|
||||
}
|
||||
else if (SystemInfo.isLinux && CpuArch.isIntel64()) {
|
||||
else if (SystemInfo.isLinux && (CpuArch.isIntel64() || CpuArch.isArm64())) {
|
||||
name = "fsnotifier";
|
||||
}
|
||||
else if (SystemInfo.isLinux && CpuArch.isArm64()) {
|
||||
name = "fsnotifier-aarch64";
|
||||
}
|
||||
if (name != null) {
|
||||
Path file = PathManager.findBinFile(name);
|
||||
if (file != null) {
|
||||
|
||||
Reference in New Issue
Block a user