Skip to content
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

Add Compile scripts for libs #46

Merged
merged 7 commits into from
Feb 5, 2021
Merged

Conversation

6543
Copy link
Contributor

@6543 6543 commented Aug 26, 2020

just some idears/thoughts for #45 and #5

@6543
Copy link
Contributor Author

6543 commented Aug 26, 2020

@Gedsh would be nice if you reveal me how you compile the localy :)

PS: you have write access to my fork if you accept the infitation (just in case it is usefull ...)

@Gedsh
Copy link
Owner

Gedsh commented Aug 27, 2020

would be nice if you reveal me how you compile the localy :)

You can build Golang binaries (dnscrypt, obfs4proxy, snowflake) for android as shown below. Go compiler and Android NDK required. I am using dnscrypt as an example.

#armv7a:

$env:GOPATH=c:\Go\bin\go.exe
$env:GOOS='android'
$env:GOARCH='arm'
$NDK="C:\Users\Alexander\AppData\Local\Android\Sdk\ndk-bundle"
$env:Path += ";$NDK/toolchains/llvm/prebuilt/windows-x86_64/bin"
$env:CCX="$NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi16-clang++"
$env:CC="$NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi16-clang"
$env:CGO_ENABLED=1

#arm64:

$env:GOPATH=c:\Go\bin\go.exe
$env:GOOS='android'
$env:GOARCH='arm64'
$NDK="C:\Users\Alexander\AppData\Local\Android\Sdk\ndk-bundle"
$env:Path += ";$NDK/toolchains/llvm/prebuilt/windows-x86_64/bin"
$env:CCX="$NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android29-clang++"
$env:CC="$NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android29-clang"
$env:CGO_ENABLED=1

#common:

cd C:\Go\My\dnscrypt-proxy-2.0.44\dnscrypt-proxy
go clean
go build -ldflags="-s -w" -o $env:GOPATH/android/dnscrypt-proxy

@Gedsh
Copy link
Owner

Gedsh commented Aug 27, 2020

To build Purple I2P Android NDK is required. I use android-ndk-r14b for this.

Change the path to libraries in this file https://github.com/PurpleI2P/i2pd/blob/openssl/android_binary_only/jni/Application.mk
I am using PowerShell.

cd C:\Users\Alexander\AppData\Local\Android\Sdk\ndk\android-ndk-r14b
"ndk-build -C C:\i2pd-opensslv2.33.0\android_binary_only -j" | cmd

@Gedsh
Copy link
Owner

Gedsh commented Aug 27, 2020

you have write access to my fork if you accept the infitation (just in case it is usefull ...)

Thank you. But unfortunately I have no experience with compile scripts.

@6543
Copy link
Contributor Author

6543 commented Aug 27, 2020

ok now https://github.com/PurpleI2P/i2pd and https://github.com/guardianproject/gpmaven/tree/master/org/torproject/tor-android-binary are missing only ...

go libs can now be compiled automaticaly by this scritp :)

wip ...

@Gedsh
Copy link
Owner

Gedsh commented Aug 27, 2020

ok now https://github.com/PurpleI2P/i2pd and https://github.com/guardianproject/gpmaven/tree/master/org/torproject/tor-android-binary are missing only ...

Tor for Android https://github.com/guardianproject/tor-android

go libs can now be compiled automaticaly by this scritp :)

Cool!

@Gedsh
Copy link
Owner

Gedsh commented Sep 28, 2020

Added a script for building Tor for Android from source using Gitlab CI / CD https://github.com/Gedsh/Tor-Android-build-script

@6543
Copy link
Contributor Author

6543 commented Sep 28, 2020

thanks will add it :)

@Gedsh
Copy link
Owner

Gedsh commented Oct 14, 2020

Added script for building Purple I2P from source using Gitlab CI / CD https://github.com/Gedsh/Purple-I2P-Android-build-script

@linsui
Copy link
Contributor

linsui commented Jan 25, 2021

Based on your great work, I manage to build it with f-droid's gitlab CI but there are some problems. I'm not a dev and have little knowledge about Android. Could you please take a look?
log
apk file
build.sh
fdroid metadata
It seems that the dnscrypt and i2pd work but tor can't start. Maybe ithe reason is that due to the space limitation of gitlab ci I didn't install ndk r20 and r20b so everything is build by r21d. My fault, should be fixed now. Works well on my device. The icon is the beta one, I don't know why.
Thanks!

@6543 Are you still working on this? Would you please take some time to complete this pr? Or I can make another one based on this.

@Gedsh I have some questions. Due to my poor knowledge maybe they are stupid. Could you please help me?

  • How does the version of i2pd specified? I didn't find it.
  • APP_ABI for tor is armeabi while for i2pd is armeabi-v7a. Is this intended? In i2pd's makefile the APP_ABI is armeabi but in gitlab ci armeabi-v7a is passed. What's the difference?
  • Would you like to include two arches in F-Droid? Then autoupdate won't work so that a mr is needed when a new version is available.
  • tor for android is available in F-Droid's trusted repo. Is it possible to use that?

