diff --git a/Jenkinsfile b/Jenkinsfile index 4f23a62..1fdb621 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,16 +36,16 @@ pipeline { axis { name 'TARGET' values( - 'x86_64-linux-musl', - 'i686-linux-musl', - 'armel-linux-musleabi', - 'armv7l-linux-musleabihf', - 'aarch64-linux-musl', - 'riscv64-linux-gnu', - 'x86_64-w64-mingw32', - 'i686-w64-mingw32', - 'armv7-w64-mingw32', - 'aarch64-w64-mingw32', + 'x86_64-linux-musl (RPM=x86_64, DEB=amd64)', + 'i686-linux-musl (RPM=i386, DEB=i386)', + 'armel-linux-musleabi (RPM=armv4l, DEB=armel)', + 'armv7l-linux-musleabihf (RPM=armv7hl, DEB=armhf)', + 'aarch64-linux-musl (RPM=aarch64, DEB=arm64)', + 'riscv64-linux-gnu (RPM=riscv64, DEB=riscv64)', + 'x86_64-w64-mingw32 (RPM=x86_64, DEB=amd64)', + 'i686-w64-mingw32 (RPM=i386, DEB=i386)', + 'armv7-w64-mingw32 (RPM=armv7hl, DEB=armhf)', + 'aarch64-w64-mingw32 (RPM=aarch64, DEB=arm64)', '/usr/share/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake' ) } @@ -54,16 +54,18 @@ pipeline { stage('Compile') { steps { script { - final String path = "${TARGET}" + final boolean use_toolchain = "${TARGET}".endsWith('.cmake') + final String path = use_toolchain ? "${TARGET}" : "${TARGET}".substring(0, "${TARGET}".indexOf(' (')) + final String rpmArch = use_toolchain ? 'noarch' : "${TARGET}".substring("${TARGET}".indexOf('(RPM=') + 5, "${TARGET}".indexOf(',')) + final String debArch = use_toolchain ? 'noarch' : "${TARGET}".substring("${TARGET}".indexOf('DEB=') + 4, "${TARGET}".indexOf(')')) final String system_name = !path.contains('mingw') ? sh(returnStdout: true, script: 'uname -s').trim() : 'Windows' final String linker = "/usr/bin/${path}-ld" final boolean not_packer_compatible = path.contains('riscv') || (path.contains('aarch64') && path.contains('mingw')) - final boolean use_toolchain = path.endsWith('.cmake') final String build_directory = "cmake-build-${use_toolchain ? path.substring(path.lastIndexOf('/') + 1, path.length() - 6) : path}".toLowerCase() catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { // Note: CMake 3.20 or higher is needed cmakeBuild buildDir: build_directory, buildType: 'release', cleanBuild: true, installation: 'Latest', - cmakeArgs: "--no-warn-unused-cli ${use_toolchain ? "-DCMAKE_TOOLCHAIN_FILE=${path}" : "-DCMAKE_SYSTEM_NAME=\"${system_name}\" -DCMAKE_SYSTEM_PROCESSOR=\"${path.substring(0, path.indexOf('-'))}\" -DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=${fileExists("${linker}.gold") ? "${linker}.gold" : linker} -DCMAKE_AR=/usr/bin/${path}-ar -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCMAKE_EXE_LINKER_FLAGS=-static"} -DNO_SELF_PACKER=${!(not_packer_compatible || use_toolchain) ? "OFF" : "ON"} -DIGNORE_MINIMAL_COMPILER_VERSION=ON -DNO_CCACHE=ON -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON", + cmakeArgs: "--no-warn-unused-cli ${use_toolchain ? "-DCMAKE_TOOLCHAIN_FILE=${path}" : "-DCMAKE_SYSTEM_NAME=\"${system_name}\" -DCXX_TARGET=\"${use_toolchain ? 'noarch' : debArch}\" -DCPACK_RPM_PACKAGE_ARCHITECTURE=${rpmArch} -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${debArch} -DCMAKE_SYSTEM_PROCESSOR=\"${path.substring(0, path.indexOf('-'))}\" -DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=${fileExists("${linker}.gold") ? "${linker}.gold" : linker} -DCMAKE_AR=/usr/bin/${path}-ar -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCMAKE_EXE_LINKER_FLAGS=-static"} -DNO_SELF_PACKER=${!(not_packer_compatible || use_toolchain) ? "OFF" : "ON"} -DIGNORE_MINIMAL_COMPILER_VERSION=ON -DNO_CCACHE=ON -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON", generator: cmake_generator() cmake arguments: "--build ./$build_directory --target ybcon", installation: 'Latest' } @@ -74,7 +76,9 @@ pipeline { when { equals expected: true, actual: !"${TARGET}".endsWith('.cmake') } steps { catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { - cpack installation: 'Latest', workingDir: "cmake-build-${TARGET}" + script { + cpack installation: 'Latest', workingDir: "cmake-build-${"${TARGET}".substring(0, "${TARGET}".indexOf(' ('))}" + } } } }