aeron-cpp: init at 1.42.1

This commit is contained in:
Vaci 2023-11-20 12:15:41 +00:00
parent f1f62c94f6
commit 0889431a75
3 changed files with 156 additions and 0 deletions

View file

@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -323,7 +323,7 @@ if (BUILD_AERON_ARCHIVE_API)
"${CMAKE_CURRENT_SOURCE_DIR}}/aeron-archive/src/main/java/*.java")
add_custom_command(OUTPUT ${AERON_ALL_JAR}
- COMMAND ${CMAKE_COMMAND} -E env JAVA_HOME=$ENV{JAVA_HOME} BUILD_JAVA_HOME=$ENV{BUILD_JAVA_HOME} BUILD_JAVA_VERSION=$ENV{BUILD_JAVA_VERSION} ${GRADLE_WRAPPER} :aeron-all:clean :aeron-all:assemble --no-daemon -x javadoc --console=plain -q
+ COMMAND ln --symbolic ${CMAKE_CURRENT_SOURCE_DIR}/aeron-all.jar ${AERON_ALL_JAR}
DEPENDS ${AERON_ALL_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating aeron-all jar")

View file

@ -0,0 +1,11 @@
--- a/aeron-archive/src/main/cpp/CMakeLists.txt
+++ b/aeron-archive/src/main/cpp/CMakeLists.txt
@@ -59,7 +59,7 @@ set(GENERATED_CODECS
${ARCHIVE_CODEC_TARGET_DIR}/aeron_archive_client/RecordingSignalEvent.h)
add_custom_command(OUTPUT ${GENERATED_CODECS}
- COMMAND ${CMAKE_COMMAND} -E env JAVA_HOME=$ENV{JAVA_HOME} BUILD_JAVA_HOME=$ENV{BUILD_JAVA_HOME} BUILD_JAVA_VERSION=$ENV{BUILD_JAVA_VERSION} ${GRADLE_WRAPPER} -Dcodec.target.dir=${ARCHIVE_CODEC_TARGET_DIR} :aeron-archive:generateCppCodecs --no-daemon --console=plain -q
+ COMMAND ${CMAKE_COMMAND} -E env JAVA_HOME=$ENV{JAVA_HOME} BUILD_JAVA_HOME=$ENV{BUILD_JAVA_HOME} BUILD_JAVA_VERSION=$ENV{BUILD_JAVA_VERSION} java -cp sbe.jar -Dsbe.output.dir=${ARCHIVE_CODEC_TARGET_DIR} -Dsbe.target.language=Cpp -Dsbe.target.namespace=aeron.archive.client uk.co.real_logic.sbe.SbeTool ${ARCHIVE_CODEC_SCHEMA_DIR}/aeron-archive-codecs.xml
DEPENDS ${CODEC_SCHEMA} aeron-all-jar
WORKING_DIRECTORY ${ARCHIVE_CODEC_WORKING_DIR}
COMMENT "Generating C++ Archive codecs")

View file

@ -0,0 +1,134 @@
{
autoPatchelfHook,
cmake,
fetchFromGitHub,
fetchMavenArtifact,
jdk11,
lib,
libbsd,
libuuid,
makeWrapper,
patchelf,
stdenv,
zlib
}:
let
version = "1.42.1";
aeronAll = fetchMavenArtifact {
artifactId = "aeron-all";
groupId = "io.aeron";
inherit version;
hash = "sha512-pjX+JopK6onDwElMIroj+ZXrKwdPj5H2uPg08XgNlrK1rAkHo9MUT8weBGbuFVFDLeqOZrHj0bt1wJ9XgYY5aA==";
};
sbeAll_1_29_0 = fetchMavenArtifact {
groupId = "uk.co.real-logic";
version = "1.29.0";
artifactId = "sbe-all";
hash = "sha512-exklKS9MgOH369lyuv+5vAWRHt+Iwg/FmsWy8PsSMjenvjs8I2KA1VTa00pIXkw/YNqbUDBIWvS07b4mS8YdPQ==";
};
sbeAll = sbeAll_1_29_0;
in
stdenv.mkDerivation {
pname = "aeron-cpp";
inherit version;
src = fetchFromGitHub {
owner = "real-logic";
repo = "aeron";
rev = version;
hash = "sha256-ODJeJ4XLazPeNLdzaoclPnE59NpxFUqZu3Aw3iTVQT8=";
};
patches = [
./aeron-all.patch
# Use pre-built aeron-all.jar from Maven repo, avoiding Gradle
./aeron-archive-sbe.patch
# Use SBE tool to generate C++ codecs, avoiding Gradle
];
buildInputs = [
jdk11
libbsd
libuuid
zlib
];
nativeBuildInputs = [
autoPatchelfHook
cmake
makeWrapper
patchelf
];
configurePhase = ''
runHook preConfigure
mkdir --parents cppbuild/Release
(
cd cppbuild/Release
cmake \
-G "CodeBlocks - Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DAERON_TESTS=OFF \
-DAERON_SYSTEM_TESTS=OFF \
-DAERON_BUILD_SAMPLES=OFF \
-DCMAKE_INSTALL_PREFIX:PATH=../../install \
../..
)
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
ln --symbolic "${aeronAll.jar}" ./aeron-all.jar
ln --symbolic "${sbeAll.jar}" ./sbe.jar
mkdir --parents aeron-all/build/libs
(
cd cppbuild/Release
make -j $NIX_BUILD_CORES \
aeron \
aeron_archive_client \
aeron_client_shared \
aeron_driver \
aeron_client \
aeron_driver_static \
aeronmd
make -j $NIX_BUILD_CORES install
)
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir --parents "$out"
cp --archive --verbose --target-directory="$out" install/*
runHook postInstall
'';
meta = with lib; {
description = "Aeron Messaging C++ Library";
homepage = "https://aeron.io/";
license = licenses.asl20;
mainProgram = "aeronmd";
maintainers = [ maintainers.vaci ];
sourceProvenance = [
sourceTypes.fromSource
sourceTypes.binaryBytecode
];
};
}