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 to f-droid.org repo #974

Open
licaon-kter opened this issue Nov 26, 2024 · 20 comments
Open

Add to f-droid.org repo #974

licaon-kter opened this issue Nov 26, 2024 · 20 comments

Comments

@licaon-kter
Copy link

licaon-kter commented Nov 26, 2024

trying to develop a recipe but I'm not even sure which commit I need to build

https://github.com/m2049r/xmrwallet/releases/tag/v4.1.5 says commit 989d52b33de200253f1ea3bc2d7d91b8764079fd

download APK, unpack, grep revision META-INF/version-control-info.textproto -> revision: "b08cd2fd2f18af55b0f1ee5003a88d8e81712e06"

but b08cd2f -> 404

@licaon-kter
Copy link
Author

where should I put Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im0yMDQ5ckBtb25lcnVqby5pbyIsInN1YiI6Mjc0NTEsImlhdCI6MTY4OTg2NDk4OSwiZXhwIjoxODQ3NjUyOTg5fQ.y4dUXb6cIWhHBRUdh2U0lb5Gztn_W6SMFqQxXBtdCUM exactly?

@licaon-kter
Copy link
Author

licaon-kter commented Nov 26, 2024

draft recipe metadata/com.m2049r.xmrwallet.yml only armv8 for now

...see below

diff log: mone415_armv8_local2.log.7z.ZIP (remove .ZIP from name)

