mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-29 07:32:35 +00:00
Merge branch 'master' into ep/smp-server-pages
This commit is contained in:
93 files changed
+3422
-1020
No files matched your search
@@ -102,6 +102,7 @@ build() {
|
||||
sed -i.bak 's/jniLibs.useLegacyPackaging =.*/jniLibs.useLegacyPackaging = true/' "$folder/apps/multiplatform/android/build.gradle.kts"
|
||||
sed -i.bak '/android {/a lint {abortOnError = false}' "$folder/apps/multiplatform/android/build.gradle.kts"
|
||||
sed -i.bak '/tasks/Q' "$folder/apps/multiplatform/android/build.gradle.kts"
|
||||
sed -i.bak "s/android.version_code=.*/android.version_code=${vercode}/" "$folder/apps/multiplatform/gradle.properties"
|
||||
|
||||
for arch in $arches; do
|
||||
if [ "$arch" = "armv7a" ]; then
|
||||
@@ -138,10 +139,15 @@ build() {
|
||||
mkdir -p "$android_tmp_folder"
|
||||
unzip -oqd "$android_tmp_folder" "$android_apk_output"
|
||||
|
||||
# Determenistic build
|
||||
find "$android_tmp_folder" -type f -exec chmod 644 {} +
|
||||
find "$android_tmp_folder" -type d -exec chmod 755 {} +
|
||||
find "$android_tmp_folder" -exec touch -h -d '@1764547200' {} +
|
||||
|
||||
(
|
||||
cd "$android_tmp_folder" && \
|
||||
zip -rq5 "$tmp/$android_apk_output_final" . && \
|
||||
zip -rq0 "$tmp/$android_apk_output_final" resources.arsc res
|
||||
find . -type f -print0 | sort -z | xargs -0 zip -X -rq5 "$tmp/$android_apk_output_final" && \
|
||||
find res resources.arsc -type f -print0 | sort -z | xargs -0 zip -X -rq0 "$tmp/$android_apk_output_final"
|
||||
)
|
||||
|
||||
zipalign -p -f 4 "$tmp/$android_apk_output_final" "$PWD/$android_apk_output_final"
|
||||
@@ -164,8 +170,10 @@ pre() {
|
||||
done
|
||||
|
||||
shift $(( $OPTIND - 1 ))
|
||||
|
||||
commit="${1:-HEAD}"
|
||||
|
||||
vercode="${1}"
|
||||
|
||||
commit="${2:-HEAD}"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
@@ -29,20 +29,43 @@ for ORIG_NAME in "${ORIG_NAMES[@]}"; do
|
||||
ORIG_NAME_COPY=$ORIG_NAME-copy
|
||||
mv "$ORIG_NAME" "$ORIG_NAME_COPY"
|
||||
|
||||
(cd apk && zip -r -q -"$level" ../"$ORIG_NAME" .)
|
||||
# Shouldn't be compressed because of Android requirement
|
||||
(cd apk && zip -r -q -0 ../"$ORIG_NAME" resources.arsc)
|
||||
# Determenistic build
|
||||
find apk -type f -exec chmod 644 {} +
|
||||
find apk -type d -exec chmod 755 {} +
|
||||
find apk -exec touch -h -d '2025-12-01T00:00:00' {} +
|
||||
|
||||
(
|
||||
cd apk
|
||||
find . -not -path './res/*' -not -name 'resources.arsc' -type f -print0 | sort -z | xargs -0 zip -X -r -q -"$level" ../"$ORIG_NAME"
|
||||
)
|
||||
|
||||
if [ $case_insensitive -eq 1 ]; then
|
||||
# For case-insensitive file systems
|
||||
list_of_files=$(unzip -l "$ORIG_NAME_COPY" | grep res/ | sed -e "s|.*res/|res/|")
|
||||
for file in $list_of_files; do unzip -o -q -d apk "$ORIG_NAME_COPY" "$file" && (cd apk && zip -r -q -0 ../"$ORIG_NAME" "$file"); done
|
||||
list_of_files=$(unzip -l "$ORIG_NAME_COPY" | grep res/ | sed -e "s|.*res/|res/|" | sort)
|
||||
for file in $list_of_files; do
|
||||
unzip -o -q -d apk "$ORIG_NAME_COPY" "$file"
|
||||
(
|
||||
cd apk
|
||||
chmod 644 "$file"
|
||||
touch -h -d '2025-12-01T00:00:00' "$file"
|
||||
zip -X -r -q -0 ../"$ORIG_NAME" "$file"
|
||||
)
|
||||
done
|
||||
else
|
||||
# This method is not working correctly on case-insensitive file systems since Android AAPT produce the same names of files
|
||||
# but with different case like xX.png, Xx.png, xx.png, etc
|
||||
(cd apk && zip -r -q -0 ../"$ORIG_NAME" res)
|
||||
(
|
||||
cd apk
|
||||
find res -type f -print0 | sort -z | xargs -0 zip -X -r -q -0 ../"$ORIG_NAME"
|
||||
)
|
||||
fi
|
||||
|
||||
# Shouldn't be compressed because of Android requirement
|
||||
(
|
||||
cd apk
|
||||
find resources.arsc -type f -print0 | sort -z | xargs -0 zip -X -r -q -0 ../"$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)
|
||||
|
||||
@@ -61,4 +84,4 @@ for ORIG_NAME in "${ORIG_NAMES[@]}"; do
|
||||
rm "$ORIG_NAME_COPY" 2> /dev/null || true
|
||||
rm -rf apk || true
|
||||
rm "${ORIG_NAME}".idsig 2> /dev/null || true
|
||||
done
|
||||
done
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
export SOURCE_DATE_EPOCH=1764547200
|
||||
|
||||
CLI_VERSION="$1"
|
||||
CLI_PATH_TO_BIN="${2:-/out/simplex-chat}"
|
||||
BUILD_FOLDER="${3:-/out/deb-build}"
|
||||
|
||||
size=$(stat -c '%s' "$CLI_PATH_TO_BIN" | awk '{printf "%.0f\n", ($1+1023)/1024}')
|
||||
arch=$(case "$(uname -m)" in x86_64) printf "amd64" ;; aarch64) printf "arm64" ;; *) printf "unknown" ;; esac)
|
||||
package='simplex-chat'
|
||||
|
||||
mkdir "$BUILD_FOLDER"
|
||||
cd "$BUILD_FOLDER"
|
||||
|
||||
mkdir -p ./${package}/DEBIAN
|
||||
mkdir -p ./${package}/usr/bin
|
||||
cat > ./${package}/DEBIAN/control << EOF
|
||||
Package: ${package}
|
||||
Version: ${CLI_VERSION}
|
||||
Section: Messenger
|
||||
Priority: optional
|
||||
Architecture: ${arch}
|
||||
Maintainer: SimpleX Chat <chat@simplex.chat>
|
||||
Description: SimpleX - the first messaging platform that has no user identifiers of any kind - 100% private by design! (CLI)
|
||||
Installed-Size: ${size}
|
||||
EOF
|
||||
|
||||
cp "$CLI_PATH_TO_BIN" ./${package}/usr/bin/simplex-chat
|
||||
chmod +x ./${package}/usr/bin/simplex-chat
|
||||
|
||||
find ./${package} -exec touch -d "@${SOURCE_DATE_EPOCH}" {} +
|
||||
|
||||
dpkg-deb --build --root-owner-group --uniform-compression ./${package}
|
||||
|
||||
strip-nondeterminism "./${package}.deb"
|
||||
@@ -38,6 +38,27 @@
|
||||
</description>
|
||||
|
||||
<releases>
|
||||
<release version="6.4.8" date="2025-12-11">
|
||||
<url type="details">https://simplex.chat/blog/20250729-simplex-chat-v6-4-1-welcome-contacts-protect-groups-app-security.html</url>
|
||||
<description>
|
||||
<p>New in v6.4.8:</p>
|
||||
<ul>
|
||||
<li>fix stuck message reception and other events after passphrase change (e.g., during desktop app initial start)</li>
|
||||
</ul>
|
||||
<p>New in v6.4-6.4.7:</p>
|
||||
<ul>
|
||||
<li>new UX to connect.</li>
|
||||
<li>review new group members.</li>
|
||||
<li>chat with group admins.</li>
|
||||
<li>new UI languages: Catalan, Indonesian, Romanian and Vietnamese.</li>
|
||||
<li>Linux app builds for aarch64 CPUs</li>
|
||||
<li>UI support for bot commands.</li>
|
||||
<li>support markdown hyperlinks, such as [click here](https://example.com).</li>
|
||||
<li>option to remove tracking parameters from the links.</li>
|
||||
<li>better information about network errors.</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="6.4.7" date="2025-11-03">
|
||||
<url type="details">https://simplex.chat/blog/20250729-simplex-chat-v6-4-1-welcome-contacts-protect-groups-app-security.html</url>
|
||||
<description>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"https://github.com/simplex-chat/simplexmq.git"."09b6fad675a8661148f4c76654de3c39442b4f71" = "12jlrhih23nwpxlhfz7bbzz8srg39jdghh4gg4dxnxr4v4lxk7b8";
|
||||
"https://github.com/simplex-chat/simplexmq.git"."bafdbc1dec778021eacbf621f1467ca78287d2a4" = "09nkjrwb3p822m01p3lnmmfh2jdfyf0jl9hvryzkpl12xvlsl61c";
|
||||
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
|
||||
"https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d";
|
||||
"https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl";
|
||||
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
SIMPLEX_KEY='3C:52:C4:FD:3C:AD:1C:07:C9:B0:0A:70:80:E3:58:FA:B9:FE:FC:B8:AF:5A:EC:14:77:65:F1:6D:0F:21:AD:85'
|
||||
|
||||
REPO_NAME="simplex-chat"
|
||||
REPO="https://github.com/simplex-chat/${REPO_NAME}"
|
||||
|
||||
IMAGE_NAME='sx-local-android'
|
||||
CONTAINER_NAME='sx-builder-android'
|
||||
DOCKER_PATH_PROJECT='/project'
|
||||
DOCKER_PATH_VERIFY='/verify'
|
||||
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
SIMPLEX_REPO='simplex-chat/simplex-chat'
|
||||
CMDS="curl git docker"
|
||||
|
||||
INIT_DIR="$PWD"
|
||||
TEMPDIR="$(mktemp -d)"
|
||||
|
||||
ARCHES="${ARCHES:-aarch64 armv7a}"
|
||||
|
||||
COLOR_CYAN="\033[36m"
|
||||
COLOR_RESET="\033[0m"
|
||||
|
||||
SUFFIX_BUILT='built'
|
||||
SUFFIX_DOWNLOADED='downloaded'
|
||||
SUFFIX_BUILT_WITH_SIGNATURE='built-with-downloaded-signature'
|
||||
|
||||
cleanup() {
|
||||
rm -rf -- "${TEMPDIR}"
|
||||
docker rm --force "${CONTAINER_NAME}" 2>/dev/null || :
|
||||
docker image rm "${IMAGE_NAME}" 2>/dev/null || :
|
||||
}
|
||||
trap 'cleanup' EXIT INT
|
||||
|
||||
check() {
|
||||
commands="$1"
|
||||
|
||||
set +u
|
||||
|
||||
for i in $commands; do
|
||||
if ! command -v "$i" > /dev/null 2>&1; then
|
||||
commands_failed="$i $commands_failed"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$commands_failed" ]; then
|
||||
commands_failed=${commands_failed% *}
|
||||
printf "%s is not found in your \$PATH. Please install them and re-run the script.\n" "$commands_failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -u
|
||||
}
|
||||
|
||||
download_apk() {
|
||||
tag="$1"
|
||||
filename="$2"
|
||||
file_out="$3"
|
||||
|
||||
curl -L "${REPO}/releases/download/${tag}/${filename}" -o "$file_out"
|
||||
}
|
||||
|
||||
setup_git() {
|
||||
workdir="$1"
|
||||
name="$2"
|
||||
|
||||
git -C "$workdir" clone "${REPO}.git" "$name"
|
||||
}
|
||||
|
||||
checkout_git() {
|
||||
git_dir="$1"
|
||||
tag="$2"
|
||||
|
||||
git -C "$git_dir" reset --hard
|
||||
git -C "$git_dir" clean -dfx
|
||||
git -C "$git_dir" checkout "$tag"
|
||||
}
|
||||
|
||||
check_apk() {
|
||||
apk_name="$1"
|
||||
expected="$2"
|
||||
|
||||
actual=$(docker exec "${CONTAINER_NAME}" apksigner verify --print-certs "${DOCKER_PATH_VERIFY}/${apk_name}" | grep 'SHA-256' | awk '{print $NF}' | fold -w2 | paste -sd: | tr '[:lower:]' '[:upper:]')
|
||||
|
||||
if [ "$expected" = "$actual" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
verify_apk() {
|
||||
apk_name="$1"
|
||||
|
||||
# https://github.com/obfusk/apksigcopier?tab=readme-ov-file#what-about-signatures-made-by-apksigner-from-build-tools--3500-rc1
|
||||
docker exec "${CONTAINER_NAME}" repro-apk zipalign --page-size 16 --pad-like-apksigner --replace "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT}" \
|
||||
"${DOCKER_PATH_VERIFY}/${apk_name}.aligned"
|
||||
docker exec "${CONTAINER_NAME}" mv "${DOCKER_PATH_VERIFY}/${apk_name}.aligned" \
|
||||
"${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT}"
|
||||
|
||||
docker exec "${CONTAINER_NAME}" apksigcopier copy "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_DOWNLOADED}" \
|
||||
"${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT}" \
|
||||
"${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT_WITH_SIGNATURE}"
|
||||
|
||||
downloaded_apk_hash=$(docker exec "${CONTAINER_NAME}" sha256sum "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_DOWNLOADED}" | awk '{print $1}')
|
||||
built_apk_hash=$(docker exec "${CONTAINER_NAME}" sha256sum "${DOCKER_PATH_VERIFY}/${apk_name}.${SUFFIX_BUILT_WITH_SIGNATURE}" | awk '{print $1}')
|
||||
|
||||
if [ "$downloaded_apk_hash" = "$built_apk_hash" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
print_vercode() {
|
||||
build_dir="$1"
|
||||
awk -F'=' '/android.version_code=/ {print $2}' "${build_dir}/apps/multiplatform/gradle.properties"
|
||||
}
|
||||
|
||||
setup_container() {
|
||||
dir_git="$1"
|
||||
dir_apk="$2"
|
||||
|
||||
docker build \
|
||||
--no-cache \
|
||||
-f "${dir_git}/Dockerfile.build" \
|
||||
-t "${IMAGE_NAME}" \
|
||||
--build-arg=USER_UID="$(id -u)" \
|
||||
--build-arg=USER_GID="$(id -g)" \
|
||||
.
|
||||
|
||||
# Run container in background
|
||||
docker run -t -d \
|
||||
--name "${CONTAINER_NAME}" \
|
||||
--device /dev/fuse \
|
||||
--cap-add SYS_ADMIN \
|
||||
--security-opt apparmor:unconfined \
|
||||
--security-opt seccomp:unconfined \
|
||||
-v "${dir_git}:${DOCKER_PATH_PROJECT}" \
|
||||
-v "${dir_apk}:${DOCKER_PATH_VERIFY}" \
|
||||
"${IMAGE_NAME}"
|
||||
}
|
||||
|
||||
build_apk() {
|
||||
arch="$1"
|
||||
vercode="$2"
|
||||
|
||||
apk_out="simplex-${arch}.apk.${SUFFIX_BUILT}"
|
||||
|
||||
# Gradle setup
|
||||
docker exec -i "${CONTAINER_NAME}" sh << EOF
|
||||
cd $DOCKER_PATH_PROJECT/apps/multiplatform
|
||||
./gradlew
|
||||
EOF
|
||||
|
||||
docker exec -i "${CONTAINER_NAME}" sh << EOF
|
||||
GRADLE_BIN=\$(find \$HOME/.gradle/wrapper/dists -name "gradle" -type f -executable 2>/dev/null | head -1)
|
||||
GRADLE_DIR=\$(dirname "\$GRADLE_BIN")
|
||||
export PATH="\$GRADLE_DIR:\$PATH"
|
||||
|
||||
ARCHES="$arch" ./scripts/android/build-android.sh -gs "$vercode" || ARCHES="$arch" ./scripts/android/build-android.sh -gs "$vercode"
|
||||
|
||||
APK_FILE=\$(find . -maxdepth 1 -type f -name '*.apk')
|
||||
|
||||
mv "\$APK_FILE" $DOCKER_PATH_VERIFY/$apk_out
|
||||
EOF
|
||||
}
|
||||
|
||||
main() {
|
||||
tag="$1"
|
||||
|
||||
build_directory="${TEMPDIR}/${REPO_NAME}"
|
||||
final_directory="$INIT_DIR/${tag}-${REPO_NAME}"
|
||||
apk_directory="${final_directory}/android"
|
||||
|
||||
printf 'This script will:
|
||||
1) build docker container.
|
||||
2) download APK from GitHub and validate signatures.
|
||||
3) build core library with nix (12-24 hours).
|
||||
4) build APK and compare with downloaded one
|
||||
|
||||
Continue?'
|
||||
|
||||
read _
|
||||
|
||||
check "$CMDS"
|
||||
|
||||
mkdir -p "${apk_directory}"
|
||||
|
||||
# Setup initial git for Dockerfile.build
|
||||
setup_git "$TEMPDIR" "$REPO_NAME"
|
||||
checkout_git "$build_directory" "$tag"
|
||||
|
||||
printf "${COLOR_CYAN}Building Docker container...${COLOR_RESET}\n"
|
||||
setup_container "$build_directory" "$apk_directory"
|
||||
|
||||
# Check phase
|
||||
for arch in $ARCHES; do
|
||||
filename="simplex-${arch}.apk"
|
||||
|
||||
download_apk "$tag" "$filename" "${apk_directory}/${filename}.${SUFFIX_DOWNLOADED}"
|
||||
|
||||
if check_apk "${filename}.${SUFFIX_DOWNLOADED}" "$SIMPLEX_KEY"; then
|
||||
printf "${COLOR_CYAN}APK for %s is signed by valid key.${COLOR_RESET}\n" "$arch"
|
||||
else
|
||||
printf "${COLOR_CYAN}Signature of APK for %s is invalid., aborting the script.${COLOR_RESET}\n" "$arch"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Build phase
|
||||
for arch in $ARCHES; do
|
||||
case "$arch" in
|
||||
armv7a)
|
||||
build_tag="${tag}-armv7a"
|
||||
;;
|
||||
aarch64)
|
||||
build_tag="${tag}"
|
||||
;;
|
||||
*)
|
||||
printf "${COLOR_CYAN}Unknown architecture: %s! Skipping the build...${COLOR_RESET}\n" "$arch"
|
||||
continue
|
||||
esac
|
||||
|
||||
# Setup the code
|
||||
checkout_git "$build_directory" "$build_tag"
|
||||
vercode=$(print_vercode "$build_directory")
|
||||
|
||||
printf "${COLOR_CYAN}Building APK for for %s...${COLOR_RESET}\n" "$arch"
|
||||
build_apk "$arch" "$vercode"
|
||||
done
|
||||
|
||||
# Verification phase
|
||||
for arch in $ARCHES; do
|
||||
filename="simplex-${arch}.apk"
|
||||
|
||||
if ! verify_apk "$filename"; then
|
||||
printf "${COLOR_CYAN}Failed to verify %s! Aborting.\n${COLOR_RESET}" "$filename"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
printf "${COLOR_CYAN}%s is reproducible.${COLOR_RESET}\n" "$tag"
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -20,115 +20,135 @@ package direct-sqlcipher
|
||||
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
version=${TAG#v}
|
||||
version=${version%-*}
|
||||
|
||||
cleanup() {
|
||||
docker exec -t "${container_name}" sh -c 'rm -rf ./dist-newstyle ./apps' 2>/dev/null || :
|
||||
rm -rf -- "${tempdir}"
|
||||
docker rm --force "${container_name}" 2>/dev/null || :
|
||||
docker image rm "${image_name}" 2>/dev/null || :
|
||||
cd "${init_dir}"
|
||||
docker exec -t "${container_name}" sh -c 'rm -rf ./dist-newstyle ./apps' 2>/dev/null || :
|
||||
rm -rf -- "${tempdir}"
|
||||
docker rm --force "${container_name}" 2>/dev/null || :
|
||||
docker image rm "${image_name}" 2>/dev/null || :
|
||||
cd "${init_dir}"
|
||||
}
|
||||
trap 'cleanup' EXIT INT
|
||||
|
||||
mkdir -p "${init_dir}/${TAG}-${repo_name}/from-source" "${init_dir}/${TAG}-${repo_name}/prebuilt"
|
||||
|
||||
git -C "${tempdir}" clone "${repo}.git" &&\
|
||||
cd "${tempdir}/${repo_name}" &&\
|
||||
git checkout "${TAG}"
|
||||
cd "${tempdir}/${repo_name}" &&\
|
||||
git checkout "${TAG}"
|
||||
|
||||
for os in '22.04' '24.04'; do
|
||||
os_url="$(printf '%s' "${os}" | tr '.' '_')"
|
||||
os_url="$(printf '%s' "${os}" | tr '.' '_')"
|
||||
|
||||
cli_name="simplex-chat-ubuntu-${os_url}-x86_64"
|
||||
deb_name="simplex-desktop-ubuntu-${os_url}-x86_64.deb"
|
||||
appimage_name="simplex-desktop-x86_64.AppImage"
|
||||
cli_name="simplex-chat-ubuntu-${os_url}-x86_64"
|
||||
deb_name="simplex-desktop-ubuntu-${os_url}-x86_64.deb"
|
||||
appimage_name="simplex-desktop-x86_64.AppImage"
|
||||
|
||||
# Build image
|
||||
docker build \
|
||||
--no-cache \
|
||||
--build-arg TAG="${os}" \
|
||||
--build-arg GHC="${ghc}" \
|
||||
-f "${tempdir}/${repo_name}/Dockerfile.build" \
|
||||
-t "${image_name}" \
|
||||
.
|
||||
# Build image
|
||||
docker build \
|
||||
--no-cache \
|
||||
--build-arg TAG="${os}" \
|
||||
--build-arg GHC="${ghc}" \
|
||||
--build-arg=USER_UID="$(id -u)" \
|
||||
--build-arg=USER_GID="$(id -g)" \
|
||||
-f "${tempdir}/${repo_name}/Dockerfile.build" \
|
||||
-t "${image_name}" \
|
||||
.
|
||||
|
||||
printf '%s' "${cabal_local}" > "${tempdir}/${repo_name}/cabal.project.local"
|
||||
printf '%s' "${cabal_local}" > "${tempdir}/${repo_name}/cabal.project.local"
|
||||
|
||||
# Run container in background
|
||||
docker run -t -d \
|
||||
--name "${container_name}" \
|
||||
--device /dev/fuse \
|
||||
--cap-add SYS_ADMIN \
|
||||
--security-opt apparmor:unconfined \
|
||||
-v "${tempdir}/${repo_name}:/project" \
|
||||
"${image_name}"
|
||||
# Run container in background
|
||||
docker run -t -d \
|
||||
--name "${container_name}" \
|
||||
--device /dev/fuse \
|
||||
--cap-add SYS_ADMIN \
|
||||
--security-opt apparmor:unconfined \
|
||||
-v "${tempdir}/${repo_name}:/project" \
|
||||
"${image_name}"
|
||||
|
||||
# Consistent permissions
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c 'find /project -type d -exec chmod 755 {} \; ; find /project -type f -perm /111 -exec chmod 755 {} \; ; find /project -type f ! -perm /111 -exec chmod 644 {} \;'
|
||||
# Consistent permissions
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c 'find /project -type d -exec chmod 755 {} \; ; find /project -type f -perm /111 -exec chmod 755 {} \; ; find /project -type f ! -perm /111 -exec chmod 644 {} \;'
|
||||
|
||||
# CLI
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c 'cabal clean && cabal update && cabal build -j && mkdir -p /out && for i in simplex-chat; do bin=$(find /project/dist-newstyle -name "$i" -type f -executable) && chmod +x "$bin" && mv "$bin" /out/; done && strip /out/simplex-chat'
|
||||
# CLI
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c 'cabal clean && cabal update && cabal build -j && mkdir -p /out && for i in simplex-chat; do bin=$(find /project/dist-newstyle -name "$i" -type f -executable) && chmod +x "$bin" && mv "$bin" /out/; done && strip /out/simplex-chat'
|
||||
|
||||
# Copy CLI
|
||||
docker cp \
|
||||
"${container_name}":/out/simplex-chat \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${cli_name}"
|
||||
# Copy CLI
|
||||
docker cp \
|
||||
"${container_name}":/out/simplex-chat \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${cli_name}"
|
||||
|
||||
# Download prebuilt CLI binary
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${cli_name}"
|
||||
# Download prebuilt CLI binary
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${cli_name}"
|
||||
|
||||
# Desktop: deb
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c './scripts/desktop/make-deb-linux.sh'
|
||||
# CLI: deb
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c "./scripts/desktop/build-cli-deb.sh ${version}"
|
||||
|
||||
# Copy deb
|
||||
docker cp \
|
||||
"${container_name}":/project/apps/multiplatform/release/main/deb/simplex_x86_64.deb \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${deb_name}"
|
||||
# Copy CLI: deb
|
||||
docker cp \
|
||||
"${container_name}":/out/deb-build/simplex-chat.deb \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${cli_name}.deb"
|
||||
|
||||
# Download prebuilt deb package
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${deb_name}"
|
||||
# Download prebuilt CLI: deb binary
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${cli_name}.deb"
|
||||
|
||||
# Desktop: appimage. Build only on 22.04
|
||||
case "$os" in
|
||||
22.04)
|
||||
# Appimage
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c './scripts/desktop/make-appimage-linux.sh && mv ./apps/multiplatform/release/main/*imple*.AppImage ./apps/multiplatform/release/main/simplex.appimage'
|
||||
# Desktop: deb
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c './scripts/desktop/make-deb-linux.sh'
|
||||
|
||||
# Copy appimage
|
||||
docker cp \
|
||||
"${container_name}":/project/apps/multiplatform/release/main/simplex.appimage \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${appimage_name}"
|
||||
# Copy deb
|
||||
docker cp \
|
||||
"${container_name}":/project/apps/multiplatform/release/main/deb/simplex_x86_64.deb \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${deb_name}"
|
||||
|
||||
# Download prebuilt appimage binary
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${appimage_name}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Important! Remove dist-newstyle for the next interation
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c 'rm -rf ./dist-newstyle ./apps/multiplatform'
|
||||
# Download prebuilt deb package
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${deb_name}"
|
||||
|
||||
# Also restore git to previous state
|
||||
git reset --hard && git clean -dfx
|
||||
# Desktop: appimage. Build only on 22.04
|
||||
case "$os" in
|
||||
22.04)
|
||||
# Appimage
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c './scripts/desktop/make-appimage-linux.sh && mv ./apps/multiplatform/release/main/*imple*.AppImage ./apps/multiplatform/release/main/simplex.appimage'
|
||||
|
||||
# Stop containers, delete images
|
||||
docker stop "${container_name}"
|
||||
docker rm --force "${container_name}"
|
||||
docker image rm "${image_name}"
|
||||
# Copy appimage
|
||||
docker cp \
|
||||
"${container_name}":/project/apps/multiplatform/release/main/simplex.appimage \
|
||||
"${init_dir}/${TAG}-${repo_name}/from-source/${appimage_name}"
|
||||
|
||||
# Download prebuilt appimage binary
|
||||
curl -L \
|
||||
--output-dir "${init_dir}/${TAG}-${repo_name}/prebuilt/" \
|
||||
-O "${repo}/releases/download/${TAG}/${appimage_name}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Important! Remove dist-newstyle for the next interation
|
||||
docker exec \
|
||||
-t "${container_name}" \
|
||||
sh -c 'rm -rf ./dist-newstyle ./apps/multiplatform'
|
||||
|
||||
# Also restore git to previous state
|
||||
git reset --hard && git clean -dfx
|
||||
|
||||
# Stop containers, delete images
|
||||
docker stop "${container_name}"
|
||||
docker rm --force "${container_name}"
|
||||
docker image rm "${image_name}"
|
||||
done
|
||||
|
||||
# Cleanup
|
||||
@@ -145,27 +165,27 @@ bad=0
|
||||
|
||||
# Check hashes for all binaries
|
||||
for file in "${path_bin}"/from-source/*; do
|
||||
# Extract binary name
|
||||
app="$(basename ${file})"
|
||||
# Extract binary name
|
||||
app="$(basename ${file})"
|
||||
|
||||
# Compute hash for compiled binary
|
||||
compiled=$(sha256sum "${path_bin}/from-source/${app}" | awk '{print $1}')
|
||||
# Compute hash for prebuilt binary
|
||||
prebuilt=$(sha256sum "${path_bin}/prebuilt/${app}" | awk '{print $1}')
|
||||
# Compute hash for compiled binary
|
||||
compiled=$(sha256sum "${path_bin}/from-source/${app}" | awk '{print $1}')
|
||||
# Compute hash for prebuilt binary
|
||||
prebuilt=$(sha256sum "${path_bin}/prebuilt/${app}" | awk '{print $1}')
|
||||
|
||||
# Compare
|
||||
if [ "${compiled}" != "${prebuilt}" ]; then
|
||||
# If hashes doesn't match, set bad...
|
||||
bad=1
|
||||
# Compare
|
||||
if [ "${compiled}" != "${prebuilt}" ]; then
|
||||
# If hashes doesn't match, set bad...
|
||||
bad=1
|
||||
|
||||
# ... and print affected binary
|
||||
printf "%s - sha256sum hash doesn't match\n" "${app}"
|
||||
fi
|
||||
# ... and print affected binary
|
||||
printf "%s - sha256sum hash doesn't match\n" "${app}"
|
||||
fi
|
||||
done
|
||||
|
||||
# If everything is still okay, compute checksums file
|
||||
if [ "${bad}" = 0 ]; then
|
||||
sha256sum "${path_bin}"/from-source/* | sed -e "s|$PWD/||g" -e 's|from-source/||g' -e "s|-$repo_name||g" > "${path_bin}/_sha256sums"
|
||||
sha256sum "${path_bin}"/from-source/* | sed -e "s|$PWD/||g" -e 's|from-source/||g' -e "s|-$repo_name||g" > "${path_bin}/_sha256sums"
|
||||
|
||||
printf 'Checksums computed - %s\n' "${path_bin}/_sha256sums"
|
||||
printf 'Checksums computed - %s\n' "${path_bin}/_sha256sums"
|
||||
fi
|
||||
Reference in new issue
Block a user