mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-11 08:27:11 +00:00
android: support for ARMv7a and Android 8+ (#2038)
* add armv7a * disable armv6l, that is lacking SMP atomics * Add Android 8 setting (API Ver 26) * Drop x86_64-linux, this makes no sense with `pkgs' = androidPkgs`. * Drop mis-labled x86_64-linux:lib:support (it was aarch64-android) * Drop x86_64-android, these do not exist in nixpkgs The ones set up were aarch64-android anyway (pkgs' = androidPkgs) * android: support Android 8+, armeabi-v7a (32 bit) (#2012) * test * stubs for allowing to launch the app * more stubs and minSdk lowered to 26 * replaced functions that supported on higher API levels with other functions * animated images on lower API levels and write permission * updated abi filter and scripts for downloading libs * changed compression script for multiple apks * cmake changes --------- Co-authored-by: Avently <7953703+avently@users.noreply.github.com> * update haskell.nix ref * bump hackage * bump haskell.nix (again) * build-android: add armv7 * flake.nix: remove local nixconf This change to flake.nix breaks build-android.sh script by forcing user to input y/n. AFAIK, this cannot be automated and I rather not include workarounds like piping "yes n | nix build ...". * build-android.sh: update nix version * flake.{nix,lock}: testing * flake.{nix,lock}: restore to original * update android/prepare script to use zip archives * update gradle file * android: 4.6-beta.0 (104) * android: abi filter for bundle (#2075) * android: abi filter for bundle * removed log --------- Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --------- Co-authored-by: Moritz Angermann <moritz.angermann@gmail.com> Co-authored-by: Avently <7953703+avently@users.noreply.github.com> Co-authored-by: shum <shum@liber.li>
This commit is contained in:
committed by
GitHub
parent
b2aec6d6a7
commit
05c4a6c682
@@ -75,3 +75,4 @@ website/package-lock.json
|
|||||||
# Ignore test files
|
# Ignore test files
|
||||||
website/.cache
|
website/.cache
|
||||||
website/test/stubs-layout-cache/_includes/*.js
|
website/test/stubs-layout-cache/_includes/*.js
|
||||||
|
apps/android/app/release
|
||||||
|
|||||||
@@ -9,15 +9,12 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "chat.simplex.app"
|
applicationId "chat.simplex.app"
|
||||||
minSdk 29
|
minSdk 26
|
||||||
targetSdk 32
|
targetSdk 32
|
||||||
versionCode 107
|
versionCode 107
|
||||||
versionName "4.6"
|
versionName "4.6"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ndk {
|
|
||||||
abiFilters 'arm64-v8a'
|
|
||||||
}
|
|
||||||
vectorDrawables {
|
vectorDrawables {
|
||||||
useSupportLibrary true
|
useSupportLibrary true
|
||||||
}
|
}
|
||||||
@@ -77,10 +74,27 @@ android {
|
|||||||
jniLibs.useLegacyPackaging = compression_level != "0"
|
jniLibs.useLegacyPackaging = compression_level != "0"
|
||||||
}
|
}
|
||||||
def isRelease = gradle.getStartParameter().taskNames.find({ it.toLowerCase().contains("release") }) != null
|
def isRelease = gradle.getStartParameter().taskNames.find({ it.toLowerCase().contains("release") }) != null
|
||||||
|
def isBundle = gradle.getStartParameter().taskNames.find({ it.toLowerCase().contains("bundle") }) != null
|
||||||
// if (isRelease) {
|
// if (isRelease) {
|
||||||
// Comma separated list of languages that will be included in the apk
|
// Comma separated list of languages that will be included in the apk
|
||||||
android.defaultConfig.resConfigs("en", "cs", "de", "es", "fr", "it", "nl", "ru", "zh-rCN")
|
android.defaultConfig.resConfigs("en", "cs", "de", "es", "fr", "it", "nl", "ru", "zh-rCN")
|
||||||
// }
|
// }
|
||||||
|
if (isBundle) {
|
||||||
|
defaultConfig.ndk.abiFilters 'arm64-v8a', 'armeabi-v7a'
|
||||||
|
} else {
|
||||||
|
splits {
|
||||||
|
abi {
|
||||||
|
enable true
|
||||||
|
reset()
|
||||||
|
if (isRelease) {
|
||||||
|
include 'arm64-v8a', 'armeabi-v7a'
|
||||||
|
} else {
|
||||||
|
include 'arm64-v8a', 'armeabi-v7a'
|
||||||
|
universalApk false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -196,6 +210,8 @@ tasks.register("compressApk") {
|
|||||||
|
|
||||||
if (project.properties['android.injected.signing.key.alias'] != null && buildType == 'release') {
|
if (project.properties['android.injected.signing.key.alias'] != null && buildType == 'release') {
|
||||||
new File(outputDir, "app-release.apk").renameTo(new File(outputDir, "simplex.apk"))
|
new File(outputDir, "app-release.apk").renameTo(new File(outputDir, "simplex.apk"))
|
||||||
|
new File(outputDir, "app-armeabi-v7a-release.apk").renameTo(new File(outputDir, "simplex-armv7a.apk"))
|
||||||
|
new File(outputDir, "app-arm64-v8a-release.apk").renameTo(new File(outputDir, "simplex.apk"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// View all gradle properties set
|
// View all gradle properties set
|
||||||
|
|||||||
@@ -53,10 +53,6 @@ add_library( support SHARED IMPORTED )
|
|||||||
set_target_properties( support PROPERTIES IMPORTED_LOCATION
|
set_target_properties( support PROPERTIES IMPORTED_LOCATION
|
||||||
${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libsupport.so)
|
${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libsupport.so)
|
||||||
|
|
||||||
add_library( crypto SHARED IMPORTED )
|
|
||||||
set_target_properties( crypto PROPERTIES IMPORTED_LOCATION
|
|
||||||
${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}/libcrypto.so)
|
|
||||||
|
|
||||||
# Specifies libraries CMake should link to your target library. You
|
# Specifies libraries CMake should link to your target library. You
|
||||||
# can link multiple libraries, such as libraries you define in this
|
# can link multiple libraries, such as libraries you define in this
|
||||||
# build script, prebuilt third-party libraries, or system libraries.
|
# build script, prebuilt third-party libraries, or system libraries.
|
||||||
@@ -64,7 +60,7 @@ set_target_properties( crypto PROPERTIES IMPORTED_LOCATION
|
|||||||
target_link_libraries( # Specifies the target library.
|
target_link_libraries( # Specifies the target library.
|
||||||
app-lib
|
app-lib
|
||||||
|
|
||||||
simplex support crypto
|
simplex support
|
||||||
|
|
||||||
# Links the target library to the log library
|
# Links the target library to the log library
|
||||||
# included in the NDK.
|
# included in the NDK.
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ void hs_init(int * argc, char **argv[]);
|
|||||||
void setLineBuffering(void);
|
void setLineBuffering(void);
|
||||||
int pipe_std_to_socket(const char * name);
|
int pipe_std_to_socket(const char * name);
|
||||||
|
|
||||||
|
extern void __svfscanf(void){};
|
||||||
|
extern void __vfwscanf(void){};
|
||||||
|
extern void __memset_chk_fail(void){};
|
||||||
|
extern void __strcpy_chk_generic(void){};
|
||||||
|
extern void __strcat_chk_generic(void){};
|
||||||
|
extern void __libc_globals(void){};
|
||||||
|
extern void __rel_iplt_start(void){};
|
||||||
|
|
||||||
|
// Android 9 only, not 13
|
||||||
|
extern void reallocarray(void){};
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_chat_simplex_app_SimplexAppKt_pipeStdOutToSocket(JNIEnv *env, __unused jclass clazz, jstring socket_name) {
|
Java_chat_simplex_app_SimplexAppKt_pipeStdOutToSocket(JNIEnv *env, __unused jclass clazz, jstring socket_name) {
|
||||||
const char *name = (*env)->GetStringUTFChars(env, socket_name, JNI_FALSE);
|
const char *name = (*env)->GetStringUTFChars(env, socket_name, JNI_FALSE);
|
||||||
|
|||||||
@@ -7,11 +7,10 @@ import android.Manifest
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.*
|
import android.content.*
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Bitmap
|
import android.graphics.*
|
||||||
import android.graphics.ImageDecoder
|
|
||||||
import android.graphics.ImageDecoder.DecodeException
|
|
||||||
import android.graphics.drawable.AnimatedImageDrawable
|
import android.graphics.drawable.AnimatedImageDrawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@@ -36,6 +35,7 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.font.FontStyle
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.net.toFile
|
||||||
import chat.simplex.app.*
|
import chat.simplex.app.*
|
||||||
import chat.simplex.app.R
|
import chat.simplex.app.R
|
||||||
import chat.simplex.app.model.*
|
import chat.simplex.app.model.*
|
||||||
@@ -186,10 +186,11 @@ fun ComposeView(
|
|||||||
val textStyle = remember { mutableStateOf(smallFont) }
|
val textStyle = remember { mutableStateOf(smallFont) }
|
||||||
val cameraLauncher = rememberCameraLauncher { uri: Uri? ->
|
val cameraLauncher = rememberCameraLauncher { uri: Uri? ->
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
val source = ImageDecoder.createSource(SimplexApp.context.contentResolver, uri)
|
val bitmap: Bitmap? = getBitmapFromUri(uri)
|
||||||
val bitmap = ImageDecoder.decodeBitmap(source)
|
if (bitmap != null) {
|
||||||
val imagePreview = resizeImageToStrSize(bitmap, maxDataSize = 14000)
|
val imagePreview = resizeImageToStrSize(bitmap, maxDataSize = 14000)
|
||||||
composeState.value = composeState.value.copy(preview = ComposePreview.ImagePreview(listOf(imagePreview), listOf(UploadContent.SimpleImage(uri))))
|
composeState.value = composeState.value.copy(preview = ComposePreview.ImagePreview(listOf(imagePreview), listOf(UploadContent.SimpleImage(uri))))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val cameraPermissionLauncher = rememberPermissionLauncher { isGranted: Boolean ->
|
val cameraPermissionLauncher = rememberPermissionLauncher { isGranted: Boolean ->
|
||||||
@@ -203,19 +204,12 @@ fun ComposeView(
|
|||||||
val content = ArrayList<UploadContent>()
|
val content = ArrayList<UploadContent>()
|
||||||
val imagesPreview = ArrayList<String>()
|
val imagesPreview = ArrayList<String>()
|
||||||
uris.forEach { uri ->
|
uris.forEach { uri ->
|
||||||
val source = ImageDecoder.createSource(context.contentResolver, uri)
|
val drawable = getDrawableFromUri(uri)
|
||||||
val drawable = try {
|
var bitmap: Bitmap? = if (drawable != null) getBitmapFromUri(uri) else null
|
||||||
ImageDecoder.decodeDrawable(source)
|
val isAnimNewApi = Build.VERSION.SDK_INT >= 28 && drawable is AnimatedImageDrawable
|
||||||
} catch (e: DecodeException) {
|
val isAnimOldApi = Build.VERSION.SDK_INT < 28 &&
|
||||||
AlertManager.shared.showAlertMsg(
|
(getFileName(SimplexApp.context, uri)?.endsWith(".gif") == true || getFileName(SimplexApp.context, uri)?.endsWith(".webp") == true)
|
||||||
title = generalGetString(R.string.image_decoding_exception_title),
|
if (isAnimNewApi || isAnimOldApi) {
|
||||||
text = generalGetString(R.string.image_decoding_exception_desc)
|
|
||||||
)
|
|
||||||
Log.e(TAG, "Error while decoding drawable: ${e.stackTraceToString()}")
|
|
||||||
null
|
|
||||||
}
|
|
||||||
var bitmap: Bitmap? = if (drawable != null) ImageDecoder.decodeBitmap(source) else null
|
|
||||||
if (drawable is AnimatedImageDrawable) {
|
|
||||||
// It's a gif or webp
|
// It's a gif or webp
|
||||||
val fileSize = getFileSize(context, uri)
|
val fileSize = getFileSize(context, uri)
|
||||||
if (fileSize != null && fileSize <= MAX_FILE_SIZE) {
|
if (fileSize != null && fileSize <= MAX_FILE_SIZE) {
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ import android.content.pm.ActivityInfo
|
|||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
|
import android.util.Log
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.view.inputmethod.*
|
import android.view.inputmethod.*
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.compose.animation.core.*
|
import androidx.compose.animation.core.*
|
||||||
import androidx.compose.foundation.*
|
import androidx.compose.foundation.*
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
@@ -50,6 +52,7 @@ import chat.simplex.app.views.chat.item.ItemAction
|
|||||||
import chat.simplex.app.views.helpers.*
|
import chat.simplex.app.views.helpers.*
|
||||||
import com.google.accompanist.permissions.rememberMultiplePermissionsState
|
import com.google.accompanist.permissions.rememberMultiplePermissionsState
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import java.lang.reflect.Field
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SendMsgView(
|
fun SendMsgView(
|
||||||
@@ -240,7 +243,17 @@ private fun NativeKeyboard(
|
|||||||
editText.background = drawable
|
editText.background = drawable
|
||||||
editText.setPadding(paddingStart, paddingTop, paddingEnd, paddingBottom)
|
editText.setPadding(paddingStart, paddingTop, paddingEnd, paddingBottom)
|
||||||
editText.setText(cs.message)
|
editText.setText(cs.message)
|
||||||
editText.textCursorDrawable?.let { DrawableCompat.setTint(it, HighOrLowlight.toArgb()) }
|
if (Build.VERSION.SDK_INT >= 29) {
|
||||||
|
editText.textCursorDrawable?.let { DrawableCompat.setTint(it, HighOrLowlight.toArgb()) }
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
val f: Field = TextView::class.java.getDeclaredField("mCursorDrawableRes")
|
||||||
|
f.isAccessible = true
|
||||||
|
f.set(editText, R.drawable.edit_text_cursor)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(chat.simplex.app.TAG, e.stackTraceToString())
|
||||||
|
}
|
||||||
|
}
|
||||||
editText.doOnTextChanged { text, _, _, _ -> onMessageChange(text.toString()) }
|
editText.doOnTextChanged { text, _, _, _ -> onMessageChange(text.toString()) }
|
||||||
editText.doAfterTextChanged { text -> if (composeState.value.preview is ComposePreview.VoicePreview && text.toString() != "") editText.setText("") }
|
editText.doAfterTextChanged { text -> if (composeState.value.preview is ComposePreview.VoicePreview && text.toString() != "") editText.setText("") }
|
||||||
editText
|
editText
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package chat.simplex.app.views.chat.item
|
package chat.simplex.app.views.chat.item
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.os.Build
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
@@ -25,6 +27,7 @@ import chat.simplex.app.ui.theme.SimpleXTheme
|
|||||||
import chat.simplex.app.views.chat.ComposeContextItem
|
import chat.simplex.app.views.chat.ComposeContextItem
|
||||||
import chat.simplex.app.views.chat.ComposeState
|
import chat.simplex.app.views.chat.ComposeState
|
||||||
import chat.simplex.app.views.helpers.*
|
import chat.simplex.app.views.helpers.*
|
||||||
|
import com.google.accompanist.permissions.rememberPermissionState
|
||||||
import kotlinx.datetime.Clock
|
import kotlinx.datetime.Clock
|
||||||
|
|
||||||
// TODO refactor so that FramedItemView can show all CIContent items if they're deleted (see Swift code)
|
// TODO refactor so that FramedItemView can show all CIContent items if they're deleted (see Swift code)
|
||||||
@@ -131,9 +134,16 @@ fun ChatItemView(
|
|||||||
if (cItem.content.msgContent is MsgContent.MCImage || cItem.content.msgContent is MsgContent.MCFile || cItem.content.msgContent is MsgContent.MCVoice) {
|
if (cItem.content.msgContent is MsgContent.MCImage || cItem.content.msgContent is MsgContent.MCFile || cItem.content.msgContent is MsgContent.MCVoice) {
|
||||||
val filePath = getLoadedFilePath(context, cItem.file)
|
val filePath = getLoadedFilePath(context, cItem.file)
|
||||||
if (filePath != null) {
|
if (filePath != null) {
|
||||||
|
val writePermissionState = rememberPermissionState(permission = Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
ItemAction(stringResource(R.string.save_verb), Icons.Outlined.SaveAlt, onClick = {
|
ItemAction(stringResource(R.string.save_verb), Icons.Outlined.SaveAlt, onClick = {
|
||||||
when (cItem.content.msgContent) {
|
when (cItem.content.msgContent) {
|
||||||
is MsgContent.MCImage -> saveImage(context, cItem.file)
|
is MsgContent.MCImage -> {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || writePermissionState.hasPermission) {
|
||||||
|
saveImage(context, cItem.file)
|
||||||
|
} else {
|
||||||
|
writePermissionState.launchPermissionRequest()
|
||||||
|
}
|
||||||
|
}
|
||||||
is MsgContent.MCFile -> saveFileLauncher.launch(cItem.file?.fileName)
|
is MsgContent.MCFile -> saveFileLauncher.launch(cItem.file?.fileName)
|
||||||
is MsgContent.MCVoice -> saveFileLauncher.launch(cItem.file?.fileName)
|
is MsgContent.MCVoice -> saveFileLauncher.launch(cItem.file?.fileName)
|
||||||
else -> {}
|
else -> {}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import SectionView
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.FileUtils
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.compose.ManagedActivityResultLauncher
|
import androidx.activity.compose.ManagedActivityResultLauncher
|
||||||
@@ -40,6 +39,7 @@ import chat.simplex.app.views.helpers.*
|
|||||||
import chat.simplex.app.views.usersettings.*
|
import chat.simplex.app.views.usersettings.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.datetime.*
|
import kotlinx.datetime.*
|
||||||
|
import org.apache.commons.io.IOUtils
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -620,7 +620,7 @@ private fun saveArchiveFromUri(context: Context, importedArchiveUri: Uri): Strin
|
|||||||
if (inputStream != null && archiveName != null) {
|
if (inputStream != null && archiveName != null) {
|
||||||
val archivePath = "${context.cacheDir}/$archiveName"
|
val archivePath = "${context.cacheDir}/$archiveName"
|
||||||
val destFile = File(archivePath)
|
val destFile = File(archivePath)
|
||||||
FileUtils.copy(inputStream, FileOutputStream(destFile))
|
IOUtils.copy(inputStream, FileOutputStream(destFile))
|
||||||
archivePath
|
archivePath
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "saveArchiveFromUri null inputStream")
|
Log.e(TAG, "saveArchiveFromUri null inputStream")
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import android.content.*
|
|||||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.graphics.ImageDecoder.DecodeException
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
@@ -114,7 +113,7 @@ fun base64ToBitmap(base64ImageString: String): Bitmap {
|
|||||||
class CustomTakePicturePreview(var uri: Uri?, var tmpFile: File?): ActivityResultContract<Void?, Uri?>() {
|
class CustomTakePicturePreview(var uri: Uri?, var tmpFile: File?): ActivityResultContract<Void?, Uri?>() {
|
||||||
@CallSuper
|
@CallSuper
|
||||||
override fun createIntent(context: Context, input: Void?): Intent {
|
override fun createIntent(context: Context, input: Void?): Intent {
|
||||||
tmpFile = File.createTempFile("image", ".bmp", context.filesDir)
|
tmpFile = File.createTempFile("image", ".bmp", File(getAppFilesDirectory(SimplexApp.context)))
|
||||||
// Since the class should return Uri, the file should be deleted somewhere else. And in order to be sure, delegate this to system
|
// Since the class should return Uri, the file should be deleted somewhere else. And in order to be sure, delegate this to system
|
||||||
tmpFile?.deleteOnExit()
|
tmpFile?.deleteOnExit()
|
||||||
uri = FileProvider.getUriForFile(context, "${BuildConfig.APPLICATION_ID}.provider", tmpFile!!)
|
uri = FileProvider.getUriForFile(context, "${BuildConfig.APPLICATION_ID}.provider", tmpFile!!)
|
||||||
@@ -205,17 +204,10 @@ fun GetImageBottomSheet(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val processPickedImage = { uri: Uri? ->
|
val processPickedImage = { uri: Uri? ->
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
val source = ImageDecoder.createSource(context.contentResolver, uri)
|
val bitmap = getBitmapFromUri(uri)
|
||||||
try {
|
if (bitmap != null) {
|
||||||
val bitmap = ImageDecoder.decodeBitmap(source)
|
|
||||||
imageBitmap.value = uri
|
imageBitmap.value = uri
|
||||||
onImageChange(bitmap)
|
onImageChange(bitmap)
|
||||||
} catch (e: DecodeException) {
|
|
||||||
Log.e(TAG, "Unable to decode the image: ${e.stackTraceToString()}")
|
|
||||||
AlertManager.shared.showAlertMsg(
|
|
||||||
title = generalGetString(R.string.image_decoding_exception_title),
|
|
||||||
text = generalGetString(R.string.image_decoding_exception_desc)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package chat.simplex.app.views.helpers
|
package chat.simplex.app.views.helpers
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.content.*
|
import android.content.*
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
@@ -81,6 +82,7 @@ fun imageMimeType(fileName: String): String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Before calling, make sure the user allows to write to external storage [Manifest.permission.WRITE_EXTERNAL_STORAGE] */
|
||||||
fun saveImage(cxt: Context, ciFile: CIFile?) {
|
fun saveImage(cxt: Context, ciFile: CIFile?) {
|
||||||
val filePath = getLoadedFilePath(cxt, ciFile)
|
val filePath = getLoadedFilePath(cxt, ciFile)
|
||||||
val fileName = ciFile?.fileName
|
val fileName = ciFile?.fileName
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.content.res.Configuration
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.*
|
import android.os.*
|
||||||
import android.provider.OpenableColumns
|
import android.provider.OpenableColumns
|
||||||
@@ -33,10 +34,12 @@ import androidx.compose.ui.unit.*
|
|||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
import androidx.core.text.HtmlCompat
|
import androidx.core.text.HtmlCompat
|
||||||
import chat.simplex.app.*
|
import chat.simplex.app.*
|
||||||
|
import chat.simplex.app.R
|
||||||
import chat.simplex.app.model.*
|
import chat.simplex.app.model.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.encodeToString
|
import kotlinx.serialization.encodeToString
|
||||||
|
import org.apache.commons.io.IOUtils
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -322,6 +325,14 @@ fun getFileName(context: Context, uri: Uri): String? {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getAppFilePath(context: Context, uri: Uri): String? {
|
||||||
|
return context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->
|
||||||
|
val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
|
||||||
|
cursor.moveToFirst()
|
||||||
|
getAppFilePath(context, cursor.getString(nameIndex))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getFileSize(context: Context, uri: Uri): Long? {
|
fun getFileSize(context: Context, uri: Uri): Long? {
|
||||||
return context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->
|
return context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->
|
||||||
val sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE)
|
val sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE)
|
||||||
@@ -330,9 +341,48 @@ fun getFileSize(context: Context, uri: Uri): Long? {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getBitmapFromUri(uri: Uri, withAlertOnException: Boolean = true): Bitmap? {
|
||||||
|
return if (Build.VERSION.SDK_INT >= 28) {
|
||||||
|
val source = ImageDecoder.createSource(SimplexApp.context.contentResolver, uri)
|
||||||
|
try {
|
||||||
|
ImageDecoder.decodeBitmap(source)
|
||||||
|
} catch (e: android.graphics.ImageDecoder.DecodeException) {
|
||||||
|
Log.e(TAG, "Unable to decode the image: ${e.stackTraceToString()}")
|
||||||
|
if (withAlertOnException) {
|
||||||
|
AlertManager.shared.showAlertMsg(
|
||||||
|
title = generalGetString(R.string.image_decoding_exception_title),
|
||||||
|
text = generalGetString(R.string.image_decoding_exception_desc)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BitmapFactory.decodeFile(getAppFilePath(SimplexApp.context, uri))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDrawableFromUri(uri: Uri, withAlertOnException: Boolean = true): Drawable? {
|
||||||
|
return if (Build.VERSION.SDK_INT >= 28) {
|
||||||
|
val source = ImageDecoder.createSource(SimplexApp.context.contentResolver, uri)
|
||||||
|
try {
|
||||||
|
ImageDecoder.decodeDrawable(source)
|
||||||
|
} catch (e: android.graphics.ImageDecoder.DecodeException) {
|
||||||
|
if (withAlertOnException) {
|
||||||
|
AlertManager.shared.showAlertMsg(
|
||||||
|
title = generalGetString(R.string.image_decoding_exception_title),
|
||||||
|
text = generalGetString(R.string.image_decoding_exception_desc)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Log.e(TAG, "Error while decoding drawable: ${e.stackTraceToString()}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Drawable.createFromPath(getAppFilePath(SimplexApp.context, uri))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun saveImage(context: Context, uri: Uri): String? {
|
fun saveImage(context: Context, uri: Uri): String? {
|
||||||
val source = ImageDecoder.createSource(SimplexApp.context.contentResolver, uri)
|
val bitmap = getBitmapFromUri(uri) ?: return null
|
||||||
val bitmap = ImageDecoder.decodeBitmap(source)
|
|
||||||
return saveImage(context, bitmap)
|
return saveImage(context, bitmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +453,7 @@ fun saveFileFromUri(context: Context, uri: Uri): String? {
|
|||||||
if (inputStream != null && fileToSave != null) {
|
if (inputStream != null && fileToSave != null) {
|
||||||
val destFileName = uniqueCombine(context, fileToSave)
|
val destFileName = uniqueCombine(context, fileToSave)
|
||||||
val destFile = File(getAppFilePath(context, destFileName))
|
val destFile = File(getAppFilePath(context, destFileName))
|
||||||
FileUtils.copy(inputStream, FileOutputStream(destFile))
|
IOUtils.copy(inputStream, FileOutputStream(destFile))
|
||||||
destFileName
|
destFileName
|
||||||
} else {
|
} else {
|
||||||
Log.e(chat.simplex.app.TAG, "Util.kt saveFileFromUri null inputStream")
|
Log.e(chat.simplex.app.TAG, "Util.kt saveFileFromUri null inputStream")
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||||
|
<solid android:color="@color/highOrLowLight" />
|
||||||
|
<size android:width="1dp" />
|
||||||
|
</shape>
|
||||||
@@ -2,5 +2,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="highOrLowLight">#8b8786</color>
|
||||||
<color name="window_background_dark">#121212</color>
|
<color name="window_background_dark">#121212</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -8,6 +8,7 @@ buildscript {
|
|||||||
compose_version = localProperties['compose_version'] ?: '1.2.0-beta02'
|
compose_version = localProperties['compose_version'] ?: '1.2.0-beta02'
|
||||||
kotlin_version = localProperties['kotlin_version'] ?: '1.6.21'
|
kotlin_version = localProperties['kotlin_version'] ?: '1.6.21'
|
||||||
gradle_plugin_version = localProperties['gradle_plugin_version'] ?: '7.2.0'
|
gradle_plugin_version = localProperties['gradle_plugin_version'] ?: '7.2.0'
|
||||||
|
abi_filter = localProperties['abi_filter'] ?: 'arm64-v8a'
|
||||||
|
|
||||||
// Name that will be shown for debug build. By default it is from strings
|
// Name that will be shown for debug build. By default it is from strings
|
||||||
app_name = localProperties['app_name'] ?: "@string/app_name"
|
app_name = localProperties['app_name'] ?: "@string/app_name"
|
||||||
|
|||||||
Generated
+153
-95
@@ -51,11 +51,11 @@
|
|||||||
"cabal-34": {
|
"cabal-34": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1640353650,
|
"lastModified": 1645834128,
|
||||||
"narHash": "sha256-N1t6M3/wqj90AEdRkeC8i923gQYUpzSr8b40qVOZ1Rk=",
|
"narHash": "sha256-wG3d+dOt14z8+ydz4SL7pwGfe7SiimxcD/LOuPCV6xM=",
|
||||||
"owner": "haskell",
|
"owner": "haskell",
|
||||||
"repo": "cabal",
|
"repo": "cabal",
|
||||||
"rev": "942639c18c0cd8ec53e0a6f8d120091af35312cd",
|
"rev": "5ff598c67f53f7c4f48e31d722ba37172230c462",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -68,11 +68,11 @@
|
|||||||
"cabal-36": {
|
"cabal-36": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1641652457,
|
"lastModified": 1669081697,
|
||||||
"narHash": "sha256-BlFPKP4C4HRUJeAbdembX1Rms1LD380q9s0qVDeoAak=",
|
"narHash": "sha256-I5or+V7LZvMxfbYgZATU4awzkicBwwok4mVoje+sGmU=",
|
||||||
"owner": "haskell",
|
"owner": "haskell",
|
||||||
"repo": "cabal",
|
"repo": "cabal",
|
||||||
"rev": "f27667f8ec360c475027dcaee0138c937477b070",
|
"rev": "8fd619e33d34924a94e691c5fea2c42f0fc7f144",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -159,15 +159,16 @@
|
|||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1635892615,
|
"lastModified": 1672831974,
|
||||||
"narHash": "sha256-harGbMZr4hzat2BWBU+Y5OYXlu+fVz7E4WeQzHi5o8A=",
|
"narHash": "sha256-z9k3MfslLjWQfnjBtEtJZdq3H7kyi2kQtUThfTgdRk0=",
|
||||||
"owner": "input-output-hk",
|
"owner": "input-output-hk",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"rev": "eca47d3377946315596da653862d341ee5341318",
|
"rev": "45f2638735f8cdc40fe302742b79f248d23eb368",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "input-output-hk",
|
"owner": "input-output-hk",
|
||||||
|
"ref": "hkm/gitlab-fix",
|
||||||
"repo": "flake-compat",
|
"repo": "flake-compat",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -190,11 +191,11 @@
|
|||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667395993,
|
"lastModified": 1676283394,
|
||||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -205,11 +206,11 @@
|
|||||||
},
|
},
|
||||||
"flake-utils_2": {
|
"flake-utils_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1644229661,
|
"lastModified": 1667395993,
|
||||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -248,21 +249,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_5": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1653893745,
|
|
||||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ghc-8.6.5-iohk": {
|
"ghc-8.6.5-iohk": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -302,11 +288,11 @@
|
|||||||
"hackage": {
|
"hackage": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1672446463,
|
"lastModified": 1676679913,
|
||||||
"narHash": "sha256-N5dcK1V+BLQeri5oB0ZSk2ABPs/hTGBC7jZvcY9CVLs=",
|
"narHash": "sha256-nW7ApRgiA9uChV/UrW89HK75rIToLt7XtSrkodO0Nbc=",
|
||||||
"owner": "input-output-hk",
|
"owner": "input-output-hk",
|
||||||
"repo": "hackage.nix",
|
"repo": "hackage.nix",
|
||||||
"rev": "7289869780da23633bc193e11d2da94ecee1489d",
|
"rev": "c37cffd51315d8e27dd8d3faf75abf897e39c8c8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -330,6 +316,7 @@
|
|||||||
],
|
],
|
||||||
"hpc-coveralls": "hpc-coveralls",
|
"hpc-coveralls": "hpc-coveralls",
|
||||||
"hydra": "hydra",
|
"hydra": "hydra",
|
||||||
|
"iserv-proxy": "iserv-proxy",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
@@ -337,21 +324,23 @@
|
|||||||
"nixpkgs-2105": "nixpkgs-2105",
|
"nixpkgs-2105": "nixpkgs-2105",
|
||||||
"nixpkgs-2111": "nixpkgs-2111",
|
"nixpkgs-2111": "nixpkgs-2111",
|
||||||
"nixpkgs-2205": "nixpkgs-2205",
|
"nixpkgs-2205": "nixpkgs-2205",
|
||||||
|
"nixpkgs-2211": "nixpkgs-2211",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"old-ghc-nix": "old-ghc-nix",
|
"old-ghc-nix": "old-ghc-nix",
|
||||||
"stackage": "stackage",
|
"stackage": "stackage",
|
||||||
"tullia": "tullia"
|
"tullia": "tullia"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1672501055,
|
"lastModified": 1677975916,
|
||||||
"narHash": "sha256-Wy6KqoYqQOP1rBvfHUvM3ex8HIdBA4kwnvZj2qQ1VLU=",
|
"narHash": "sha256-dbe8lEEPyfzjdRwpePClv7J9p9lQg7BwbBqAMCw4RLw=",
|
||||||
"owner": "simplex-chat",
|
"owner": "input-output-hk",
|
||||||
"repo": "haskell.nix",
|
"repo": "haskell.nix",
|
||||||
"rev": "dc719cd6dc318923c4a524d005c13f474c00d3d3",
|
"rev": "ab5efd87ce3fd8ade38a01d97693d29a4f1ae7e4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "simplex-chat",
|
"owner": "input-output-hk",
|
||||||
|
"ref": "armv7a",
|
||||||
"repo": "haskell.nix",
|
"repo": "haskell.nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -383,11 +372,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1646878427,
|
"lastModified": 1671755331,
|
||||||
"narHash": "sha256-KtbrofMtN8GlM7D+n90kixr7QpSlVmdN+vK5CA/aRzc=",
|
"narHash": "sha256-hXsgJj0Cy0ZiCiYdW2OdBz5WmFyOMKuw4zyxKpgUKm4=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "hydra",
|
"repo": "hydra",
|
||||||
"rev": "28b682b85b7efc5cf7974065792a1f22203a5927",
|
"rev": "f48f00ee6d5727ae3e488cbf9ce157460853fea8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -395,6 +384,46 @@
|
|||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"incl": {
|
||||||
|
"inputs": {
|
||||||
|
"nixlib": [
|
||||||
|
"haskellNix",
|
||||||
|
"tullia",
|
||||||
|
"std",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1669263024,
|
||||||
|
"narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=",
|
||||||
|
"owner": "divnix",
|
||||||
|
"repo": "incl",
|
||||||
|
"rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "divnix",
|
||||||
|
"repo": "incl",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"iserv-proxy": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1670983692,
|
||||||
|
"narHash": "sha256-avLo34JnI9HNyOuauK5R69usJm+GfW3MlyGlYxZhTgY=",
|
||||||
|
"ref": "hkm/remote-iserv",
|
||||||
|
"rev": "50d0abb3317ac439a4e7495b185a64af9b7b9300",
|
||||||
|
"revCount": 10,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"ref": "hkm/remote-iserv",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitlab.haskell.org/hamishmack/iserv-proxy.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
"lowdown-src": {
|
"lowdown-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -411,25 +440,14 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mdbook-kroki-preprocessor": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1661755005,
|
|
||||||
"narHash": "sha256-1TJuUzfyMycWlOQH67LR63/ll2GDZz25I3JfScy/Jnw=",
|
|
||||||
"owner": "JoelCourtney",
|
|
||||||
"repo": "mdbook-kroki-preprocessor",
|
|
||||||
"rev": "93adb5716d035829efed27f65f2f0833a7d3e76f",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "JoelCourtney",
|
|
||||||
"repo": "mdbook-kroki-preprocessor",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"n2c": {
|
"n2c": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_5",
|
"flake-utils": [
|
||||||
|
"haskellNix",
|
||||||
|
"tullia",
|
||||||
|
"std",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"haskellNix",
|
"haskellNix",
|
||||||
"tullia",
|
"tullia",
|
||||||
@@ -458,16 +476,16 @@
|
|||||||
"nixpkgs-regression": "nixpkgs-regression"
|
"nixpkgs-regression": "nixpkgs-regression"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1643066034,
|
"lastModified": 1661606874,
|
||||||
"narHash": "sha256-xEPeMcNJVOeZtoN+d+aRwolpW8mFSEQx76HTRdlhPhg=",
|
"narHash": "sha256-9+rpYzI+SmxJn+EbYxjGv68Ucp22bdFUSy/4LkHkkDQ=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"rev": "a1cd7e58606a41fcf62bf8637804cf8306f17f62",
|
"rev": "11e45768b34fdafdcf019ddbd337afa16127ff0f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "2.6.0",
|
"ref": "2.11.0",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -563,17 +581,18 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1632864508,
|
"lastModified": 1657693803,
|
||||||
"narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=",
|
"narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "82891b5e2c2359d7e58d08849e4c89511ab94234",
|
"rev": "365e1b3a859281cf11b94f87231adeabbdd878a2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-21.05-small",
|
"ref": "nixos-22.05-small",
|
||||||
"type": "indirect"
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-2003": {
|
"nixpkgs-2003": {
|
||||||
@@ -626,11 +645,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-2205": {
|
"nixpkgs-2205": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1663981975,
|
"lastModified": 1672580127,
|
||||||
"narHash": "sha256-TKaxWAVJR+a5JJauKZqibmaM5e/Pi5tBDx9s8fl/kSE=",
|
"narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "309faedb8338d3ae8ad8f1043b3ccf48c9cc2970",
|
"rev": "0874168639713f547c05947c76124f78441ea46c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -640,6 +659,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-2211": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1675730325,
|
||||||
|
"narHash": "sha256-uNvD7fzO5hNlltNQUAFBPlcEjNG5Gkbhl/ROiX+GZU4=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "b7ce17b1ebf600a72178f6302c77b6382d09323f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-22.11-darwin",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-regression": {
|
"nixpkgs-regression": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1643052045,
|
"lastModified": 1643052045,
|
||||||
@@ -650,18 +685,19 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
|
||||||
"type": "indirect"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1663905476,
|
"lastModified": 1675758091,
|
||||||
"narHash": "sha256-0CSwRKaYravh9v6qSlBpM0gNg0UhKT2lL7Yn6Zbx7UM=",
|
"narHash": "sha256-7gFSQbSVAFUHtGCNHPF7mPc5CcqDk9M2+inlVPZSneg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e14f9fb57315f0d4abde222364f19f88c77d2b79",
|
"rev": "747927516efcb5e31ba03b7ff32f61f6d47e7d87",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -720,20 +756,35 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_5": {
|
"nixpkgs_5": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1669833724,
|
"lastModified": 1676726892,
|
||||||
"narHash": "sha256-/HEZNyGbnQecrgJnfE8d0WC5c1xuPSD2LUpB6YXlg4c=",
|
"narHash": "sha256-M7OYVR6dKmzmlebIjybFf3l18S2uur8lMyWWnHQooLY=",
|
||||||
"owner": "nixos",
|
"owner": "angerman",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4d2b37a84fad1091b9de401eb450aae66f1a741e",
|
"rev": "729469087592bdea58b360de59dadf6d58714c42",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "angerman",
|
||||||
"ref": "22.11",
|
"ref": "release-22.11",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nosys": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667881534,
|
||||||
|
"narHash": "sha256-FhwJ15uPLRsvaxtt/bNuqE/ykMpNAPF0upozFKhTtXM=",
|
||||||
|
"owner": "divnix",
|
||||||
|
"repo": "nosys",
|
||||||
|
"rev": "2d0d5207f6a230e9d0f660903f8db9807b54814f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "divnix",
|
||||||
|
"repo": "nosys",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"old-ghc-nix": {
|
"old-ghc-nix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -762,11 +813,11 @@
|
|||||||
"stackage": {
|
"stackage": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1669598217,
|
"lastModified": 1677888571,
|
||||||
"narHash": "sha256-UioviNyxA3fexeguXLQpgMR6uWL9Q/wulipCbET3C8w=",
|
"narHash": "sha256-YkhRNOaN6QVagZo1cfykYV8KqkI8/q6r2F5+jypOma4=",
|
||||||
"owner": "input-output-hk",
|
"owner": "input-output-hk",
|
||||||
"repo": "stackage.nix",
|
"repo": "stackage.nix",
|
||||||
"rev": "8400280d894949e26354123aebc20801a2165182",
|
"rev": "cb50e6fabdfb2d7e655059039012ad0623f06a27",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -777,17 +828,23 @@
|
|||||||
},
|
},
|
||||||
"std": {
|
"std": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"arion": [
|
||||||
|
"haskellNix",
|
||||||
|
"tullia",
|
||||||
|
"std",
|
||||||
|
"blank"
|
||||||
|
],
|
||||||
"blank": "blank",
|
"blank": "blank",
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
"dmerge": "dmerge",
|
"dmerge": "dmerge",
|
||||||
"flake-utils": "flake-utils_4",
|
"flake-utils": "flake-utils_4",
|
||||||
|
"incl": "incl",
|
||||||
"makes": [
|
"makes": [
|
||||||
"haskellNix",
|
"haskellNix",
|
||||||
"tullia",
|
"tullia",
|
||||||
"std",
|
"std",
|
||||||
"blank"
|
"blank"
|
||||||
],
|
],
|
||||||
"mdbook-kroki-preprocessor": "mdbook-kroki-preprocessor",
|
|
||||||
"microvm": [
|
"microvm": [
|
||||||
"haskellNix",
|
"haskellNix",
|
||||||
"tullia",
|
"tullia",
|
||||||
@@ -797,14 +854,15 @@
|
|||||||
"n2c": "n2c",
|
"n2c": "n2c",
|
||||||
"nixago": "nixago",
|
"nixago": "nixago",
|
||||||
"nixpkgs": "nixpkgs_4",
|
"nixpkgs": "nixpkgs_4",
|
||||||
|
"nosys": "nosys",
|
||||||
"yants": "yants"
|
"yants": "yants"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1665513321,
|
"lastModified": 1674526466,
|
||||||
"narHash": "sha256-D6Pacw9yf/HMs84KYuCxHXnNDL7v43gtcka5URagFqE=",
|
"narHash": "sha256-tMTaS0bqLx6VJ+K+ZT6xqsXNpzvSXJTmogkraBGzymg=",
|
||||||
"owner": "divnix",
|
"owner": "divnix",
|
||||||
"repo": "std",
|
"repo": "std",
|
||||||
"rev": "94a90eedb9cfc115b12ae8f6622d9904788559e4",
|
"rev": "516387e3d8d059b50e742a2ff1909ed3c8f82826",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -824,11 +882,11 @@
|
|||||||
"std": "std"
|
"std": "std"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1666200256,
|
"lastModified": 1675695930,
|
||||||
"narHash": "sha256-cJPS8zBu30SMhxMe7I8DWutwqMuhPsEez87y9gxMKc4=",
|
"narHash": "sha256-B7rEZ/DBUMlK1AcJ9ajnAPPxqXY6zW2SBX+51bZV0Ac=",
|
||||||
"owner": "input-output-hk",
|
"owner": "input-output-hk",
|
||||||
"repo": "tullia",
|
"repo": "tullia",
|
||||||
"rev": "575362c2244498e8d2c97f72861510fa72e75d44",
|
"rev": "621365f2c725608f381b3ad5b57afef389fd4c31",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -862,11 +920,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1660507851,
|
"lastModified": 1667096281,
|
||||||
"narHash": "sha256-BKjq7JnVuUR/xDtcv6Vm9GYGKAblisXrAgybor9hT/s=",
|
"narHash": "sha256-wRRec6ze0gJHmGn6m57/zhz/Kdvp9HS4Nl5fkQ+uIuA=",
|
||||||
"owner": "divnix",
|
"owner": "divnix",
|
||||||
"repo": "yants",
|
"repo": "yants",
|
||||||
"rev": "0b895ca02a8fa72bad50b454cb3e7d8a66407c96",
|
"rev": "d18f356ec25cb94dc9c275870c3a7927a10f8c3c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
description = "nix flake for simplex-chat";
|
description = "nix flake for simplex-chat";
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/22.11";
|
inputs.nixpkgs.url = "github:angerman/nixpkgs/release-22.11";
|
||||||
inputs.haskellNix.url = "github:simplex-chat/haskell.nix";
|
inputs.haskellNix.url = "github:input-output-hk/haskell.nix/armv7a";
|
||||||
inputs.haskellNix.inputs.nixpkgs.follows = "nixpkgs";
|
inputs.haskellNix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.hackage = {
|
inputs.hackage = {
|
||||||
url = "github:input-output-hk/hackage.nix";
|
url = "github:input-output-hk/hackage.nix";
|
||||||
@@ -12,7 +12,23 @@
|
|||||||
outputs = { self, haskellNix, nixpkgs, flake-utils, ... }:
|
outputs = { self, haskellNix, nixpkgs, flake-utils, ... }:
|
||||||
let systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; in
|
let systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; in
|
||||||
flake-utils.lib.eachSystem systems (system:
|
flake-utils.lib.eachSystem systems (system:
|
||||||
let pkgs = haskellNix.legacyPackages.${system}; in
|
# this android26 overlay makes the pkgsCross.{aarch64-android,armv7a-android-prebuilt} to set stdVer to 26 (Android 8).
|
||||||
|
let android26 = final: prev: {
|
||||||
|
pkgsCross = prev.pkgsCross // {
|
||||||
|
aarch64-android = import prev.path {
|
||||||
|
inherit system;
|
||||||
|
inherit (prev) overlays;
|
||||||
|
crossSystem = prev.lib.systems.examples.aarch64-android // { sdkVer = "26"; };
|
||||||
|
};
|
||||||
|
armv7a-android-prebuilt = import prev.path {
|
||||||
|
inherit system;
|
||||||
|
inherit (prev) overlays;
|
||||||
|
crossSystem = prev.lib.systems.examples.armv7a-android-prebuilt // { sdkVer = "26"; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}; in
|
||||||
|
# `appendOverlays` with a singleton is identical to `extend`.
|
||||||
|
let pkgs = haskellNix.legacyPackages.${system}.appendOverlays [android26]; in
|
||||||
let drv' = { extra-modules, pkgs', ... }: pkgs'.haskell-nix.project {
|
let drv' = { extra-modules, pkgs', ... }: pkgs'.haskell-nix.project {
|
||||||
compiler-nix-name = "ghc8107";
|
compiler-nix-name = "ghc8107";
|
||||||
index-state = "2022-06-20T00:00:00Z";
|
index-state = "2022-06-20T00:00:00Z";
|
||||||
@@ -81,6 +97,7 @@
|
|||||||
"x86_64-linux" =
|
"x86_64-linux" =
|
||||||
let
|
let
|
||||||
androidPkgs = pkgs.pkgsCross.aarch64-android;
|
androidPkgs = pkgs.pkgsCross.aarch64-android;
|
||||||
|
android32Pkgs = pkgs.pkgsCross.armv7a-android-prebuilt;
|
||||||
# For some reason building libiconv with nixpgks android setup produces
|
# For some reason building libiconv with nixpgks android setup produces
|
||||||
# LANGINFO_CODESET to be found, which is not compatible with android sdk 23;
|
# LANGINFO_CODESET to be found, which is not compatible with android sdk 23;
|
||||||
# so we'll patch up iconv to not include that.
|
# so we'll patch up iconv to not include that.
|
||||||
@@ -96,11 +113,32 @@
|
|||||||
androidFFI = androidPkgs.libffi.overrideAttrs (old: {
|
androidFFI = androidPkgs.libffi.overrideAttrs (old: {
|
||||||
dontDisableStatic = true;
|
dontDisableStatic = true;
|
||||||
hardeningDisable = [ "fortify" ];
|
hardeningDisable = [ "fortify" ];
|
||||||
postConfigure = ''
|
});
|
||||||
echo "#undef HAVE_MEMFD_CREATE" >> aarch64-unknown-linux-android/fficonfig.h
|
android32FFI = android32Pkgs.libffi.overrideAttrs (old: {
|
||||||
'';
|
dontDisableStatic = true;
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
}
|
}
|
||||||
);in {
|
);in {
|
||||||
|
"${pkgs.pkgsCross.musl64.hostPlatform.system}-static:exe:simplex-chat" = (drv pkgs.pkgsCross.musl64).simplex-chat.components.exes.simplex-chat;
|
||||||
|
"${pkgs.pkgsCross.musl32.hostPlatform.system}-static:exe:simplex-chat" = (drv pkgs.pkgsCross.musl32).simplex-chat.components.exes.simplex-chat;
|
||||||
|
# "${pkgs.pkgsCross.muslpi.hostPlatform.system}-static:exe:simplex-chat" = (drv pkgs.pkgsCross.muslpi).simplex-chat.components.exes.simplex-chat;
|
||||||
|
"${pkgs.pkgsCross.aarch64-multiplatform-musl.hostPlatform.system}-static:exe:simplex-chat" = (drv pkgs.pkgsCross.aarch64-multiplatform-musl).simplex-chat.components.exes.simplex-chat;
|
||||||
|
"armv7a-android:lib:support" = (drv android32Pkgs).android-support.components.library.override {
|
||||||
|
smallAddressSpace = true; enableShared = false;
|
||||||
|
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsupport.so" ];
|
||||||
|
postInstall = ''
|
||||||
|
|
||||||
|
mkdir -p $out/_pkg
|
||||||
|
cp libsupport.so $out/_pkg
|
||||||
|
${pkgs.patchelf}/bin/patchelf --remove-needed libunwind.so.1 $out/_pkg/libsupport.so
|
||||||
|
(cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-armv7a-android-libsupport.zip *)
|
||||||
|
rm -fR $out/_pkg
|
||||||
|
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "file binary-dist \"$(echo $out/*.zip)\"" \
|
||||||
|
> $out/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
};
|
||||||
"aarch64-android:lib:support" = (drv androidPkgs).android-support.components.library.override {
|
"aarch64-android:lib:support" = (drv androidPkgs).android-support.components.library.override {
|
||||||
smallAddressSpace = true; enableShared = false;
|
smallAddressSpace = true; enableShared = false;
|
||||||
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsupport.so" ];
|
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsupport.so" ];
|
||||||
@@ -117,6 +155,67 @@
|
|||||||
> $out/nix-support/hydra-build-products
|
> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
"armv7a-android:lib:simplex-chat" = (drv' {
|
||||||
|
pkgs' = android32Pkgs;
|
||||||
|
extra-modules = [{
|
||||||
|
packages.direct-sqlcipher.flags.openssl = true;
|
||||||
|
packages.direct-sqlcipher.components.library.libs = pkgs.lib.mkForce [
|
||||||
|
(android32Pkgs.openssl.override { static = true; enableKTLS = false; })
|
||||||
|
];
|
||||||
|
packages.direct-sqlcipher.patches = [
|
||||||
|
./scripts/nix/direct-sqlcipher-android-log.patch
|
||||||
|
];
|
||||||
|
}];
|
||||||
|
}).simplex-chat.components.library.override {
|
||||||
|
smallAddressSpace = true; enableShared = false;
|
||||||
|
# for android we build a shared library, passing these arguments is a bit tricky, as
|
||||||
|
# we want only the threaded rts (HSrts_thr) and ffi to be linked, but not fed into iserv for
|
||||||
|
# template haskell cross compilation. Thus we just pass them as linker options (-optl).
|
||||||
|
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsimplex.so" "-optl-lHSrts_thr" "-optl-lffi"];
|
||||||
|
postInstall = ''
|
||||||
|
set -x
|
||||||
|
${pkgs.tree}/bin/tree $out
|
||||||
|
mkdir -p $out/_pkg
|
||||||
|
# copy over includes, we might want those, but maybe not.
|
||||||
|
# cp -r $out/lib/*/*/include $out/_pkg/
|
||||||
|
# find the libHS...ghc-X.Y.Z.a static library; this is the
|
||||||
|
# rolled up one with all dependencies included.
|
||||||
|
cp libsimplex.so $out/_pkg
|
||||||
|
# find ./dist -name "lib*.so" -exec cp {} $out/_pkg \;
|
||||||
|
# find ./dist -name "libHS*-ghc*.a" -exec cp {} $out/_pkg \;
|
||||||
|
# find ${android32FFI}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
||||||
|
# find ${android32Pkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
||||||
|
# find ${androidIconv}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
||||||
|
# find ${android32Pkgs.stdenv.cc.libc}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
||||||
|
echo ${android32Pkgs.openssl.override { enableKTLS = false; }}
|
||||||
|
find ${(android32Pkgs.openssl.override { enableKTLS = false; }).out}/lib -name "*.so" -exec cp {} $out/_pkg \;
|
||||||
|
|
||||||
|
# remove the .1 and other version suffixes from .so's. Androids linker
|
||||||
|
# doesn't play nice with them.
|
||||||
|
for lib in $out/_pkg/*.so; do
|
||||||
|
for dep in $(${pkgs.patchelf}/bin/patchelf --print-needed "$lib"); do
|
||||||
|
if [[ "''${dep##*.so}" ]]; then
|
||||||
|
echo "$lib : $dep -> ''${dep%%.so*}.so"
|
||||||
|
chmod +w "$lib"
|
||||||
|
${pkgs.patchelf}/bin/patchelf --replace-needed "$dep" "''${dep%%.so*}.so" "$lib"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
for lib in $out/_pkg/*.so; do
|
||||||
|
chmod +w "$lib"
|
||||||
|
${pkgs.patchelf}/bin/patchelf --remove-needed libunwind.so "$lib"
|
||||||
|
[[ "$lib" != *libsimplex.so ]] && ${pkgs.patchelf}/bin/patchelf --set-soname "$(basename -a $lib)" "$lib"
|
||||||
|
done
|
||||||
|
|
||||||
|
${pkgs.tree}/bin/tree $out/_pkg
|
||||||
|
(cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-armv7a-android-libsimplex.zip *)
|
||||||
|
rm -fR $out/_pkg
|
||||||
|
mkdir -p $out/nix-support
|
||||||
|
echo "file binary-dist \"$(echo $out/*.zip)\"" \
|
||||||
|
> $out/nix-support/hydra-build-products
|
||||||
|
'';
|
||||||
|
};
|
||||||
"aarch64-android:lib:simplex-chat" = (drv' {
|
"aarch64-android:lib:simplex-chat" = (drv' {
|
||||||
pkgs' = androidPkgs;
|
pkgs' = androidPkgs;
|
||||||
extra-modules = [{
|
extra-modules = [{
|
||||||
@@ -178,110 +277,6 @@
|
|||||||
> $out/nix-support/hydra-build-products
|
> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"x86_64-android:lib:support" = (drv androidPkgs).android-support.components.library.override {
|
|
||||||
smallAddressSpace = true; enableShared = false;
|
|
||||||
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsupport.so" ];
|
|
||||||
postInstall = ''
|
|
||||||
|
|
||||||
mkdir -p $out/_pkg
|
|
||||||
cp libsupport.so $out/_pkg
|
|
||||||
${pkgs.patchelf}/bin/patchelf --remove-needed libunwind.so.1 $out/_pkg/libsupport.so
|
|
||||||
(cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-x86_64-android-libsupport.zip *)
|
|
||||||
rm -fR $out/_pkg
|
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "file binary-dist \"$(echo $out/*.zip)\"" \
|
|
||||||
> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"x86_64-android:lib:simplex-chat" = (drv' {
|
|
||||||
pkgs' = androidPkgs;
|
|
||||||
extra-modules = [{
|
|
||||||
packages.direct-sqlcipher.flags.openssl = true;
|
|
||||||
}];
|
|
||||||
}).simplex-chat.components.library.override {
|
|
||||||
smallAddressSpace = true; enableShared = false;
|
|
||||||
# for android we build a shared library, passing these arguments is a bit tricky, as
|
|
||||||
# we want only the threaded rts (HSrts_thr) and ffi to be linked, but not fed into iserv for
|
|
||||||
# template haskell cross compilation. Thus we just pass them as linker options (-optl).
|
|
||||||
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsimplex.so" "-optl-lHSrts_thr" "-optl-lffi"];
|
|
||||||
postInstall = ''
|
|
||||||
${pkgs.tree}/bin/tree $out
|
|
||||||
mkdir -p $out/_pkg
|
|
||||||
# copy over includes, we might want those, but maybe not.
|
|
||||||
# cp -r $out/lib/*/*/include $out/_pkg/
|
|
||||||
# find the libHS...ghc-X.Y.Z.a static library; this is the
|
|
||||||
# rolled up one with all dependencies included.
|
|
||||||
cp libsimplex.so $out/_pkg
|
|
||||||
# find ./dist -name "lib*.so" -exec cp {} $out/_pkg \;
|
|
||||||
# find ./dist -name "libHS*-ghc*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidFFI}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidPkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidIconv}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidPkgs.stdenv.cc.libc}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
|
|
||||||
${pkgs.patchelf}/bin/patchelf --remove-needed libunwind.so.1 $out/_pkg/libsimplex.so
|
|
||||||
|
|
||||||
${pkgs.tree}/bin/tree $out/_pkg
|
|
||||||
(cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-x86_64-android-libsimplex.zip *)
|
|
||||||
rm -fR $out/_pkg
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "file binary-dist \"$(echo $out/*.zip)\"" \
|
|
||||||
> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"x86_64-linux:lib:support" = (drv androidPkgs).android-support.components.library.override {
|
|
||||||
smallAddressSpace = true; enableShared = false;
|
|
||||||
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsupport.so" ];
|
|
||||||
postInstall = ''
|
|
||||||
|
|
||||||
mkdir -p $out/_pkg
|
|
||||||
cp libsupport.so $out/_pkg
|
|
||||||
${pkgs.patchelf}/bin/patchelf --remove-needed libunwind.so.1 $out/_pkg/libsupport.so
|
|
||||||
(cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-x86_64-linux-libsupport.zip *)
|
|
||||||
rm -fR $out/_pkg
|
|
||||||
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "file binary-dist \"$(echo $out/*.zip)\"" \
|
|
||||||
> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"x86_64-linux:lib:simplex-chat" = (drv' {
|
|
||||||
pkgs' = androidPkgs;
|
|
||||||
extra-modules = [{
|
|
||||||
packages.direct-sqlcipher.flags.openssl = true;
|
|
||||||
}];
|
|
||||||
}).simplex-chat.components.library.override {
|
|
||||||
smallAddressSpace = true; enableShared = false;
|
|
||||||
# for android we build a shared library, passing these arguments is a bit tricky, as
|
|
||||||
# we want only the threaded rts (HSrts_thr) and ffi to be linked, but not fed into iserv for
|
|
||||||
# template haskell cross compilation. Thus we just pass them as linker options (-optl).
|
|
||||||
setupBuildFlags = map (x: "--ghc-option=${x}") [ "-shared" "-o" "libsimplex.so" "-optl-lHSrts_thr" "-optl-lffi"];
|
|
||||||
postInstall = ''
|
|
||||||
${pkgs.tree}/bin/tree $out
|
|
||||||
mkdir -p $out/_pkg
|
|
||||||
# copy over includes, we might want those, but maybe not.
|
|
||||||
# cp -r $out/lib/*/*/include $out/_pkg/
|
|
||||||
# find the libHS...ghc-X.Y.Z.a static library; this is the
|
|
||||||
# rolled up one with all dependencies included.
|
|
||||||
cp libsimplex.so $out/_pkg
|
|
||||||
# find ./dist -name "lib*.so" -exec cp {} $out/_pkg \;
|
|
||||||
# find ./dist -name "libHS*-ghc*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidFFI}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidPkgs.gmp6.override { withStatic = true; }}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidIconv}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
# find ${androidPkgs.stdenv.cc.libc}/lib -name "*.a" -exec cp {} $out/_pkg \;
|
|
||||||
|
|
||||||
${pkgs.patchelf}/bin/patchelf --remove-needed libunwind.so.1 $out/_pkg/libsimplex.so
|
|
||||||
|
|
||||||
${pkgs.tree}/bin/tree $out/_pkg
|
|
||||||
(cd $out/_pkg; ${pkgs.zip}/bin/zip -r -9 $out/pkg-x86_64-linux-libsimplex.zip *)
|
|
||||||
rm -fR $out/_pkg
|
|
||||||
mkdir -p $out/nix-support
|
|
||||||
echo "file binary-dist \"$(echo $out/*.zip)\"" \
|
|
||||||
> $out/nix-support/hydra-build-products
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# builds for iOS and iOS simulator
|
# builds for iOS and iOS simulator
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ nix_install() {
|
|||||||
[ ! -d /nix ] && sudo sh -c "mkdir -p /nix && chown -R $u /nix"
|
[ ! -d /nix ] && sudo sh -c "mkdir -p /nix && chown -R $u /nix"
|
||||||
|
|
||||||
# Install nix
|
# Install nix
|
||||||
nix_ver="nix-2.11.1"
|
nix_ver="nix-2.14.1"
|
||||||
nix_url="https://releases.nixos.org/nix/$nix_ver/install"
|
nix_url="https://releases.nixos.org/nix/$nix_ver/install"
|
||||||
nix_hash="4569a01dc5f62056f29f3195673bc3242fc70bf2474927fb5d8549c4d997402d"
|
nix_hash="565974057264f0536f600c68d59395927cd73e9fc5a60f33c1906e8f7bc33fcf"
|
||||||
|
|
||||||
curl -sSf "$nix_url" -o "$tmp/nix-install"
|
curl -sSf "$nix_url" -o "$tmp/nix-install"
|
||||||
printf "%s %s" "$nix_hash" "$tmp/nix-install" | sha256sum -c
|
printf "%s %s" "$nix_hash" "$tmp/nix-install" | sha256sum -c
|
||||||
@@ -29,11 +29,16 @@ nix_setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
git_setup() {
|
git_setup() {
|
||||||
|
[ "$folder" != "." ] && {
|
||||||
|
git clone --depth=1 https://github.com/simplex-chat/simplex-chat "$folder"
|
||||||
|
}
|
||||||
|
|
||||||
# Switch to nix-android branch
|
# Switch to nix-android branch
|
||||||
git -C "$folder" checkout "$commit"
|
git -C "$folder" checkout "$commit"
|
||||||
|
|
||||||
# Create missing folders
|
# Create missing folders
|
||||||
mkdir -p "$folder/apps/android/app/src/main/cpp/libs/arm64-v8a"
|
mkdir -p "$folder/apps/android/app/src/main/cpp/libs/arm64-v8a"
|
||||||
|
mkdir -p "$folder/apps/android/app/src/main/cpp/libs/armeabi-v7a"
|
||||||
}
|
}
|
||||||
|
|
||||||
checks() {
|
checks() {
|
||||||
@@ -55,10 +60,6 @@ checks() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[ "$folder" != "." ] && {
|
|
||||||
git clone https://github.com/simplex-chat/simplex-chat "$folder"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -n "$commands_failed" ]; then
|
if [ -n "$commands_failed" ]; then
|
||||||
commands_failed=${commands_failed% *}
|
commands_failed=${commands_failed% *}
|
||||||
printf "%s is not found in your \$PATH. Please install them and re-run the script.\n" "$commands_failed"
|
printf "%s is not found in your \$PATH. Please install them and re-run the script.\n" "$commands_failed"
|
||||||
@@ -72,21 +73,31 @@ build() {
|
|||||||
# Build simplex lib
|
# Build simplex lib
|
||||||
nix build "$folder#hydraJobs.aarch64-android:lib:simplex-chat.x86_64-linux"
|
nix build "$folder#hydraJobs.aarch64-android:lib:simplex-chat.x86_64-linux"
|
||||||
unzip -o "$PWD/result/pkg-aarch64-android-libsimplex.zip" -d "$folder/apps/android/app/src/main/cpp/libs/arm64-v8a"
|
unzip -o "$PWD/result/pkg-aarch64-android-libsimplex.zip" -d "$folder/apps/android/app/src/main/cpp/libs/arm64-v8a"
|
||||||
|
|
||||||
|
nix build "$folder#hydraJobs.armv7a-android:lib:simplex-chat.x86_64-linux"
|
||||||
|
unzip -o "$PWD/result/pkg-armv7a-android-libsimplex.zip" -d "$folder/apps/android/app/src/main/cpp/libs/armeabi-v7a"
|
||||||
|
|
||||||
# Build android suppprt lib
|
# Build android suppprt lib
|
||||||
nix build "$folder#hydraJobs.aarch64-android:lib:support.x86_64-linux"
|
nix build "$folder#hydraJobs.aarch64-android:lib:support.x86_64-linux"
|
||||||
unzip -o "$PWD/result/pkg-aarch64-android-libsupport.zip" -d "$folder/apps/android/app/src/main/cpp/libs/arm64-v8a"
|
unzip -o "$PWD/result/pkg-aarch64-android-libsupport.zip" -d "$folder/apps/android/app/src/main/cpp/libs/arm64-v8a"
|
||||||
|
|
||||||
|
nix build "$folder#hydraJobs.armv7a-android:lib:support.x86_64-linux"
|
||||||
|
unzip -o "$PWD/result/pkg-armv7a-android-libsupport.zip" -d "$folder/apps/android/app/src/main/cpp/libs/armeabi-v7a"
|
||||||
|
|
||||||
sed -i.bak 's/${extract_native_libs}/true/' "$folder/apps/android/app/src/main/AndroidManifest.xml"
|
sed -i.bak 's/${extract_native_libs}/true/' "$folder/apps/android/app/src/main/AndroidManifest.xml"
|
||||||
|
sed -i.bak '/android {/a lint {abortOnError false}' "$folder/apps/android/app/build.gradle"
|
||||||
|
|
||||||
gradle -p "$folder/apps/android/" clean build assembleRelease
|
gradle -p "$folder/apps/android/" clean build assembleRelease
|
||||||
|
|
||||||
mkdir -p "$tmp/android"
|
mkdir -p "$tmp/android-aarch64"
|
||||||
unzip -oqd "$tmp/android/" "$folder/apps/android/app/build/outputs/apk/release/app-release-unsigned.apk"
|
unzip -oqd "$tmp/android-aarch64/" "$folder/apps/android/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk"
|
||||||
|
(cd "$tmp/android-aarch64" && zip -rq5 "$tmp/simplex-chat-aarch64.apk" . && zip -rq0 "$tmp/simplex-chat-aarch64.apk" resources.arsc res)
|
||||||
|
zipalign -p -f 4 "$tmp/simplex-chat-aarch64.apk" "$PWD/simplex-chat-aarch64.apk"
|
||||||
|
|
||||||
(cd "$tmp/android" && zip -rq5 "$tmp/simplex-chat.apk" . && zip -rq0 "$tmp/simplex-chat.apk" resources.arsc res)
|
mkdir -p "$tmp/android-armv7"
|
||||||
|
unzip -oqd "$tmp/android-armv7/" "$folder/apps/android/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned.apk"
|
||||||
zipalign -p -f 4 "$tmp/simplex-chat.apk" "$PWD/simplex-chat.apk"
|
(cd "$tmp/android-armv7" && zip -rq5 "$tmp/simplex-chat-armv7.apk" . && zip -rq0 "$tmp/simplex-chat-armv7.apk" resources.arsc res)
|
||||||
|
zipalign -p -f 4 "$tmp/simplex-chat-armv7.apk" "$PWD/simplex-chat-armv7.apk"
|
||||||
}
|
}
|
||||||
|
|
||||||
final() {
|
final() {
|
||||||
|
|||||||
@@ -18,29 +18,31 @@ fi
|
|||||||
|
|
||||||
cd $apk_parent_dir
|
cd $apk_parent_dir
|
||||||
|
|
||||||
ORIG_NAME=$(echo app*.apk)
|
ORIG_NAMES=( $(echo app*.apk) )
|
||||||
unzip -o -q -d apk $ORIG_NAME
|
for ORIG_NAME in "${ORIG_NAMES[@]}"; do
|
||||||
|
unzip -o -q -d apk $ORIG_NAME
|
||||||
|
|
||||||
rm $ORIG_NAME
|
rm $ORIG_NAME
|
||||||
|
|
||||||
(cd apk && zip -r -q -$level ../$ORIG_NAME .)
|
(cd apk && zip -r -q -$level ../$ORIG_NAME .)
|
||||||
# Shouldn't be compressed because of Android requirement
|
# Shouldn't be compressed because of Android requirement
|
||||||
(cd apk && zip -r -q -0 ../$ORIG_NAME resources.arsc)
|
(cd apk && zip -r -q -0 ../$ORIG_NAME resources.arsc)
|
||||||
(cd apk && zip -r -q -0 ../$ORIG_NAME res)
|
(cd apk && zip -r -q -0 ../$ORIG_NAME res)
|
||||||
#(cd apk && 7z a -r -mx=$level -tzip -x!resources.arsc ../$ORIG_NAME .)
|
#(cd apk && 7z a -r -mx=$level -tzip -x!resources.arsc ../$ORIG_NAME .)
|
||||||
#(cd apk && 7z a -r -mx=0 -tzip ../$ORIG_NAME resources.arsc)
|
#(cd apk && 7z a -r -mx=0 -tzip ../$ORIG_NAME resources.arsc)
|
||||||
|
|
||||||
ALL_TOOLS=($sdk_dir/build-tools/*/)
|
ALL_TOOLS=($sdk_dir/build-tools/*/)
|
||||||
BIN_DIR="${ALL_TOOLS[1]}"
|
BIN_DIR="${ALL_TOOLS[1]}"
|
||||||
|
|
||||||
$BIN_DIR/zipalign -p -f 4 $ORIG_NAME $ORIG_NAME-2
|
$BIN_DIR/zipalign -p -f 4 $ORIG_NAME $ORIG_NAME-2
|
||||||
|
|
||||||
mv $ORIG_NAME{-2,}
|
mv $ORIG_NAME{-2,}
|
||||||
|
|
||||||
$BIN_DIR/apksigner sign \
|
$BIN_DIR/apksigner sign \
|
||||||
--ks "$store_file" --ks-key-alias "$key_alias" --ks-pass "pass:$store_password" \
|
--ks "$store_file" --ks-key-alias "$key_alias" --ks-pass "pass:$store_password" \
|
||||||
--key-pass "pass:$key_password" $ORIG_NAME
|
--key-pass "pass:$key_password" $ORIG_NAME
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
rm -rf apk || true
|
rm -rf apk || true
|
||||||
rm ${ORIG_NAME}.idsig 2> /dev/null || true
|
rm ${ORIG_NAME}.idsig 2> /dev/null || true
|
||||||
|
done
|
||||||
Executable
+49
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function readlink() {
|
||||||
|
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
echo "Job repo is unset. Provide it via first argument like: $(readlink "$0")/download_libs.sh https://something.com/job/something/{master,stable}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
job_repo=$1
|
||||||
|
default_arch=$2
|
||||||
|
|
||||||
|
arches=("aarch64" "armv7a")
|
||||||
|
output_arches=("arm64-v8a" "armeabi-v7a")
|
||||||
|
|
||||||
|
if [ -z "${default_arch}" ]; then
|
||||||
|
# No custom architectures were specified, using defaults
|
||||||
|
echo "Libs for all supported architectures will be downloaded. To use single arch, pass one of the following values to the end of command: ${arches[*]}"
|
||||||
|
else
|
||||||
|
for ((i = 0 ; i < ${#output_arches[@]}; i++)); do
|
||||||
|
if [ "${arches[$i]}" == "$default_arch" ]; then
|
||||||
|
output_arches=("${output_arches[$i]}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
arches=("$default_arch")
|
||||||
|
fi
|
||||||
|
|
||||||
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
|
for ((i = 0 ; i < ${#arches[@]}; i++)); do
|
||||||
|
arch="${arches[$i]}"
|
||||||
|
output_arch="${output_arches[$i]}"
|
||||||
|
output_dir="$root_dir/apps/android/app/src/main/cpp/libs/$output_arch/"
|
||||||
|
|
||||||
|
mkdir -p "$output_dir" 2> /dev/null
|
||||||
|
|
||||||
|
curl --location -o libsupport.zip $job_repo/$arch-android:lib:support.x86_64-linux/latest/download/1 && \
|
||||||
|
unzip -o libsupport.zip && \
|
||||||
|
mv libsupport.so "$output_dir" && \
|
||||||
|
rm libsupport.zip
|
||||||
|
|
||||||
|
curl --location -o libsimplex.zip "$job_repo"/"$arch"-android:lib:simplex-chat.x86_64-linux/latest/download/1 && \
|
||||||
|
unzip -o libsimplex.zip && \
|
||||||
|
mv libsimplex.so "$output_dir" && \
|
||||||
|
rm libsimplex.zip
|
||||||
|
done
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
function readlink() {
|
|
||||||
echo $(cd $(dirname $1); pwd -P)
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -z ${1} ]; then
|
|
||||||
echo "Job repo is unset. Provide it via first argument like: $(readlink $0)/download_libs_aarch64.sh https://something.com/job/something/{master,stable}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
job_repo=$1
|
|
||||||
arch="aarch64"
|
|
||||||
#arch="x86_64"
|
|
||||||
output_arch="arm64-v8a"
|
|
||||||
#output_arch="x86_64"
|
|
||||||
|
|
||||||
root_dir="$(dirname $(dirname $(readlink $0)))"
|
|
||||||
output_dir="$root_dir/apps/android/app/src/main/cpp/libs/$output_arch/"
|
|
||||||
|
|
||||||
mkdir -p "$output_dir" 2> /dev/null
|
|
||||||
|
|
||||||
curl --location -o libsupport.zip $job_repo/$arch-android:lib:support.x86_64-linux/latest/download/1 && \
|
|
||||||
unzip -o libsupport.zip && \
|
|
||||||
mv libsupport.so "$output_dir" && \
|
|
||||||
rm libsupport.zip
|
|
||||||
|
|
||||||
curl --location -o libsimplex.zip $job_repo/$arch-android:lib:simplex-chat.x86_64-linux/latest/download/1 && \
|
|
||||||
unzip -o libsimplex.zip && \
|
|
||||||
mv libsimplex.so "$output_dir" && \
|
|
||||||
rm libsimplex.zip
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# libsimplex.so and libsupport.so binaries should be in ~/Downloads folder
|
# libsimplex.so and libsupport.so binaries should be in ~/Downloads folder in their directories based on archive name
|
||||||
mkdir -p ./apps/android/app/src/main/cpp/libs/arm64-v8a/
|
mkdir -p ./apps/android/app/src/main/cpp/libs/arm64-v8a/
|
||||||
rm ./apps/android/app/src/main/cpp/libs/arm64-v8a/*
|
rm ./apps/android/app/src/main/cpp/libs/arm64-v8a/*
|
||||||
cp ~/Downloads/libsupport.so ./apps/android/app/src/main/cpp/libs/arm64-v8a/
|
unzip -o ~/Downloads/pkg-aarch64-android-libsupport.zip -d ./apps/android/app/src/main/cpp/libs/arm64-v8a
|
||||||
cp ~/Downloads/pkg-aarch64-android-libsimplex/libsimplex.so ./apps/android/app/src/main/cpp/libs/arm64-v8a/
|
unzip -o ~/Downloads/pkg-aarch64-android-libsimplex.zip -d ./apps/android/app/src/main/cpp/libs/arm64-v8a/
|
||||||
cp ~/Downloads/pkg-aarch64-android-libsimplex/libcrypto.so ./apps/android/app/src/main/cpp/libs/arm64-v8a/
|
|
||||||
|
mkdir -p ./apps/android/app/src/main/cpp/libs/armeabi-v7a/
|
||||||
|
rm ./apps/android/app/src/main/cpp/libs/armeabi-v7a/*
|
||||||
|
unzip -o ~/Downloads/pkg-armv7a-android-libsupport.zip -d ./apps/android/app/src/main/cpp/libs/armeabi-v7a/
|
||||||
|
unzip -o ~/Downloads/pkg-armv7a-android-libsimplex.zip -d ./apps/android/app/src/main/cpp/libs/armeabi-v7a/
|
||||||
|
|||||||
Executable
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function readlink() {
|
||||||
|
echo "$(cd "$(dirname "$1")"; pwd -P)"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
echo "Job repo is unset. Provide it via first argument like: $(readlink "$0")/download_libs.sh https://something.com/job/something/{master,stable}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
job_repo=$1
|
||||||
|
default_arch=$2
|
||||||
|
|
||||||
|
arches=("aarch64" "x86_64")
|
||||||
|
output_arches=("aarch64" "x86_64")
|
||||||
|
|
||||||
|
if [ -z "${default_arch}" ]; then
|
||||||
|
# No custom architectures were specified, using defaults
|
||||||
|
echo "Libs for all supported architectures will be downloaded. To use single arch, pass one of the following values to the end of command: ${arches[*]}"
|
||||||
|
else
|
||||||
|
for ((i = 0 ; i < ${#output_arches[@]}; i++)); do
|
||||||
|
if [ "${arches[$i]}" == "$default_arch" ]; then
|
||||||
|
output_arches=("${output_arches[$i]}")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
arches=("$default_arch")
|
||||||
|
fi
|
||||||
|
|
||||||
|
root_dir="$(dirname "$(dirname "$(readlink "$0")")")"
|
||||||
|
for ((i = 0 ; i < ${#arches[@]}; i++)); do
|
||||||
|
arch="${arches[$i]}"
|
||||||
|
output_arch="${output_arches[$i]}"
|
||||||
|
output_dir="$HOME/Downloads"
|
||||||
|
|
||||||
|
curl --location -o "$output_dir"/pkg-ios-"$arch"-swift-json.zip "$job_repo"/"$arch"-darwin-ios:lib:simplex-chat."$arch"-darwin/latest/download/1 && \
|
||||||
|
unzip -o "$output_dir"/pkg-ios-"$output_arch"-swift-json.zip -d ~/Downloads/pkg-ios-"$output_arch"-swift-json
|
||||||
|
done
|
||||||
|
sh "$root_dir"/scripts/ios/prepare-x86_64.sh
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
function readlink() {
|
|
||||||
echo $(cd $(dirname $1); pwd -P)
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -z ${1} ]; then
|
|
||||||
echo "Job repo is unset. Provide it via first argument like: $(readlink $0)/download_libs_aarch64.sh https://something.com/job/something/{master,stable}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
job_repo=$1
|
|
||||||
|
|
||||||
root_dir="$(dirname $(dirname $(readlink $0)))"
|
|
||||||
|
|
||||||
curl --location -o ~/Downloads/pkg-ios-aarch64-swift-json.zip $job_repo/aarch64-darwin-ios:lib:simplex-chat.aarch64-darwin/latest/download/1 && \
|
|
||||||
unzip -o ~/Downloads/pkg-ios-aarch64-swift-json.zip -d ~/Downloads/pkg-ios-aarch64-swift-json
|
|
||||||
|
|
||||||
curl --location -o ~/Downloads/pkg-ios-x86_64-swift-json.zip $job_repo/x86_64-darwin-ios:lib:simplex-chat.x86_64-darwin/latest/download/1 && \
|
|
||||||
unzip -o ~/Downloads/pkg-ios-x86_64-swift-json.zip -d ~/Downloads/pkg-ios-x86_64-swift-json
|
|
||||||
|
|
||||||
sh $root_dir/scripts/ios/prepare-x86_64.sh
|
|
||||||
Reference in New Issue
Block a user