surely I messed some PATH, those were a pain :(

/LE: new recipe below

@licaon-kter
Copy link
Author

I see a bunch of local paths mentioned in the .so, will move the source to match upstream, hopefully that improves it

- [F = (lambda at /src/src/common/apply_permutation.h:67
+ [F = (lambda at /home/vagrant/build/com.m2049r.xmrwallet/external-libs/monero/src/common/apply_permutation.h:67

@licaon-kter
Copy link
Author

updated recipe to match same folders:

License: Unknown
SourceCode: https://github.com/m2049r/xmrwallet
IssueTracker: https://github.com/m2049r/xmrwallet/issues

RepoType: git
Repo: https://github.com/m2049r/xmrwallet.git
Binaries: https://github.com/m2049r/xmrwallet/releases/download/v4.1.5/monerujo-4x1x5_universal.apk

Builds:
  - versionName: 4.1.5 'Exolix'
    versionCode: 41052
    commit: 989d52b33de200253f1ea3bc2d7d91b8764079fd
    sudo:
      - mkdir -p /src /opt/android/prefix
      - chown -R vagrant /src /opt/android/prefix
      - apt-get update
      - apt-get install -y automake build-essential cmake file libtool libtinfo5 pkg-config
        python-is-python3 yacc libunwind-dev
    gradle:
      - prod
      - mainnet
    output: app/build/outputs/apk/prodMainnet/release/monerujo-*_arm64-v8a.apk
    srclibs:
      - [email protected]
    prebuild:
      - $$NDK$$/build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir
        $$SDK$$/toolchain --stl=libc++ --force
      - sed -i -e "s/include 'armeabi-v7a', 'arm64-v8a', 'x86_64'/include 'arm64-v8a'/"
        app/build.gradle
      - sed -i -e '/new File("app/,/^    }/d' app/build.gradle
      - mv $$m2049r-monero$$/* /src/
    build:
      - pushd ..
      - export WORKDIR=$$SDK$$
      - export ANDROID_SDK_ROOT=${WORKDIR}/tools
      - export ANDROID_NDK_ROOT=$$NDK$$
      - export TOOLCHAIN_DIR=${WORKDIR}/toolchain
      - export PREFIX=/opt/android/prefix
      - set -x
      - export BOOST_VERSION=1_70_0
      - export BOOST_VERSION_DOT=1.70.0
      - export BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
      - curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/sourc
e/boost_${BOOST_VERSION}.tar.bz2
      - echo "${BOOST_HASH}  boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c
      - tar -xvf boost_${BOOST_VERSION}.tar.bz2
      - rm -f boost_${BOOST_VERSION}.tar.bz2
      - pushd boost_${BOOST_VERSION}
      - ./bootstrap.sh --prefix=${PREFIX}
      - popd
      - export HOST_PATH=$PATH
      - export PATH=$TOOLCHAIN_DIR/aarch64-linux-android/bin:$TOOLCHAIN_DIR/bin:$PATH
      - export ICONV_VERSION=1.16
      - export ICONV_HASH=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04
      - curl -O http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz
      - echo "${ICONV_HASH}  libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c
      - tar -xzf libiconv-${ICONV_VERSION}.tar.gz
      - rm -f libiconv-${ICONV_VERSION}.tar.gz
      - pushd libiconv-${ICONV_VERSION}
      - CC=clang CXX=clang++ ./configure --build=x86_64-linux-gnu --host=aarch64-linux-android
        --prefix=${PREFIX} --disable-rpath
      - make -j$(nproc)
      - make install
      - popd
      - pushd boost_${BOOST_VERSION}
      - ./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time
        --with-filesystem --with-program_options --with-regex --with-serialization
        --with-system --with-thread --with-locale --build-dir=android --stagedir=android
        toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX}
        install -j$(nproc)
      - popd
      - export ZLIB_VERSION=1.3.1
      - export ZLIB_HASH=9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23
      - curl -O https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz
      - echo "${ZLIB_HASH}  zlib-${ZLIB_VERSION}.tar.gz" | sha256sum -c
      - tar -xzf zlib-${ZLIB_VERSION}.tar.gz
      - rm zlib-${ZLIB_VERSION}.tar.gz
      - mv zlib-${ZLIB_VERSION} zlib
      - pushd zlib
      - CC=clang CXX=clang++ ./configure --static --prefix=${PREFIX}
      - make -j$(nproc)
      - make install
      - popd
      - export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$HOST_PATH
      - export OPENSSL_VERSION=3.0.5
      - export OPENSSL_HASH=aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a
      - curl -LO https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
      - echo "${OPENSSL_HASH}  openssl-${OPENSSL_VERSION}.tar.gz" | sha256sum -c
      - tar -xzf openssl-${OPENSSL_VERSION}.tar.gz
      - rm openssl-${OPENSSL_VERSION}.tar.gz
      - pushd openssl-${OPENSSL_VERSION}
      - ./Configure android-arm64 -D__ANDROID_API__=21 -static no-shared no-tests
        --with-zlib-include=${PREFIX}/include --with-zlib-lib=${PREFIX}/lib --prefix=${PREFIX}
        --openssldir=${PREFIX}
      - make -j$(nproc)
      - make install_sw
      - popd
      - export ZMQ_VERSION=v4.3.2
      - export ZMQ_HASH=a84ffa12b2eb3569ced199660bac5ad128bff1f0
      - git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION}
      - pushd libzmq
      - ./autogen.sh
      - CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android
        --enable-static --disable-shared
      - make -j$(nproc)
      - make install
      - popd
      - export PATH=$TOOLCHAIN_DIR/aarch64-linux-android/bin:$TOOLCHAIN_DIR/bin:$HOST_PATH
      - export SODIUM_VERSION=1.0.18
      - export SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677
      - git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION}
      - pushd libsodium
      - ./autogen.sh
      - CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android
        --enable-static --disable-shared
      - make -j$(nproc)
      - make install
      - popd
      - export PATH=$HOST_PATH:$TOOLCHAIN_DIR/aarch64-linux-android/bin:$TOOLCHAIN_DIR/bin
      - export LIBEXPAT_VERSION=R_2_4_8
      - export LIBEXPAT_HASH=3bab6c09bbe8bf42d84b81563ddbcf4cca4be838
      - git clone https://github.com/libexpat/libexpat.git -b ${LIBEXPAT_VERSION}
      - pushd libexpat/expat
      - ./buildconf.sh
      - CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android
        --enable-static --disable-shared
      - make -j$(nproc)
      - make install
      - popd
      - export PATH=$TOOLCHAIN_DIR/aarch64-linux-android/bin:$TOOLCHAIN_DIR/bin:$HOST_PATH
      - export LIBUNBOUND_VERSION=release-1.16.1
      - export LIBUNBOUND_HASH=903538c76e1d8eb30d0814bb55c3ef1ea28164e8
      - git clone https://github.com/NLnetLabs/unbound.git -b ${LIBUNBOUND_VERSION}
      - pushd unbound
      - CC=clang CXX=clang++ ./configure --prefix=${PREFIX} --host=aarch64-linux-android
        --enable-static --disable-shared --disable-flto --with-ssl=${PREFIX} --with-libexpat=${PREFIX}
      - make -j$(nproc)
      - make install
      - popd
      - popd
      - export CMAKE_INCLUDE_PATH="${PREFIX}/include"
      - export CMAKE_LIBRARY_PATH="${PREFIX}/lib"
      - export ANDROID_STANDALONE_TOOLCHAIN_PATH=${TOOLCHAIN_DIR}
      - export USE_SINGLE_BUILDDIR=1
      - export PATH=$HOST_PATH
      - pushd /src
      - make release-static-android-armv8-wallet_api -j$(nproc)
      - popd
      - mkdir -p external-libs/arm64-v8a/monero
      - find /src/build/release -iname "*.a" -exec cp {} external-libs/arm64-v8a/monero
        \;
      - find /src -iname "wallet2_api.h" -exec cp {} app/src/main/cpp \;
      - find ${PREFIX} -iname "*.a" -exec cp {} external-libs/arm64-v8a \;
    ndk: r17c

AllowedAPKSigningKeys: 967ca1930c19f383a43729a059cd21727855f78cd5e0d9882f780189fe1d8cf1

AutoUpdateMode: Version
UpdateCheckMode: Tags
CurrentVersion: 4.1.5 'Exolix'
CurrentVersionCode: 41052

diff still huge: mone415_armv8_local_path1.log.7z.ZIP (remove .ZIP from name)

I guess we need to wait for b08cd2f to become available?

maybe I've picked up the wrong https://github.com/m2049r/monero/tree/release-v0.18.3.4-monerujo release?

maybe some lib was not built for arm64 by mistake?

etc

@m2049r
Copy link
Owner

m2049r commented Nov 28, 2024

I doubt this would ever get merged

@licaon-kter
Copy link
Author

Because the source code is not fully FOSS and available?

@m2049r
Copy link
Owner

m2049r commented Nov 28, 2024

This is silly. What makes you say that?
Because we want to maintain our own f-droid repo.

@licaon-kter
Copy link
Author

I had some questions above, some issues, that were not addressed.

To be fair, the first step is "get upstream to agree with inclusion in F-Droid", hence, if that's not a thing you want feel free to close this.

@m2049r
Copy link
Owner

m2049r commented Dec 3, 2024

what exactly is META-INF/version-control-info.textproto? can't find any docs about that

@licaon-kter
Copy link
Author

@m2049r
Copy link
Owner

m2049r commented Dec 3, 2024

thanks - where does that revision come from? the code of the release apk is not committed anywhere (it's the tagged version + local monerujo.id file with api keys)

@licaon-kter
Copy link
Author

where does that revision come from?

From the source tree on the machine that built YOUR release APK, eg. In my APK that string says 989d52b33de200253f1ea3bc2d7d91b8764079fd because I've built from your tagged commit... 989d52b

the code of the release apk is not committed anywhere

I don't follow, the Release Tag points to a commit, you say that you don't build the app from the... tagged commit? There's another repo somewhere that I need to use?

(it's the tagged version + local monerujo.id file with api keys)

I'm not sure what this means, where can we find all these? How do you use them?

/PS: excuse my confusion, but I'm used to just grab a repo and build from a commit, not sure how things are split around here, and I didn't get this info from the build instructions (or did I miss them?)

@m2049r
Copy link
Owner

m2049r commented Dec 4, 2024

process today is:

  • build external-libs for different architectures (Makefile, Dockerfiles, etc in /external-libs directory, monero in the directory is currently https://github.com/m2049r/monero/tree/release-v0.18.3.4-monerujo)
  • add keys to /monerujo.id (currently setting ID_F=Bearer token) - this file is not checked in and is the source of the different source tree hash, there is no other repo
  • build & sign apks in Android Studio (manually) - which could just as well be done with ./gradlew assembleRelease i guess

@licaon-kter
Copy link
Author

I've injected Bearer in monerujo.id so that's not an issue any more 👍

another issue is here: https://github.com/m2049r/xmrwallet/blob/v4.1.5/app/build.gradle#L83-L89

 -  <string name="available_locales">en,cat,de,el,eo,es,et,fa,fr,he,hu,it,ja,nb,night-v23,night-v27,nl,pt,pt-BR,ro,ru,sk,sr,sv,ta,uk,v23,v27,zh-CN,zh-TW</string>
 +  <string name="available_locales">en,ta,v27,ja,fa,sk,sv,eo,pt,et,zh-CN,hu,de,el,fr,v23,nb,zh-TW,cat,pt-BR,it,night-v27,uk,ru,es,sr,he,ro,nl,night-v23</string>

not sure why these are not sorted for me

the rest of the diff log is here, only for arm64 for now: mone415_univ_bearer_lang1.log.7z.zip

next, reproducibility, we have apps like Electrum, Bitcoin Wallet, BitBanana and more, built reproducible, with variable complexity levels, we'll have RoboSats soon too.

Looking at that diff log linked above, even with matched build paths, it's 180Mb+ for one arch only

Is there a chance to make it reproducible? What am I missing? @m2049r

@linsui maybe you can take a peek at the log too

@m2049r
Copy link
Owner

m2049r commented Dec 5, 2024

we need to talk about how i can reproduce what you are doing - @anhdres will get in touch with you about that.

it's not clear to me what versions of operating system & compiler & supporting packages you are using. 99.9% of diffs are coming from compiling monero code - which actually has a reproducible build

@linsui
Copy link

linsui commented Dec 6, 2024

F-Driod currently uses Debian bookworm, which should be the same os as your docker. Maybe you need to pin the os to a snapshot as what electrum does.

@licaon-kter
Copy link
Author

licaon-kter commented Dec 6, 2024

we need to talk about how i can reproduce what you are doing

the recipe is above, executed top-bottom

it's not clear to me what versions of operating system & compiler & supporting packages you are using.

Debian Bookworm, and can install whatever is needed, see the sudo: section, we can add other deps if I missed them

As said above: "surely I messed some PATH, those were a pain" see export PATH lines in the recipe above, basically every lib dep wanted some other tooling in the path, I feel this holds the key of reproducibility

Odd question, if you build multiple times in your Docker, the hash sum of your monero .so matches?

@anhdres
Copy link
Contributor

anhdres commented Dec 6, 2024

Hey @licaon-kter I couldn't find any contact info on you. Do you use matrix/telegram/signal/xmpp something so we can open a discussion on this?

@licaon-kter
Copy link
Author

licaon-kter commented Dec 6, 2024

@anhdres better have this info easily findable, I've opened https://gitlab.com/fdroid/rfp/-/issues/2945

also so other contributors can see the last state

@m2049r
Copy link
Owner

m2049r commented Dec 6, 2024

Odd question, if you build multiple times in your Docker, the hash sum of your monero .so matches?

no. i guess we need to find someone who knows how to build monero deterministically (incl. dependencies)

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

No branches or pull requests

4 participants