-
Notifications
You must be signed in to change notification settings - Fork 352
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
Fix wireguard-go-rs
build for different Android targets
#6701
Conversation
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.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved
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.
Reviewed all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @MarkusPettersson98)
wireguard-go-rs/build.rs
line 166 at r1 (raw file):
/// Compile libwg as a dynamic library for android and place it in `OUT_DIR`. // NOTE: We use dynamic linking as Go cannot produce static binaries specifically for Android. fn build_android_dynamic_lib(daita: bool) -> anyhow::Result<()> {
Does it make sense to toggle daita? I don't think we adapt the UI to this feature flag, so it might be problems if we generate a binary without the daita support while UI thinks we do have it?
wireguard-go-rs/build.rs
line 226 at r1 (raw file):
}; // Create the directory with RWX permissions for all users so that the build server can clean
Do we need RWX
, would RW-
be enough?
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Rawa)
wireguard-go-rs/build.rs
line 166 at r1 (raw file):
Previously, Rawa (David Göransson) wrote…
Does it make sense to toggle daita? I don't think we adapt the UI to this feature flag, so it might be problems if we generate a binary without the daita support while UI thinks we do have it?
I mostly did it like this to be in line with how libwg
is built for linux and macOS (see build_static_lib
). Since adding support for DAITA is not part of this PR, the daita: bool
argument is just preparatory work for #6684. Either the argument is simply set to true
in that PR, or we remove this argument and make the subsequent changes #6684 such that we always assume that libwg
should be compiled with DAITA 😊
wireguard-go-rs/build.rs
line 226 at r1 (raw file):
Previously, Rawa (David Göransson) wrote…
Do we need
RWX
, wouldRW-
be enough?
RW-
ought to be enough, but I would prefer if we didn't need to muck with permissions at all 🤔
238740c
to
0ee97ca
Compare
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.
Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @Pururun)
0ee97ca
to
9dfc044
Compare
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.
Reviewed 2 of 3 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)
wireguard-go-rs/build.rs
line 59 at r2 (raw file):
"armv7-linux-androideabi" => Ok(Armv7), "i686-linux-android" => Ok(I686), _ => bail!("{input} is not a support android target!"),
typo: -> supported
Code quote:
support
05a4750
9dfc044
to
05a4750
Compare
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.
Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @albin-mullvad)
wireguard-go-rs/build.rs
line 59 at r2 (raw file):
Previously, albin-mullvad wrote…
typo: ->
supported
Done
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MarkusPettersson98)
wireguard-go-rs/build.rs
line 221 at r3 (raw file):
/// Note: This function will create the parent directory/directories to `output` if necessary. fn android_move_binary(binary: &Path, output: &Path) -> anyhow::Result<()> { // Create the directory with RWX permissions for all users so that the build server can clean
Should we remove/update the comment?
05a4750
to
1f0e654
Compare
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.
Reviewable status: complete! all files reviewed, all discussions resolved
wireguard-go-rs/build.rs
line 221 at r3 (raw file):
Previously, Rawa (David Göransson) wrote…
Should we remove/update the comment?
🤦
Fixed!
1f0e654
to
1c46491
Compare
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.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @MarkusPettersson98 and @Rawa)
wireguard-go-rs/build.rs
line 210 at r1 (raw file):
// If daita is enabled, also enable the corresponding rust feature flag if daita {
since daita isn't implemented yet I think we should bail!
here just to make that clear
wireguard-go-rs/libwg/Android.mk
line 7 at r3 (raw file):
DESTDIR ?= $(OUT_DIR) CARGO_TARGET_DIR ?= TARGET ?=
What is TARGET
and CARGO_TARGET_DIR
used for?
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.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @hulthe and @Rawa)
wireguard-go-rs/build.rs
line 210 at r1 (raw file):
Previously, hulthe (Joakim Hulthe) wrote…
since daita isn't implemented yet I think we should
bail!
here just to make that clear
While you are right, it will be enabled in #6684 so the window of potential confusion is rather small 😊
Do you think I should remove the bool?
wireguard-go-rs/libwg/Android.mk
line 7 at r3 (raw file):
Previously, hulthe (Joakim Hulthe) wrote…
What is
TARGET
andCARGO_TARGET_DIR
used for?
Preparatory work, could be pushed to #6684 I suppose 🤷
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.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @MarkusPettersson98 and @Rawa)
wireguard-go-rs/build.rs
line 210 at r1 (raw file):
Previously, MarkusPettersson98 (Markus Pettersson) wrote…
While you are right, it will be enabled in #6684 so the window of potential confusion is rather small 😊
Do you think I should remove the bool?
Ah ok, If it's going to be fixed soon then I don't mind
wireguard-go-rs/libwg/Android.mk
line 7 at r3 (raw file):
Previously, MarkusPettersson98 (Markus Pettersson) wrote…
Preparatory work, could be pushed to #6684 I suppose 🤷
Ah ok, If it's going to be fixed soon then I don't mind
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.
Reviewable status: 2 of 3 files reviewed, all discussions resolved (waiting on @Rawa)
1c46491
to
d94d0bc
Compare
This PR addresses several issues with building
libwg.so
for the supported Android targets. It removeswireguard-go-rs/libwg/build-android.sh
in favor ofwireguard-go-rs/build.rs
.The biggest change is that only the actual target is built, and not all 4 Android targets which was the case for
build-android.sh
.This change is