Thanks!

@6543
Copy link
Contributor Author

6543 commented Jan 25, 2021

@linsui feel free to use this pull to finish the work, I have no time to finish it at the moment. So If you like tho have it soon you should pick this up and finish it ;)

@6543
Copy link
Contributor Author

6543 commented Jan 25, 2021

@linsui I have invited you to my fork: https://github.com/6543-forks/InviZible/invitations so feel free to push to this branch or create a new one based on that from your side ...

@linsui
Copy link
Contributor

linsui commented Jan 25, 2021

@6543 Thanks!

@Gedsh
Copy link
Owner

Gedsh commented Jan 26, 2021

Based on your great work, I manage to build it with f-droid's gitlab CI

Thank you! Cool job!

Works well on my device.

Great!

The icon is the beta one, I don't know why.

I thought the beta would be used for f-droid. But with @IzzySoft we decided to use the stable version. I will change the icon.

How does the version of i2pd specified? I didn't find it.

It just uses the latest changes. You can use for example:
git clone --single-branch --branch 2.35.0 https://github.com/PurpleI2P/i2pd.git

APP_ABI for tor is armeabi while for i2pd is armeabi-v7a. Is this intended? In i2pd's makefile the APP_ABI is armeabi but in gitlab ci armeabi-v7a is passed. What's the difference?

The difference is in the processor instruction set. Usually modern processors can use armeabi and armeabi-v7a without any problem.
I'm just using build scripts from the Tor and I2P projects with some adaptation. If they listed armabi or armabi-v7a I thought it might be important and just used the same.

Would you like to include two arches in F-Droid? Then autoupdate won't work so that a mr is needed when a new version is available.

I think it is better to include the armv7a version as it works on both armv7a and arm64 devices.

tor for android is available in F-Droid's trusted repo. Is it possible to use that?

If you want to. But I will continue to use my own builds as I like using the Tor beta versions in InviZible.

@linsui
Copy link
Contributor

linsui commented Jan 26, 2021

I thought the beta would be used for f-droid. But with @IzzySoft we decided to use the stable version. I will change the icon.

Thanks!

It just uses the latest changes. You can use for example:
git clone --single-branch --branch 2.35.0 https://github.com/PurpleI2P/i2pd.git

I would prefer to specify a version when build it or it will produce different resultes on every build.

The difference is in the processor instruction set. Usually modern processors can use armeabi and armeabi-v7a without any problem.
I'm just using build scripts from the Tor and I2P projects with some adaptation. If they listed armabi or armabi-v7a I thought it might be important and just used the same.

I got it!

I think it is better to include the armv7a version as it works on both armv7a and arm64 devices.

I don't know how the update checker works. @IzzySoft @licaon-kter Could you please help? I got WARNING: ...pan.alexander.tordnscrypt.stable : Couldn't find package ID when running the checkupdates.

@IzzySoft
Copy link
Contributor

@linsui not my speciality, but: what is the name of your *.yml – and what is the packageName in build.gradle? The two must match. Work-around for rare cases: if we package it as pan.alexander.tordnscrypt.stable, the build/flavor produces it that way, but build.gradle has e.g. pan.alexander.tordnscrypt (and the suffix is somehow created during the build), there's a matching keyword for the YAML I just saw today (didn't know before it exists): UpdateCheckName: pan.alexander.tordnscrypt would tell the updater to check for that packageId, regardless of the "final name". Details in our Metadata Reference: UpdateCheckName:

When checking for updates (via UpdateCheckMode) this can be used to specify the package name to search for. Useful when apps have a static package name but change it programmatically in some app flavors, by e.g. appending “.open” or “.free” at the end of the package name.

@linsui
Copy link
Contributor

linsui commented Jan 26, 2021

@IzzySoft Thanks for your tips! I'll test it. The package name does present in the gradle file.

applicationId "pan.alexander.tordnscrypt.stable"

@IzzySoft
Copy link
Contributor

🤷‍♂️ Maybe it complains because there is no applicationId in the defaultConfig? No idea, I just mentioned what came to mind. I'm not really fit in gradle or Android programming. I can read and understand some things, but that's quite limited 😆

@linsui
Copy link
Contributor

linsui commented Feb 3, 2021

This pr is ready for review. Here is the apk for test. Thanks!

@6543 6543 marked this pull request as ready for review February 3, 2021 12:03
@6543 6543 changed the title Draft: Add Compile scripts for libs Add Compile scripts for libs Feb 3, 2021
@Gedsh Gedsh merged commit 8209347 into Gedsh:master Feb 5, 2021
@6543
Copy link
Contributor Author

6543 commented Feb 5, 2021

big thanks to @linsui :) !!!

@6543 6543 deleted the libbuild-script branch February 5, 2021 19:10
@Gedsh
Copy link
Owner

Gedsh commented Feb 5, 2021

This pr is ready for review. Here is the apk for test. Thanks!

Thank you for the great job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants