-
-
Notifications
You must be signed in to change notification settings - Fork 494
fix: fdroid build #1139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix: fdroid build #1139
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0c0e3b6
fix: fdroid build reproducibility
lollipopkit fc0265d
chore
lollipopkit 88dd9ef
Merge branch 'main' of github.com:lollipopkit/flutter_server_box into…
lollipopkit f931530
new: check android build
lollipopkit eae0f75
fix
lollipopkit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" | ||
| APK_DIR="${APK_DIR:-$REPO_ROOT/build/app/outputs/flutter-apk}" | ||
| APP_NAME="${APP_NAME:-ServerBox}" | ||
|
|
||
| require_cmd() { | ||
| local name="$1" | ||
| if ! command -v "$name" >/dev/null 2>&1; then | ||
| echo "command not found: $name" >&2 | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| require_cmd find | ||
| require_cmd readelf | ||
| require_cmd unzip | ||
|
|
||
| shopt -s nullglob | ||
|
|
||
| tmp_dir="$(mktemp -d)" | ||
| trap 'rm -rf "$tmp_dir"' EXIT | ||
|
|
||
| failures=() | ||
| apks=() | ||
| patterns=( | ||
| "${APP_NAME}_*_arm64.apk" | ||
| "${APP_NAME}_*_arm.apk" | ||
| "${APP_NAME}_*_amd64.apk" | ||
| ) | ||
|
lollipopkit marked this conversation as resolved.
|
||
|
|
||
| for pattern in "${patterns[@]}"; do | ||
| matches=("$APK_DIR"/$pattern) | ||
| if [[ ${#matches[@]} -ne 1 ]]; then | ||
| echo "expected exactly 1 APK for pattern: $pattern" >&2 | ||
| echo "found ${#matches[@]} matches" >&2 | ||
| echo "APK_DIR: $APK_DIR" >&2 | ||
| if [[ ${#matches[@]} -gt 0 ]]; then | ||
| printf ' %s\n' "${matches[@]}" >&2 | ||
| else | ||
| ls -la "$APK_DIR" || true | ||
| fi | ||
| exit 1 | ||
| fi | ||
| apks+=("${matches[0]}") | ||
| done | ||
|
|
||
| for apk in "${apks[@]}"; do | ||
| apk_name="$(basename "$apk")" | ||
| extract_dir="$tmp_dir/$apk_name" | ||
| mkdir -p "$extract_dir" | ||
| unzip -qq "$apk" "lib/*/*.so" -d "$extract_dir" | ||
|
|
||
| while IFS= read -r so_file; do | ||
| if readelf -n "$so_file" | grep -q 'Build ID'; then | ||
| failures+=("$apk_name:${so_file#$extract_dir/}") | ||
| fi | ||
| done < <(find "$extract_dir" -type f -name '*.so' | sort) | ||
| done | ||
|
|
||
| if [[ ${#failures[@]} -ne 0 ]]; then | ||
| echo 'native libraries still contain ELF build-id notes:' >&2 | ||
| printf ' %s\n' "${failures[@]}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo 'F-Droid native library verification passed.' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 LDFLAGS may not propagate to all native libraries in the APK
The
LDFLAGS: -Wl,--build-id=noneenv var is set at the step level for the Build step (.github/workflows/release.yml:40). While CMake does initializeCMAKE_SHARED_LINKER_FLAGSfrom theLDFLAGSenvironment variable on first configure (which applies to plugin native code compiled during the build), the Flutter engine'slibflutter.sois a pre-built binary downloaded by the Flutter SDK — it is not compiled during the build and thereforeLDFLAGScannot affect it. If the pre-builtlibflutter.soshipped by the Flutter SDK contains a Build ID note, the verification script atscripts/release/verify-fdroid-native-libs.sh:47will always detect it and fail the CI. The verification script is the correct safety net here, but it's worth confirming that either (a) thefl_buildpackage has additional post-processing to strip build IDs from pre-built binaries, or (b) the Flutter SDK's pre-built.sofiles already ship without Build IDs.Was this helpful? React with 👍 or 👎 to provide feedback.