mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-28 20:29:53 +00:00
desktop: libs refactoring (#3169)
* desktop: libs refactoring * mac fix * windows fix * .gitignore * unused lines * desktop (windows): adapting Windows build to new libs * removed unused code --------- Co-authored-by: avently <avently@local>
This commit is contained in:
parent
cc95fa6b30
commit
91fc238ddc
14 changed files with 104 additions and 146 deletions
1
apps/multiplatform/.gitignore
vendored
1
apps/multiplatform/.gitignore
vendored
|
@ -11,7 +11,6 @@
|
||||||
local.properties
|
local.properties
|
||||||
common/src/commonMain/cpp/android/libs/
|
common/src/commonMain/cpp/android/libs/
|
||||||
common/src/commonMain/cpp/desktop/libs/
|
common/src/commonMain/cpp/desktop/libs/
|
||||||
desktop/src/jvmMain/resources/libs/
|
|
||||||
android/build
|
android/build
|
||||||
android/release
|
android/release
|
||||||
common/build
|
common/build
|
||||||
|
|
|
@ -54,12 +54,11 @@ add_library( # Sets the name of the library.
|
||||||
simplex-api.c)
|
simplex-api.c)
|
||||||
|
|
||||||
add_library( simplex SHARED IMPORTED )
|
add_library( simplex SHARED IMPORTED )
|
||||||
# Lib has different name because of version, find it
|
|
||||||
FILE(GLOB SIMPLEXLIB ${CMAKE_SOURCE_DIR}/libs/${OS_LIB_PATH}-${OS_LIB_ARCH}/lib*simplex*.${OS_LIB_EXT})
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
FILE(GLOB SIMPLEXLIB ${CMAKE_SOURCE_DIR}/libs/${OS_LIB_PATH}-${OS_LIB_ARCH}/lib*simplex*.${OS_LIB_EXT})
|
||||||
set_target_properties( simplex PROPERTIES IMPORTED_IMPLIB ${SIMPLEXLIB})
|
set_target_properties( simplex PROPERTIES IMPORTED_IMPLIB ${SIMPLEXLIB})
|
||||||
else()
|
else()
|
||||||
|
FILE(GLOB SIMPLEXLIB ${CMAKE_SOURCE_DIR}/libs/${OS_LIB_PATH}-${OS_LIB_ARCH}/lib*simplex-chat*.${OS_LIB_EXT})
|
||||||
set_target_properties( simplex PROPERTIES IMPORTED_LOCATION ${SIMPLEXLIB})
|
set_target_properties( simplex PROPERTIES IMPORTED_LOCATION ${SIMPLEXLIB})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -72,7 +71,7 @@ if(NOT APPLE)
|
||||||
else()
|
else()
|
||||||
# Without direct linking it can't find hs_init in linking step
|
# Without direct linking it can't find hs_init in linking step
|
||||||
add_library( rts SHARED IMPORTED )
|
add_library( rts SHARED IMPORTED )
|
||||||
FILE(GLOB RTSLIB ${CMAKE_SOURCE_DIR}/libs/${OS_LIB_PATH}-${OS_LIB_ARCH}/deps/libHSrts*_thr-*.${OS_LIB_EXT})
|
FILE(GLOB RTSLIB ${CMAKE_SOURCE_DIR}/libs/${OS_LIB_PATH}-${OS_LIB_ARCH}/libHSrts*_thr-*.${OS_LIB_EXT})
|
||||||
set_target_properties( rts PROPERTIES IMPORTED_LOCATION ${RTSLIB})
|
set_target_properties( rts PROPERTIES IMPORTED_LOCATION ${RTSLIB})
|
||||||
|
|
||||||
target_link_libraries(app-lib rts simplex)
|
target_link_libraries(app-lib rts simplex)
|
||||||
|
|
|
@ -21,8 +21,6 @@ actual val agentDatabaseFileName: String = "simplex_v1_agent.db"
|
||||||
|
|
||||||
actual val databaseExportDir: File = tmpDir
|
actual val databaseExportDir: File = tmpDir
|
||||||
|
|
||||||
val vlcDir: File = File(System.getProperty("java.io.tmpdir") + File.separator + "simplex-vlc").also { it.deleteOnExit() }
|
|
||||||
|
|
||||||
actual fun desktopOpenDatabaseDir() {
|
actual fun desktopOpenDatabaseDir() {
|
||||||
if (Desktop.isDesktopSupported()) {
|
if (Desktop.isDesktopSupported()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -8,12 +8,12 @@ private val unixConfigPath = (System.getenv("XDG_CONFIG_HOME") ?: "$home/.config
|
||||||
private val unixDataPath = (System.getenv("XDG_DATA_HOME") ?: "$home/.local/share") + "/simplex"
|
private val unixDataPath = (System.getenv("XDG_DATA_HOME") ?: "$home/.local/share") + "/simplex"
|
||||||
val desktopPlatform = detectDesktopPlatform()
|
val desktopPlatform = detectDesktopPlatform()
|
||||||
|
|
||||||
enum class DesktopPlatform(val libPath: String, val libExtension: String, val configPath: String, val dataPath: String) {
|
enum class DesktopPlatform(val libExtension: String, val configPath: String, val dataPath: String) {
|
||||||
LINUX_X86_64("/libs/linux-x86_64", "so", unixConfigPath, unixDataPath),
|
LINUX_X86_64("so", unixConfigPath, unixDataPath),
|
||||||
LINUX_AARCH64("/libs/aarch64", "so", unixConfigPath, unixDataPath),
|
LINUX_AARCH64("so", unixConfigPath, unixDataPath),
|
||||||
WINDOWS_X86_64("/libs/windows-x86_64", "dll", System.getenv("AppData") + File.separator + "SimpleX", System.getenv("AppData") + File.separator + "SimpleX"),
|
WINDOWS_X86_64("dll", System.getenv("AppData") + File.separator + "SimpleX", System.getenv("AppData") + File.separator + "SimpleX"),
|
||||||
MAC_X86_64("/libs/mac-x86_64", "dylib", unixConfigPath, unixDataPath),
|
MAC_X86_64("dylib", unixConfigPath, unixDataPath),
|
||||||
MAC_AARCH64("/libs/mac-aarch64", "dylib", unixConfigPath, unixDataPath);
|
MAC_AARCH64("dylib", unixConfigPath, unixDataPath);
|
||||||
|
|
||||||
fun isLinux() = this == LINUX_X86_64 || this == LINUX_AARCH64
|
fun isLinux() = this == LINUX_X86_64 || this == LINUX_AARCH64
|
||||||
fun isWindows() = this == WINDOWS_X86_64
|
fun isWindows() = this == WINDOWS_X86_64
|
||||||
|
|
|
@ -52,6 +52,7 @@ compose {
|
||||||
}
|
}
|
||||||
//includeAllModules = true
|
//includeAllModules = true
|
||||||
outputBaseDir.set(project.file("../release"))
|
outputBaseDir.set(project.file("../release"))
|
||||||
|
appResourcesRootDir.set(project.file("../build/links"))
|
||||||
targetFormats(
|
targetFormats(
|
||||||
TargetFormat.Deb, TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Exe
|
TargetFormat.Deb, TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Exe
|
||||||
//, TargetFormat.AppImage // Gradle doesn't sync on Mac with it
|
//, TargetFormat.AppImage // Gradle doesn't sync on Mac with it
|
||||||
|
@ -156,11 +157,10 @@ tasks.named("compileJava") {
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
tasks.create("cmakeBuildAndCopy") {
|
tasks.create("cmakeBuildAndCopy") {
|
||||||
dependsOn("cmakeBuild")
|
dependsOn("cmakeBuild")
|
||||||
val copyDetails = mutableMapOf<String, ArrayList<FileCopyDetails>>()
|
|
||||||
doLast {
|
doLast {
|
||||||
copy {
|
copy {
|
||||||
from("${project(":desktop").buildDir}/cmake/main/linux-amd64", "$cppPath/desktop/libs/linux-x86_64", "$cppPath/desktop/libs/linux-x86_64/deps")
|
from("${project(":desktop").buildDir}/cmake/main/linux-amd64")
|
||||||
into("src/jvmMain/resources/libs/linux-x86_64")
|
into("$cppPath/desktop/libs/linux-x86_64")
|
||||||
include("*.so*")
|
include("*.so*")
|
||||||
eachFile {
|
eachFile {
|
||||||
path = name
|
path = name
|
||||||
|
@ -169,16 +169,8 @@ afterEvaluate {
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
val destinationDir = "src/jvmMain/resources/libs/linux-x86_64/vlc"
|
from("${project(":desktop").buildDir}/cmake/main/linux-aarch64")
|
||||||
from("$cppPath/desktop/libs/linux-x86_64/deps/vlc")
|
into("$cppPath/desktop/libs/linux-aarch64")
|
||||||
into(destinationDir)
|
|
||||||
includeEmptyDirs = false
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
||||||
copyIfNeeded(destinationDir, copyDetails)
|
|
||||||
}
|
|
||||||
copy {
|
|
||||||
from("${project(":desktop").buildDir}/cmake/main/linux-aarch64", "$cppPath/desktop/libs/linux-aarch64", "$cppPath/desktop/libs/linux-aarch64/deps")
|
|
||||||
into("src/jvmMain/resources/libs/linux-aarch64")
|
|
||||||
include("*.so*")
|
include("*.so*")
|
||||||
eachFile {
|
eachFile {
|
||||||
path = name
|
path = name
|
||||||
|
@ -187,16 +179,18 @@ afterEvaluate {
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
val destinationDir = "src/jvmMain/resources/libs/linux-aarch64/vlc"
|
from("${project(":desktop").buildDir}/cmake/main/windows-amd64")
|
||||||
from("$cppPath/desktop/libs/linux-aarch64/deps/vlc")
|
into("$cppPath/desktop/libs/windows-x86_64")
|
||||||
into(destinationDir)
|
include("*.dll")
|
||||||
|
eachFile {
|
||||||
|
path = name
|
||||||
|
}
|
||||||
includeEmptyDirs = false
|
includeEmptyDirs = false
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
copyIfNeeded(destinationDir, copyDetails)
|
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
from("${project(":desktop").buildDir}/cmake/main/windows-amd64", "$cppPath/desktop/libs/windows-x86_64", "$cppPath/desktop/libs/windows-x86_64/deps")
|
from("${project(":desktop").buildDir}/cmake/main/windows-amd64")
|
||||||
into("src/jvmMain/resources/libs/windows-x86_64")
|
into("../build/links/windows-x64")
|
||||||
include("*.dll")
|
include("*.dll")
|
||||||
eachFile {
|
eachFile {
|
||||||
path = name
|
path = name
|
||||||
|
@ -205,16 +199,8 @@ afterEvaluate {
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
val destinationDir = "src/jvmMain/resources/libs/windows-x86_64/vlc"
|
from("${project(":desktop").buildDir}/cmake/main/mac-x86_64")
|
||||||
from("$cppPath/desktop/libs/windows-x86_64/deps/vlc")
|
into("$cppPath/desktop/libs/mac-x86_64")
|
||||||
into(destinationDir)
|
|
||||||
includeEmptyDirs = false
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
||||||
copyIfNeeded(destinationDir, copyDetails)
|
|
||||||
}
|
|
||||||
copy {
|
|
||||||
from("${project(":desktop").buildDir}/cmake/main/mac-x86_64", "$cppPath/desktop/libs/mac-x86_64", "$cppPath/desktop/libs/mac-x86_64/deps")
|
|
||||||
into("src/jvmMain/resources/libs/mac-x86_64")
|
|
||||||
include("*.dylib")
|
include("*.dylib")
|
||||||
eachFile {
|
eachFile {
|
||||||
path = name
|
path = name
|
||||||
|
@ -223,16 +209,8 @@ afterEvaluate {
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
val destinationDir = "src/jvmMain/resources/libs/mac-x86_64/vlc"
|
from("${project(":desktop").buildDir}/cmake/main/mac-aarch64")
|
||||||
from("$cppPath/desktop/libs/mac-x86_64/deps/vlc")
|
into("$cppPath/desktop/libs/mac-aarch64")
|
||||||
into(destinationDir)
|
|
||||||
includeEmptyDirs = false
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
||||||
copyIfNeeded(destinationDir, copyDetails)
|
|
||||||
}
|
|
||||||
copy {
|
|
||||||
from("${project(":desktop").buildDir}/cmake/main/mac-aarch64", "$cppPath/desktop/libs/mac-aarch64", "$cppPath/desktop/libs/mac-aarch64/deps")
|
|
||||||
into("src/jvmMain/resources/libs/mac-aarch64")
|
|
||||||
include("*.dylib")
|
include("*.dylib")
|
||||||
eachFile {
|
eachFile {
|
||||||
path = name
|
path = name
|
||||||
|
@ -240,39 +218,6 @@ afterEvaluate {
|
||||||
includeEmptyDirs = false
|
includeEmptyDirs = false
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
||||||
}
|
}
|
||||||
copy {
|
|
||||||
val destinationDir = "src/jvmMain/resources/libs/mac-aarch64/vlc"
|
|
||||||
from("$cppPath/desktop/libs/mac-aarch64/deps/vlc")
|
|
||||||
into(destinationDir)
|
|
||||||
includeEmptyDirs = false
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
||||||
copyIfNeeded(destinationDir, copyDetails)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
afterEvaluate {
|
|
||||||
doLast {
|
|
||||||
copyDetails.forEach { (destinationDir, details) ->
|
|
||||||
details.forEach { detail ->
|
|
||||||
val target = File(projectDir.absolutePath + File.separator + destinationDir + File.separator + detail.path)
|
|
||||||
if (target.exists()) {
|
|
||||||
target.setLastModified(detail.lastModified)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CopySpec.copyIfNeeded(destinationDir: String, into: MutableMap<String, ArrayList<FileCopyDetails>>) {
|
|
||||||
val details = arrayListOf<FileCopyDetails>()
|
|
||||||
eachFile {
|
|
||||||
val targetFile = File(destinationDir, path)
|
|
||||||
if (file.lastModified() == targetFile.lastModified() && file.length() == targetFile.length()) {
|
|
||||||
exclude()
|
|
||||||
} else {
|
|
||||||
details.add(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
into[destinationDir] = details
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,51 +18,29 @@ fun main() {
|
||||||
|
|
||||||
@Suppress("UnsafeDynamicallyLoadedCode")
|
@Suppress("UnsafeDynamicallyLoadedCode")
|
||||||
private fun initHaskell() {
|
private fun initHaskell() {
|
||||||
val libsTmpDir = File(tmpDir.absolutePath + File.separator + "libs")
|
val resourcesDir = File(System.getProperty("compose.application.resources.dir"))
|
||||||
copyResources(desktopPlatform.libPath, libsTmpDir.toPath())
|
val vlcDir = File(resourcesDir.absolutePath + File.separator + "vlc")
|
||||||
vlcDir.deleteRecursively()
|
|
||||||
Files.move(File(libsTmpDir, "vlc").toPath(), vlcDir.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
|
||||||
if (desktopPlatform == DesktopPlatform.WINDOWS_X86_64) {
|
if (desktopPlatform == DesktopPlatform.WINDOWS_X86_64) {
|
||||||
windowsLoadRequiredLibs(libsTmpDir)
|
windowsLoadRequiredLibs(resourcesDir, vlcDir)
|
||||||
} else {
|
} else {
|
||||||
System.load(File(libsTmpDir, "libapp-lib.${desktopPlatform.libExtension}").absolutePath)
|
System.load(File(resourcesDir, "libapp-lib.${desktopPlatform.libExtension}").absolutePath)
|
||||||
}
|
}
|
||||||
// No picture without preloading it, only sound. However, with libs from AppImage it works without preloading
|
// No picture without preloading it, only sound. However, with libs from AppImage it works without preloading
|
||||||
//val libXcb = "libvlc_xcb_events.so.0.0.0"
|
//val libXcb = "libvlc_xcb_events.so.0.0.0"
|
||||||
//System.load(File(File(vlcDir, "vlc"), libXcb).absolutePath)
|
//System.load(File(File(vlcDir, "vlc"), libXcb).absolutePath)
|
||||||
System.setProperty("jna.library.path", vlcDir.absolutePath)
|
System.setProperty("jna.library.path", vlcDir.absolutePath)
|
||||||
//discoverVlcLibs(File(File(vlcDir, "vlc"), "plugins").absolutePath)
|
//discoverVlcLibs(File(File(vlcDir, "vlc"), "plugins").absolutePath)
|
||||||
|
|
||||||
libsTmpDir.deleteRecursively()
|
|
||||||
initHS()
|
initHS()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun copyResources(from: String, to: Path) {
|
private fun windowsLoadRequiredLibs(libsTmpDir: File, vlcDir: File) {
|
||||||
val resource = Class.forName("chat.simplex.desktop.MainKt").getResource("")!!.toURI()
|
|
||||||
val fileSystem = FileSystems.newFileSystem(resource, emptyMap<String, String>())
|
|
||||||
val resPath = fileSystem.getPath(from)
|
|
||||||
Files.walkFileTree(resPath, object: SimpleFileVisitor<Path>() {
|
|
||||||
override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
|
|
||||||
Files.createDirectories(to.resolve(resPath.relativize(dir).toString()))
|
|
||||||
return FileVisitResult.CONTINUE
|
|
||||||
}
|
|
||||||
override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
|
|
||||||
val dest = to.resolve(resPath.relativize(file).toString())
|
|
||||||
Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING)
|
|
||||||
// Setting the same time on file as the time set in script that generates VLC libs
|
|
||||||
if (dest.toString().contains("." + desktopPlatform.libExtension)) {
|
|
||||||
dest.setLastModifiedTime(FileTime.fromMillis(0))
|
|
||||||
}
|
|
||||||
return FileVisitResult.CONTINUE
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun windowsLoadRequiredLibs(libsTmpDir: File) {
|
|
||||||
val mainLibs = arrayOf(
|
val mainLibs = arrayOf(
|
||||||
"libcrypto-3-x64.dll",
|
"libcrypto-3-x64.dll",
|
||||||
|
"mcfgthread-12.dll",
|
||||||
|
"libgcc_s_seh-1.dll",
|
||||||
|
"libstdc++-6.dll",
|
||||||
"libffi-8.dll",
|
"libffi-8.dll",
|
||||||
"libgmp-10.dll",
|
"libgmp-10.dll",
|
||||||
"libsimplex.dll",
|
"libsimplex.dll",
|
||||||
"libapp-lib.dll"
|
"libapp-lib.dll"
|
||||||
)
|
)
|
||||||
|
@ -72,7 +50,7 @@ private fun windowsLoadRequiredLibs(libsTmpDir: File) {
|
||||||
val vlcLibs = arrayOf(
|
val vlcLibs = arrayOf(
|
||||||
"libvlccore.dll",
|
"libvlccore.dll",
|
||||||
"libvlc.dll",
|
"libvlc.dll",
|
||||||
"axvlc.dll",
|
"axvlc.dll",
|
||||||
"npvlc.dll"
|
"npvlc.dll"
|
||||||
)
|
)
|
||||||
vlcLibs.forEach {
|
vlcLibs.forEach {
|
||||||
|
|
|
@ -1,9 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function readlink() {
|
||||||
|
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
||||||
|
}
|
||||||
|
|
||||||
OS=linux
|
OS=linux
|
||||||
ARCH=${1:-`uname -a | rev | cut -d' ' -f2 | rev`}
|
ARCH=${1:-`uname -a | rev | cut -d' ' -f2 | rev`}
|
||||||
GHC_VERSION=9.6.2
|
GHC_VERSION=9.6.2
|
||||||
|
|
||||||
|
if [ "$ARCH" == "aarch64" ]; then
|
||||||
|
COMPOSE_ARCH=arm64
|
||||||
|
else
|
||||||
|
COMPOSE_ARCH=x64
|
||||||
|
fi
|
||||||
|
|
||||||
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
|
cd $root_dir
|
||||||
BUILD_DIR=dist-newstyle/build/$ARCH-$OS/ghc-${GHC_VERSION}/simplex-chat-*
|
BUILD_DIR=dist-newstyle/build/$ARCH-$OS/ghc-${GHC_VERSION}/simplex-chat-*
|
||||||
|
|
||||||
rm -rf $BUILD_DIR
|
rm -rf $BUILD_DIR
|
||||||
|
@ -11,16 +25,20 @@ cabal build lib:simplex-chat --ghc-options='-optl-Wl,-rpath,$ORIGIN -flink-rts -
|
||||||
cd $BUILD_DIR/build
|
cd $BUILD_DIR/build
|
||||||
#patchelf --add-needed libHSrts_thr-ghc${GHC_VERSION}.so libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so
|
#patchelf --add-needed libHSrts_thr-ghc${GHC_VERSION}.so libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so
|
||||||
#patchelf --add-rpath '$ORIGIN' libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so
|
#patchelf --add-rpath '$ORIGIN' libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so
|
||||||
mkdir deps
|
mkdir deps 2> /dev/null || true
|
||||||
ldd libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so | grep "ghc" | cut -d' ' -f 3 | xargs -I {} cp {} ./deps/
|
ldd libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so | grep "ghc" | cut -d' ' -f 3 | xargs -I {} cp {} ./deps/
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
rm -rf apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
rm -rf apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
rm -rf apps/multiplatform/desktop/src/jvmMain/resources/libs/$OS-$ARCH/
|
|
||||||
rm -rf apps/multiplatform/desktop/build/cmake
|
rm -rf apps/multiplatform/desktop/build/cmake
|
||||||
|
|
||||||
mkdir -p apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
mkdir -p apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
cp -r $BUILD_DIR/build/deps apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
cp -r $BUILD_DIR/build/deps/* apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
cp $BUILD_DIR/build/libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
cp $BUILD_DIR/build/libHSsimplex-chat-*-inplace-ghc${GHC_VERSION}.so apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
scripts/desktop/prepare-vlc-linux.sh
|
scripts/desktop/prepare-vlc-linux.sh
|
||||||
|
|
||||||
|
links_dir=apps/multiplatform/build/links
|
||||||
|
mkdir -p $links_dir
|
||||||
|
cd $links_dir
|
||||||
|
ln -sfT ../../common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/ $OS-$COMPOSE_ARCH
|
||||||
|
|
|
@ -4,10 +4,13 @@ set -e
|
||||||
|
|
||||||
OS=mac
|
OS=mac
|
||||||
ARCH="${1:-`uname -a | rev | cut -d' ' -f1 | rev`}"
|
ARCH="${1:-`uname -a | rev | cut -d' ' -f1 | rev`}"
|
||||||
|
COMPOSE_ARCH=$ARCH
|
||||||
GHC_VERSION=9.6.2
|
GHC_VERSION=9.6.2
|
||||||
|
|
||||||
if [ "$ARCH" == "arm64" ]; then
|
if [ "$ARCH" == "arm64" ]; then
|
||||||
ARCH=aarch64
|
ARCH=aarch64
|
||||||
|
else
|
||||||
|
COMPOSE_ARCH=x64
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIB_EXT=dylib
|
LIB_EXT=dylib
|
||||||
|
@ -84,30 +87,29 @@ rm deps/`basename $LIB`
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
rm -rf apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
rm -rf apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
rm -rf apps/multiplatform/desktop/src/jvmMain/resources/libs/$OS-$ARCH/
|
|
||||||
rm -rf apps/multiplatform/desktop/build/cmake
|
rm -rf apps/multiplatform/desktop/build/cmake
|
||||||
|
|
||||||
mkdir -p apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
mkdir -p apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
cp -r $BUILD_DIR/build/deps apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
cp -r $BUILD_DIR/build/deps/* apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
cp $BUILD_DIR/build/libHSsimplex-chat-*-inplace-ghc*.$LIB_EXT apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
cp $BUILD_DIR/build/libHSsimplex-chat-*-inplace-ghc*.$LIB_EXT apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
|
|
||||||
cd apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
cd apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
|
|
||||||
LIBCRYPTO_PATH=$(otool -l deps/libHSdrct-*.$LIB_EXT | grep libcrypto | cut -d' ' -f11)
|
LIBCRYPTO_PATH=$(otool -l libHSdrct-*.$LIB_EXT | grep libcrypto | cut -d' ' -f11)
|
||||||
install_name_tool -change $LIBCRYPTO_PATH @rpath/libcrypto.1.1.$LIB_EXT deps/libHSdrct-*.$LIB_EXT
|
install_name_tool -change $LIBCRYPTO_PATH @rpath/libcrypto.1.1.$LIB_EXT libHSdrct-*.$LIB_EXT
|
||||||
cp $LIBCRYPTO_PATH deps/libcrypto.1.1.$LIB_EXT
|
cp $LIBCRYPTO_PATH libcrypto.1.1.$LIB_EXT
|
||||||
chmod 755 deps/libcrypto.1.1.$LIB_EXT
|
chmod 755 libcrypto.1.1.$LIB_EXT
|
||||||
install_name_tool -id "libcrypto.1.1.$LIB_EXT" deps/libcrypto.1.1.$LIB_EXT
|
install_name_tool -id "libcrypto.1.1.$LIB_EXT" libcrypto.1.1.$LIB_EXT
|
||||||
install_name_tool -id "libffi.8.$LIB_EXT" deps/libffi.$LIB_EXT
|
install_name_tool -id "libffi.8.$LIB_EXT" libffi.$LIB_EXT
|
||||||
|
|
||||||
LIBCRYPTO_PATH=$(otool -l $LIB | grep libcrypto | cut -d' ' -f11)
|
LIBCRYPTO_PATH=$(otool -l $LIB | grep libcrypto | cut -d' ' -f11)
|
||||||
if [ -n "$LIBCRYPTO_PATH" ]; then
|
if [ -n "$LIBCRYPTO_PATH" ]; then
|
||||||
install_name_tool -change $LIBCRYPTO_PATH @rpath/libcrypto.1.1.$LIB_EXT $LIB
|
install_name_tool -change $LIBCRYPTO_PATH @rpath/libcrypto.1.1.$LIB_EXT $LIB
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBCRYPTO_PATH=$(otool -l deps/libHSsmplxmq*.$LIB_EXT | grep libcrypto | cut -d' ' -f11)
|
LIBCRYPTO_PATH=$(otool -l libHSsmplxmq*.$LIB_EXT | grep libcrypto | cut -d' ' -f11)
|
||||||
if [ -n "$LIBCRYPTO_PATH" ]; then
|
if [ -n "$LIBCRYPTO_PATH" ]; then
|
||||||
install_name_tool -change $LIBCRYPTO_PATH @rpath/libcrypto.1.1.$LIB_EXT deps/libHSsmplxmq*.$LIB_EXT
|
install_name_tool -change $LIBCRYPTO_PATH @rpath/libcrypto.1.1.$LIB_EXT libHSsmplxmq*.$LIB_EXT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for lib in $(find . -type f -name "*.$LIB_EXT"); do
|
for lib in $(find . -type f -name "*.$LIB_EXT"); do
|
||||||
|
@ -126,3 +128,9 @@ fi
|
||||||
|
|
||||||
cd -
|
cd -
|
||||||
scripts/desktop/prepare-vlc-mac.sh
|
scripts/desktop/prepare-vlc-mac.sh
|
||||||
|
|
||||||
|
links_dir=apps/multiplatform/build/links
|
||||||
|
mkdir -p $links_dir
|
||||||
|
cd $links_dir
|
||||||
|
rm macos-$COMPOSE_ARCH 2>/dev/null | true
|
||||||
|
ln -sf ../../common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/ macos-$COMPOSE_ARCH
|
||||||
|
|
|
@ -8,15 +8,26 @@ function readlink() {
|
||||||
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
|
|
||||||
OS=windows
|
OS=windows
|
||||||
ARCH=`uname -a | rev | cut -d' ' -f2 | rev`
|
ARCH="x86_64"
|
||||||
JOB_REPO=${1:-$SIMPLEX_CI_REPO_URL}
|
JOB_REPO=${1:-$SIMPLEX_CI_REPO_URL}
|
||||||
|
|
||||||
|
if [ "$ARCH" == "aarch64" ]; then
|
||||||
|
COMPOSE_ARCH=arm64
|
||||||
|
else
|
||||||
|
COMPOSE_ARCH=x64
|
||||||
|
fi
|
||||||
|
|
||||||
cd $root_dir
|
cd $root_dir
|
||||||
|
|
||||||
rm -rf apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
rm -rf apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
rm -rf apps/multiplatform/desktop/src/jvmMain/resources/libs/$OS-$ARCH/
|
|
||||||
rm -rf apps/multiplatform/desktop/build/cmake
|
rm -rf apps/multiplatform/desktop/build/cmake
|
||||||
|
|
||||||
mkdir -p apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
mkdir -p apps/multiplatform/common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/
|
||||||
scripts/desktop/download-lib-windows.sh $JOB_REPO
|
scripts/desktop/download-lib-windows.sh $JOB_REPO
|
||||||
scripts/desktop/prepare-vlc-windows.sh
|
scripts/desktop/prepare-vlc-windows.sh
|
||||||
|
|
||||||
|
links_dir=apps/multiplatform/build/links
|
||||||
|
mkdir -p $links_dir
|
||||||
|
cd $links_dir
|
||||||
|
rm -rf $OS-$COMPOSE_ARCH
|
||||||
|
ln -sfT ../../common/src/commonMain/cpp/desktop/libs/$OS-$ARCH/ $OS-$COMPOSE_ARCH
|
||||||
|
|
|
@ -7,7 +7,7 @@ function readlink() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "${1}" ]; then
|
if [ -z "${1}" ]; then
|
||||||
echo "Job repo is unset. Provide it via first argument like: $(readlink "$0")/download-lib-windows.sh https://something.com/job/something/{windows,windows-8107}"
|
echo "Job repo is unset. Provide it via first argument like: $(readlink "$0")/download-lib-windows.sh https://something.com/job/something/{master,stable}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -16,12 +16,15 @@ arch=x86_64
|
||||||
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
output_dir="$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/windows-$arch/"
|
output_dir="$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/windows-$arch/"
|
||||||
|
|
||||||
mkdir -p "$output_dir"/deps 2> /dev/null
|
mkdir -p "$output_dir" 2> /dev/null
|
||||||
|
|
||||||
curl --location -o libsimplex.zip $job_repo/$arch-linux.$arch-windows:lib:simplex-chat/latest/download/1 && \
|
curl --location -o libsimplex.zip $job_repo/$arch-linux.$arch-windows:lib:simplex-chat/latest/download/1 && \
|
||||||
$WINDIR\\System32\\tar.exe -xf libsimplex.zip && \
|
$WINDIR\\System32\\tar.exe -xf libsimplex.zip && \
|
||||||
mv libsimplex.dll "$output_dir" && \
|
mv libsimplex.dll "$output_dir" && \
|
||||||
mv libcrypto*.dll "$output_dir/deps" && \
|
mv libcrypto*.dll "$output_dir" && \
|
||||||
mv libffi*.dll "$output_dir/deps" && \
|
mv libffi*.dll "$output_dir" && \
|
||||||
mv libgmp*.dll "$output_dir/deps" && \
|
mv libgmp*.dll "$output_dir" && \
|
||||||
|
mv mcfgthread*.dll "$output_dir" && \
|
||||||
|
mv libgcc_s_seh*.dll "$output_dir" && \
|
||||||
|
mv libstdc++*.dll "$output_dir" && \
|
||||||
rm libsimplex.zip
|
rm libsimplex.zip
|
||||||
|
|
|
@ -11,13 +11,12 @@ multiplatform_dir=$root_dir/apps/multiplatform
|
||||||
release_app_dir=$root_dir/apps/multiplatform/release/main/app
|
release_app_dir=$root_dir/apps/multiplatform/release/main/app
|
||||||
|
|
||||||
cd $multiplatform_dir
|
cd $multiplatform_dir
|
||||||
libcrypto_path=$(ldd common/src/commonMain/cpp/desktop/libs/*/deps/libHSdirect-sqlcipher-*.so | grep libcrypto | cut -d'=' -f 2 | cut -d ' ' -f 2)
|
libcrypto_path=$(ldd common/src/commonMain/cpp/desktop/libs/*/libHSdirect-sqlcipher-*.so | grep libcrypto | cut -d'=' -f 2 | cut -d ' ' -f 2)
|
||||||
trap "rm common/src/commonMain/cpp/desktop/libs/*/deps/`basename $libcrypto_path` 2> /dev/null || true" EXIT
|
trap "rm common/src/commonMain/cpp/desktop/libs/*/`basename $libcrypto_path` 2> /dev/null || true" EXIT
|
||||||
cp $libcrypto_path common/src/commonMain/cpp/desktop/libs/*/deps
|
cp $libcrypto_path common/src/commonMain/cpp/desktop/libs/*
|
||||||
|
|
||||||
./gradlew createDistributable
|
./gradlew createDistributable
|
||||||
rm common/src/commonMain/cpp/desktop/libs/*/deps/`basename $libcrypto_path`
|
rm common/src/commonMain/cpp/desktop/libs/*/`basename $libcrypto_path`
|
||||||
rm desktop/src/jvmMain/resources/libs/*/`basename $libcrypto_path`
|
|
||||||
|
|
||||||
rm -rf $release_app_dir/AppDir 2>/dev/null
|
rm -rf $release_app_dir/AppDir 2>/dev/null
|
||||||
mkdir -p $release_app_dir/AppDir/usr
|
mkdir -p $release_app_dir/AppDir/usr
|
||||||
|
|
|
@ -6,7 +6,7 @@ function readlink() {
|
||||||
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
||||||
}
|
}
|
||||||
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
vlc_dir=$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/linux-x86_64/deps/vlc
|
vlc_dir=$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/linux-x86_64/vlc
|
||||||
|
|
||||||
mkdir $vlc_dir || exit 0
|
mkdir $vlc_dir || exit 0
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ function readlink() {
|
||||||
}
|
}
|
||||||
|
|
||||||
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
vlc_dir=$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/mac-$ARCH/deps/vlc
|
vlc_dir=$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/mac-$ARCH/vlc
|
||||||
#rm -rf $vlc_dir
|
#rm -rf $vlc_dir
|
||||||
mkdir -p $vlc_dir/vlc || exit 0
|
mkdir -p $vlc_dir/vlc || exit 0
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ function readlink() {
|
||||||
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
||||||
}
|
}
|
||||||
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
vlc_dir=$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/windows-x86_64/deps/vlc
|
vlc_dir=$root_dir/apps/multiplatform/common/src/commonMain/cpp/desktop/libs/windows-x86_64/vlc
|
||||||
rm -rf $vlc_dir
|
rm -rf $vlc_dir
|
||||||
mkdir -p $vlc_dir/vlc || exit 0
|
mkdir -p $vlc_dir/vlc || exit 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue