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
|
#!/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
|
set -euo pipefail
|
||||||
|
|
||||||
VER="${1:-}"
|
VER="${1:-}"
|
||||||
@@ -6,33 +7,19 @@ if [ -z "${VER:-}" ]; then
|
|||||||
VER=$(date "+%Y%m%d.%H%M")
|
VER=$(date "+%Y%m%d.%H%M")
|
||||||
fi
|
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)
|
ARCH=$(uname -m)
|
||||||
|
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ] || [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||||
# To make sure it's compatible with old Linux distributions, e.g. CentOS 7
|
glibc_version="$(objdump -x fsnotifier | grep -o "GLIBC_.*" | sort | uniq | cut -d _ -f 2 | sort -V | tail -n 1)"
|
||||||
max_allowed_glibc_version="2.17"
|
newest=$(printf "%s\n%s\n" "$MAX_GLIBC_VERSION" "$glibc_version" | sort -V | tail -n 1)
|
||||||
|
if [ "$newest" != "$MAX_GLIBC_VERSION" ]; then
|
||||||
build_fsnotifier() {
|
echo "ERROR: fsnotifier uses glibc version $glibc_version which is newer than $MAX_GLIBC_VERSION"
|
||||||
[ -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"
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
echo "OK: $1 uses glibc version $glibc_version"
|
|
||||||
fi
|
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
|
fi
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ package org.jetbrains.intellij.build
|
|||||||
import com.intellij.util.system.CpuArch
|
import com.intellij.util.system.CpuArch
|
||||||
|
|
||||||
@Suppress("EnumEntryName")
|
@Suppress("EnumEntryName")
|
||||||
enum class JvmArchitecture(@JvmField val fileSuffix: String) {
|
enum class JvmArchitecture(@JvmField val fileSuffix: String, @JvmField val dirName: String) {
|
||||||
x64("64"), aarch64("aarch64");
|
x64("64", "amd64"), aarch64("aarch64", "aarch64");
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
@@ -20,4 +20,4 @@ enum class JvmArchitecture(@JvmField val fileSuffix: String) {
|
|||||||
else -> throw IllegalStateException("Unsupported arch: " + CpuArch.CURRENT)
|
else -> throw IllegalStateException("Unsupported arch: " + CpuArch.CURRENT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,22 +34,13 @@ class LinuxDistributionBuilder(private val context: BuildContext,
|
|||||||
override fun copyFilesForOsDistribution(targetPath: Path, arch: JvmArchitecture) {
|
override fun copyFilesForOsDistribution(targetPath: Path, arch: JvmArchitecture) {
|
||||||
spanBuilder("copy files for os distribution").setAttribute("os", targetOs.osName).setAttribute("arch", arch.name).useWithScope {
|
spanBuilder("copy files for os distribution").setAttribute("os", targetOs.osName).setAttribute("arch", arch.name).useWithScope {
|
||||||
val distBinDir = targetPath.resolve("bin")
|
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")
|
val sourceBinDir = context.paths.communityHomeDir.resolve("bin/linux")
|
||||||
for (bin in bins) {
|
copyFileToDir(sourceBinDir.resolve("restart.py"), distBinDir)
|
||||||
copyFileToDir(sourceBinDir.resolve(bin), 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")
|
unpackPty4jNative(context, targetPath, "linux")
|
||||||
generateBuildTxt(context, targetPath)
|
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;
|
package com.intellij.openapi.wm.impl;
|
||||||
|
|
||||||
import com.intellij.diagnostic.LoadingState;
|
import com.intellij.diagnostic.LoadingState;
|
||||||
@@ -792,6 +792,7 @@ public final class GlobalMenuLinux implements LinuxGlobalMenuEventHandler, Dispo
|
|||||||
private static GlobalMenuLib _loadLibrary() {
|
private static GlobalMenuLib _loadLibrary() {
|
||||||
Application app;
|
Application app;
|
||||||
if (!SystemInfo.isLinux ||
|
if (!SystemInfo.isLinux ||
|
||||||
|
!(CpuArch.isIntel64() || CpuArch.isArm64()) ||
|
||||||
(app = ApplicationManager.getApplication()) == null || app.isUnitTestMode() || app.isHeadlessEnvironment() ||
|
(app = ApplicationManager.getApplication()) == null || app.isUnitTestMode() || app.isHeadlessEnvironment() ||
|
||||||
Registry.is("linux.native.menu.force.disable") ||
|
Registry.is("linux.native.menu.force.disable") ||
|
||||||
(LoadingState.COMPONENTS_REGISTERED.isOccurred() && !Experiments.getInstance().isFeatureEnabled("linux.native.menu")) ||
|
(LoadingState.COMPONENTS_REGISTERED.isOccurred() && !Experiments.getInstance().isFeatureEnabled("linux.native.menu")) ||
|
||||||
@@ -801,20 +802,7 @@ public final class GlobalMenuLinux implements LinuxGlobalMenuEventHandler, Dispo
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String libName;
|
@SuppressWarnings("SpellCheckingInspection") Path lib = PathManager.findBinFile("libdbm.so");
|
||||||
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);
|
|
||||||
assert lib != null : "DBM lib missing; bin=" + Arrays.toString(new File(PathManager.getBinPath()).list());
|
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"));
|
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.StringUtilRt;
|
||||||
import com.intellij.openapi.util.text.Strings;
|
import com.intellij.openapi.util.text.Strings;
|
||||||
import com.intellij.util.io.URLUtil;
|
import com.intellij.util.io.URLUtil;
|
||||||
|
import com.intellij.util.system.CpuArch;
|
||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -180,6 +181,15 @@ public final class PathManager {
|
|||||||
dir = dir.resolve(osSuffix);
|
dir = dir.resolve(osSuffix);
|
||||||
if (Files.isDirectory(dir)) {
|
if (Files.isDirectory(dir)) {
|
||||||
binDirs.add(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) {
|
else if (SystemInfo.isMac) {
|
||||||
name = "fsnotifier";
|
name = "fsnotifier";
|
||||||
}
|
}
|
||||||
else if (SystemInfo.isLinux && CpuArch.isIntel64()) {
|
else if (SystemInfo.isLinux && (CpuArch.isIntel64() || CpuArch.isArm64())) {
|
||||||
name = "fsnotifier";
|
name = "fsnotifier";
|
||||||
}
|
}
|
||||||
else if (SystemInfo.isLinux && CpuArch.isArm64()) {
|
|
||||||
name = "fsnotifier-aarch64";
|
|
||||||
}
|
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
Path file = PathManager.findBinFile(name);
|
Path file = PathManager.findBinFile(name);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user