{"id":16867167,"url":"https://github.com/leleliu008/ndk-pkg","last_synced_at":"2026-03-12T05:04:14.927Z","repository":{"id":37329204,"uuid":"274883926","full_name":"leleliu008/ndk-pkg","owner":"leleliu008","description":"A package builder/manager for Android NDK to build projects written in C, C++, Rust, Golang, etc.","archived":false,"fork":false,"pushed_at":"2026-03-04T22:27:27.000Z","size":13158,"stargazers_count":98,"open_issues_count":1,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-03-05T04:21:52.342Z","etag":null,"topics":["android-ndk","c","cli","cxx","golang","package-manager","rust"],"latest_commit_sha":null,"homepage":"http://blog.fpliu.com/project/ndk-pkg","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leleliu008.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-06-25T10:05:02.000Z","updated_at":"2026-03-04T22:27:31.000Z","dependencies_parsed_at":"2023-11-26T03:22:41.891Z","dependency_job_id":"f1706404-01f5-4987-896d-27174fe45e8f","html_url":"https://github.com/leleliu008/ndk-pkg","commit_stats":null,"previous_names":[],"tags_count":106,"template":false,"template_full_name":null,"purl":"pkg:github/leleliu008/ndk-pkg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fndk-pkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fndk-pkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fndk-pkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fndk-pkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leleliu008","download_url":"https://codeload.github.com/leleliu008/ndk-pkg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fndk-pkg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30416310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T04:41:02.746Z","status":"ssl_error","status_checked_at":"2026-03-12T04:40:12.571Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-ndk","c","cli","cxx","golang","package-manager","rust"],"created_at":"2024-10-13T14:53:04.260Z","updated_at":"2026-03-12T05:04:14.920Z","avatar_url":"https://github.com/leleliu008.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ndk-pkg\n\nA package builder using [Android NDK](https://developer.android.google.cn/ndk)\n\n## Caveats\n\nPlease read these caveats carefully before starting to use this software.\n\n- This software is being actively developed. It's in beta stage and may not be stable. Some features are subject to change without notice.\n\n- Please do NOT place your own files under `~/.ndk-pkg` directory, as `ndk-pkg` will change files under `~/.ndk-pkg` directory without notice.\n\n- Please do NOT run `ndk-pkg` command in parallel so as not to generate dirty data.\n\n## Platforms that this software can run on\n\n|HostOS|HostArch|SubSystem|recommended|fully tested|fully supported|\n|------|--------|---------|-----------|------------|-------|\n|✶|`x86_64`|[Docker](https://www.docker.com/)|✔︎|✔︎|✔︎|\n|[GNU/Linux](https://www.gnu.org/gnu/linux-and-gnu.en.html)|`x86_64`||✔︎|✔︎|✔︎|\n|[Windows](https://www.microsoft.com/en-us/windows/)|`x86_64`|[WSL](https://docs.microsoft.com/en-us/windows/wsl/)||||\n|[macOS](https://www.apple.com.cn/mac/)|`x86_64` `arm64`|||✔︎||\n|[Android](https://www.apple.com.cn/mac/)|`aarch64`|[Termux](https://termux.dev/)||||\n\n**Notes** :\n\n- This software can NOT run on [Cygwin](http://cygwin.org/) and [MSYS2](https://www.msys2.org/) due to a cmake error: `CMake: Builds hosted on 'CYGWIN' not supported.`, for the reason please refer to [Android-Determine.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Android-Determine.cmake#L278-L300). If you really want to use this software on [Windows](https://www.microsoft.com/en-us/windows/), please use via [Docker](https://www.docker.com/) or [WSL](https://docs.microsoft.com/en-us/windows/wsl/) instead.\n\n## About the Android NDK toolchain\n\nGenerally, you don't need to download the `Android NDK`, because `ndk-pkg` will automatically download it when needed, unless you want to use your own `Android NDK`, you can specify your location of `Android NDK` via `--ndk-home=\u003cANDROID-NDK-HOME\u003e` option. **Please note that you can't specify your location of `Android NDK` via environment variable `ANDROID_NDK_HOME` and `ANDROID_NDK_ROOT`**\n\n`ndk-pkg` also allows you to use a specific revision of `Android NDK` via `--ndk-revision=\u003cANDROID-NDK-REVISION\u003e` option. For example, if you want to use the `Android NDK r28c`, you can run `ndk-pkg install \u003cPKG\u003e --ndk-revision=28c`\n\n## About 16KB page size support\n\nAt the moment, `ndk-pkg` use `Android NDK r27d (the latest LTS revision)`, it doesn't compile 16 KB-aligned by default. Due to Android NDK r28 and higher compile 16 KB-aligned by default, you can run `ndk-pkg install \u003cPKG\u003e --ndk-revision=28c` if you need 16 KB-aligned ELF files.\n\n## Using ndk-pkg via GitHub Actions\n\nThis is the recommended way of using this software.\n\nIn this way, you don't need a computer in hand, you could use GitHub mobile Apps.\n\nIn this way, you will be liberated from the rut of setting up the build environment.\n\nIn this way, you do NOT need to frequently update this software, you always use the latest version.\n\nIn this way, all you need to do is just clicking the buttons and waiting for finishing. After finishing, a url refers to a zip archive will be provided to download.\n\nFor more details please refer to \u003chttps://github.com/leleliu008/ndk-pkg-package-manually-build\u003e\n\n## Using ndk-pkg via [Docker](https://www.docker.com/)\n\nThis is the recommended way of using this software if you want to use this software locally.\n\n`docker` container is an isolated clean environment where the running process can not be affected by your host system's environemt variables.\n\n**step1. create the ndk-pkg docker container**\n\n```bash\nmkdir -p ~/ndk-pkg-home\nmkdir -p ~/.m2\n\ndocker create -it --name ndk-pkg -v ~/ndk-pkg-home:/root/.ndk-pkg -v ~/.m2:/root/.m2 ghcr.io/leleliu008/ndk-pkg\n```\n\n**step2. start the ndk-pkg docker container**\n\n```bash\ndocker start ndk-pkg\n```\n\n**step3. install essential tools**\n\n```bash\ndocker exec -it ndk-pkg ndk-pkg setup\n```\n\n**step4. update formula repositories**\n\n```bash\ndocker exec -it ndk-pkg ndk-pkg update\n```\n\nIf all goes well, then next you can start to install packages whatever you want, for example, let's install `curl` package for target `android-35-arm64-v8a`:\n\n```bash\ndocker exec -it ndk-pkg ndk-pkg install curl --target=android-35-arm64-v8a --static\n```\n\n**Note:** you can use `podman` instead of `docker`\n\n## Using ndk-pkg via chroot+ubuntu\n\nThis is the recommended way of using this software if you want to use this software locally and your host is `linux-x86_64`.\n\n`chroot`, an isolated clean environment, is much like `docker` container, where the running process can not be affected by your host system's environment variables.\n\n```bash\ncurl -LO https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.3-base-amd64.tar.gz\ninstall -d ubuntu-rootfs\ntar xf ubuntu-base-24.04.3-base-amd64.tar.gz -C ubuntu-rootfs\n\ncp -p /etc/resolv.conf ubuntu-rootfs/etc/\n\ncurl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg\nchmod a+x ndk-pkg\nmv ndk-pkg ubuntu-rootfs/bin/\n\nsudo mount -o bind  /dev ubuntu-rootfs/dev\nsudo mount -t proc  none ubuntu-rootfs/proc\nsudo mount -t sysfs none ubuntu-rootfs/sys\nsudo mount -t tmpfs none ubuntu-rootfs/tmp\n\nsudo chroot ubuntu-rootfs ndk-pkg setup -y\nsudo chroot ubuntu-rootfs ndk-pkg update\nsudo chroot ubuntu-rootfs ndk-pkg install curl --target=android-35-arm64-v8a --static\n```\n\n## Using ndk-pkg via chroot+alpine\n\nThis is the recommended way of using this software if you want to use this software locally and your host is `linux-x86_64`.\n\n`chroot`, an isolated clean environment, is much like `docker` container, where the running process can not be affected by your host system's environment variables.\n\n```bash\ncurl -LO https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/x86_64/alpine-minirootfs-3.22.0-x86_64.tar.gz\ninstall -d alpine-rootfs\ntar xf alpine-minirootfs-3.22.0-x86_64.tar.gz -C alpine-rootfs\n\ncp -p /etc/resolv.conf alpine-rootfs/etc/\n\ncurl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg\nchmod a+x ndk-pkg\nmv ndk-pkg alpine-rootfs/bin/\n\nsudo mount -o bind  /dev alpine-rootfs/dev\nsudo mount -t proc  none alpine-rootfs/proc\nsudo mount -t sysfs none alpine-rootfs/sys\n\nsudo chroot alpine-rootfs ndk-pkg setup\nsudo chroot alpine-rootfs ndk-pkg update\nsudo chroot alpine-rootfs ndk-pkg install curl --target=android-35-arm64-v8a --static\n```\n\n## Using ndk-pkg via [WSL](https://docs.microsoft.com/en-us/windows/wsl)\n\n**Note** :\n\n- As of Android NDK r25, Android NDK for Linux is incompatible with WSL1 due to the use of [BOLT](https://github.com/llvm/llvm-project/tree/main/bolt). For more details please refer to https://github.com/android/ndk/issues/1755\n\n**/etc/wsl.conf** :\n\n```ini\n[network]\nhostname = ubuntu\ngenerateHosts = false\n\n[automount]\nenabled = true\nroot = /mnt/\noptions = \"metadata,umask=22,fmask=11\"\nmountFsTab = true\n```\n\n**installation instructions** :\n\n```bash\n# If you want to store ndk-pkg generated data to D:\\ partition\nexport NDKPKG_HOME=/mnt/d/ndk-pkg\n\n# If you use Ubuntu or Debian distribution\nsudo apt -y update\nsudo apt -y install curl\n\ncurl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg\nchmod a+x ndk-pkg\n./ndk-pkg setup\n```\n\n## Install ndk-pkg via cURL\n\n**Caveats**:\n\n- Running `ndk-pkg` locally directly on your local host is not recommended due to build tools(e.g. autotools, cmake, etc) are easy to be affected by environment variables. Running `ndk-pkg` in an isolated clean environment (`docker`, `chroot`) is highly recommended.\n\n```bash\ncurl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg\nchmod a+x ndk-pkg\n./ndk-pkg setup\n```\n\n中国大陆的用户亦可将上面的地址替换为下面的地址:\n\n- https://ghfast.top/https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg\n- https://cdn.jsdelivr.net/gh/leleliu008/ndk-pkg/ndk-pkg\n- https://gitee.com/fpliu/ndk-pkg/raw/master/ndk-pkg\n\n## Install ndk-pkg via git\n\n```bash\ngit clone --depth 1 https://github.com/leleliu008/ndk-pkg\nndk-pkg/ndk-pkg setup\n```\n\n## ~/.ndk-pkg\n\n**Caveats**: Please do NOT place your own files under `~/.ndk-pkg` directory, as `ndk-pkg` will change (remove, modify, override) files under `~/.ndk-pkg` directory without notice.\n\nA typical hierarchical structure under `~/.ndk-pkg` directory looks like below:\n\n```text\n~/.ndk-pkg\n├── core\n│   ├── SourceCodePro-Light.otf\n│   ├── cacert.pem\n│   ├── fonts.conf\n│   ├── init.sh\n│   ├── ndk-pkg-core-2024.05.15-linux-x86_64.tar.xz\n│   ├── ndk-pkg-core-latest-release-version\n│   ├── uppm\n│   ├── wrapper-native-cc\n│   ├── wrapper-native-c++\n│   ├── wrapper-native-objc\n│   ├── wrapper-target-cc\n│   └── wrapper-target-c++\n├── downloads\n│   ├── 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313.tgz\n│   ├── b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30.tgz\n│   └── c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4.tgz\n├── installed\n│   ├── android-35-arm64-v8a\n│   │   ├── f39a5f7836ac7ca1e04de14c8103e663d0b375a524a40e537258747e2deb3c0b\n│   │   │   ├── include\n│   │   │   ├── lib\n│   │   │   └── share\n│   │   └── zlib -\u003e f39a5f7836ac7ca1e04de14c8103e663d0b375a524a40e537258747e2deb3c0b\n│   ├── android-35-armeabi-v7a\n│   │   ├── cc9b367d5068ef6b8aaaee38ec2a25691da35e02757c7e0d83aff3775aef3323\n│   │   │   ├── include\n│   │   │   ├── lib\n│   │   │   └── share\n│   │   └── zlib -\u003e cc9b367d5068ef6b8aaaee38ec2a25691da35e02757c7e0d83aff3775aef3323\n│   ├── android-35-x86\n│   │   ├── a0718632fe829426c1d946e6658cc7586da0039e99d5a140d1e402a6b4a4e2f3\n│   │   │   ├── include\n│   │   │   ├── lib\n│   │   │   └── share\n│   │   └── zlib -\u003e a0718632fe829426c1d946e6658cc7586da0039e99d5a140d1e402a6b4a4e2f3\n│   └── android-35-x86_64\n│       ├── c099047714d4ce1402d66346da88d14f25c313b0d4c879520198426ebc2f36fe\n│       │   ├── include\n│       │   ├── lib\n│       │   └── share\n│       └── zlib -\u003e c099047714d4ce1402d66346da88d14f25c313b0d4c879520198426ebc2f36fe\n├── native\n│   └── linux-x86_64\n│       ├── 30b5043e2c5513343152506e5b1e14436ddbb654f7edf69167df05f117fcdb16\n│       │   ├── bin\n│       │   │   ├── aclocal\n│       │   │   ├── aclocal-1.16\n│       │   │   ├── automake\n│       │   │   └── automake-1.16\n│       │   ├── share\n│       │   └── receipt.txt\n│       └── automake -\u003e 30b5043e2c5513343152506e5b1e14436ddbb654f7edf69167df05f117fcdb16\n├── uppm\n│   ├── downloads\n│   │   ├── fe6b6f7db67a20ccca0385ae38c4aafc7b2bfedc98f9d86880dfeb127a56c012.txz\n│   │   └── ff66b70c830a38d331d44f6c25a37b582471def9a161c93902bac7bea3098319.tgz\n│   ├── installed\n│   │   ├── android-ndk-r26d\n│   │   │   ├── CHANGELOG.md\n│   │   │   ├── NOTICE\n│   │   │   ├── NOTICE.toolchain\n│   │   │   ├── README.md\n│   │   │   ├── build\n│   │   │   ├── meta\n│   │   │   ├── ndk-build\n│   │   │   ├── ndk-gdb\n│   │   │   ├── ndk-lldb\n│   │   │   ├── ndk-stack\n│   │   │   ├── ndk-which\n│   │   │   ├── prebuilt\n│   │   │   ├── python-packages\n│   │   │   ├── shader-tools\n│   │   │   ├── simpleperf\n│   │   │   ├── source.properties\n│   │   │   ├── sources\n│   │   │   ├── toolchains\n│   │   │   └── wrap.sh\n│   │   ├── bash\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── bsdtar\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── coreutils\n│   │   │   ├── bin\n│   │   │   ├── libexec\n│   │   │   └── share\n│   │   ├── curl\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── d2\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── dot_static\n│   │   │   └── bin\n│   │   ├── findutils\n│   │   │   ├── bin\n│   │   │   ├── libexec\n│   │   │   ├── share\n│   │   │   └── var\n│   │   ├── gawk\n│   │   │   ├── bin\n│   │   │   ├── etc\n│   │   │   ├── libexec\n│   │   │   └── share\n│   │   ├── git\n│   │   │   ├── bin\n│   │   │   ├── libexec\n│   │   │   └── share\n│   │   ├── grep\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── gsed\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── jq\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── patchelf\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── pkg-config\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── tree\n│   │   │   ├── bin\n│   │   │   └── share\n│   │   ├── xxd\n│   │   │   └── bin\n│   │   ├── yq\n│   │   │   └── bin\n│   │   └── zip\n│   │       ├── bin\n│   │       └── share\n│   └── repos.d\n│       └── official-core\n│           ├── LICENSE\n│           ├── README.md\n│           └── formula\n├── repos.d\n│   └── official-core\n│       ├── formula\n│       │   ├── zlib.yml\n│       │   ├── libbz2.yml\n│       │   ├── liblzma.yml\n│       │   └── libzstd.yml\n│       └── README.md\n└── run\n    ├── 3409784\n    ├── 3447656\n    └── 3457395\n```\n\n## ndk-pkg command usage\n\n- **show help of this command**\n\n    ```bash\n    ndk-pkg -h\n    ndk-pkg --help\n    ```\n\n- **show version of this command**\n\n    ```bash\n    ndk-pkg -V\n    ndk-pkg --version\n    ```\n\n- **show basic information about this software**\n\n    ```bash\n    ndk-pkg about\n    ```\n\n- **show basic information about your current running operation system**\n\n    ```bash\n    ndk-pkg sysinfo\n    ```\n\n- **show basic information about the specified location of [Android NDK](https://developer.android.com/ndk)**\n\n    ```bash\n    ndk-pkg ndkinfo /usr/local/share/android-ndk\n    ```\n\n- **generate url-transform sample**\n\n    ```bash\n    ndk-pkg gen-url-transform-sample\n    ```\n\n- **install essential tools used by this shell script**\n\n    ```bash\n    ndk-pkg setup\n    ndk-pkg setup -y\n    ```\n    This command is mainly doing the following things:\n\n  - install `curl` via your system's package manager if none of `curl` `wget` `http` `lynx` `aria2c` `axel` command is found when `-y` option is given.\n  - install [uppm](https://github.com/leleliu008/uppm) to `~/.ndk-pkg/core`\n  - install other essential tools (listed below) that are used by this shell script via [uppm](https://github.com/leleliu008/uppm)\n\n    - [GNU Bash](https://www.gnu.org/software/bash/manual/bash.html)\n    - [GNU CoreUtils](https://www.gnu.org/software/coreutils/manual/coreutils.html)\n    - [GNU FindUtils](https://www.gnu.org/software/findutils/manual/html_mono/find.html)\n    - [GNU awk](https://www.gnu.org/software/gawk/manual/gawk.html)\n    - [GNU sed](https://www.gnu.org/software/sed/manual/sed.html)\n    - [GNU grep](https://www.gnu.org/software/grep/manual/grep.html)\n    - [BSD tar](https://man.archlinux.org/man/core/libarchive/bsdtar.1.en)\n    - [patchelf](https://github.com/NixOS/patchelf)\n    - [tree](https://linux.die.net/man/1/tree)\n    - [curl](https://curl.se/docs/manpage.html)\n    - [git](https://git-scm.com/docs/git)\n    - [xxd](https://raw.githubusercontent.com/vim/vim/master/runtime/doc/xxd.man)\n    - [fzf](https://github.com/junegunn/fzf)\n    - [bat](https://github.com/sharkdp/bat)\n    - [jq](https://stedolan.github.io/jq/manual/)\n    - [yq](https://mikefarah.gitbook.io/yq/)\n    - [d2](https://github.com/terrastruct/d2)\n    - [dot](https://graphviz.org/doc/info/command.html)\n\n- **integrate `zsh-completion` script**\n\n    ```bash\n    ndk-pkg integrate zsh\n    ndk-pkg integrate zsh --output-dir=/usr/local/share/zsh/site-functions\n    ndk-pkg integrate zsh -v\n    ```\n\n    This software provides a zsh-completion script for `ndk-pkg`. when you've typed `ndk-pkg` then type `TAB` key, the rest of the arguments will be automatically complete for you.\n\n    **Note**: to apply this feature, you may need to run the command `autoload -U compinit \u0026\u0026 compinit` in your terminal (your current running shell must be zsh).\n\n    **Caveat**: to use this feature, you should put `ndk-pkg` command in `PATH`\n\n- **update all available formula repositories**\n\n    ```bash\n    ndk-pkg update\n    ```\n\n- **search all available packages whose name matches the given regular expression pattern**\n\n    ```bash\n    ndk-pkg search curl\n    ndk-pkg search lib\n    ```\n\n- **show information of the given available package**\n\n    ```bash\n    ndk-pkg info-available curl\n    ndk-pkg info-available curl --yaml\n    ndk-pkg info-available curl --json\n    ndk-pkg info-available curl version\n    ndk-pkg info-available curl license\n    ndk-pkg info-available curl summary\n    ndk-pkg info-available curl web-url\n    ndk-pkg info-available curl git-url\n    ndk-pkg info-available curl git-sha\n    ndk-pkg info-available curl git-ref\n    ndk-pkg info-available curl src-url\n    ndk-pkg info-available curl src-sha\n    ndk-pkg info-available curl src-ft\n    ndk-pkg info-available curl src-fp\n    ```\n\n- **show information of the given installed package**\n\n    ```bash\n    ndk-pkg info-installed android-35-arm64-v8a/curl --prefix\n    ndk-pkg info-installed android-35-arm64-v8a/curl --files\n    ndk-pkg info-installed android-35-arm64-v8a/curl builtat\n    ndk-pkg info-installed android-35-arm64-v8a/curl builtat-iso-8601\n    ndk-pkg info-installed android-35-arm64-v8a/curl builtat-rfc-3339\n    ndk-pkg info-installed android-35-arm64-v8a/curl builtat-iso-8601-utc\n    ndk-pkg info-installed android-35-arm64-v8a/curl builtat-rfc-3339-utc\n    ```\n\n- **show packages that are depended by the given package**\n\n    ```bash\n    ndk-pkg depends curl\n\n    ndk-pkg depends curl -t d2\n    ndk-pkg depends curl -t dot\n    ndk-pkg depends curl -t box\n    ndk-pkg depends curl -t png\n    ndk-pkg depends curl -t svg\n\n    ndk-pkg depends curl -t d2  -o dependencies/\n    ndk-pkg depends curl -t dot -o dependencies/\n    ndk-pkg depends curl -t box -o dependencies/\n    ndk-pkg depends curl -t png -o dependencies/\n    ndk-pkg depends curl -t svg -o dependencies/\n\n    ndk-pkg depends curl -o curl-dependencies.d2\n    ndk-pkg depends curl -o curl-dependencies.dot\n    ndk-pkg depends curl -o curl-dependencies.box\n    ndk-pkg depends curl -o curl-dependencies.png\n    ndk-pkg depends curl -o curl-dependencies.svg\n\n    ndk-pkg depends curl -t svg -o . --engine=d2\n    ndk-pkg depends curl -t svg -o . --engine=dot\n    ```\n\n- **download resources of the given package to the local cache**\n\n    ```bash\n    ndk-pkg fetch curl\n    ndk-pkg fetch curl -v\n    ```\n\n- **install packages**\n\n    ```bash\n    ndk-pkg install curl\n    ndk-pkg install android-35-arm64-v8a/curl\n    ndk-pkg install android-35-arm64-v8a/curl --static\n    ```\n\n- **reinstall packages**\n\n    ```bash\n    ndk-pkg reinstall curl\n    ndk-pkg reinstall android-35-arm64-v8a/curl --static\n    ```\n\n- **uninstall packages**\n\n    ```bash\n    ndk-pkg uninstall curl\n    ndk-pkg uninstall android-35-arm64-v8a/curl\n    ```\n\n- **upgrade the outdated packages**\n\n    ```bash\n    ndk-pkg upgrade curl\n    ndk-pkg upgrade android-35-arm64-v8a/curl --static\n    ```\n\n- **upgrade this software**\n\n    ```bash\n    ndk-pkg upgrade-self\n    ndk-pkg upgrade-self -v\n    ```\n\n- **list all available formula repositories**\n\n    ```bash\n    ndk-pkg formula-repo-list\n    ```\n\n- **add a new formula repository**\n\n    ```bash\n    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo\n    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo --branch=master\n    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo --branch=main\n\n    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo --sync\n    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo --sync --branch=master\n    ndk-pkg formula-repo-add my_repo https://github.com/leleliu008/ndk-pkg-formula-repository-my_repo --sync --branch=main\n    ```\n\n- **delete a existing formula repository**\n\n    ```bash\n    ndk-pkg formula-repo-del my_repo\n    ```\n\n- **list all available packages**\n\n    ```bash\n    ndk-pkg ls-available\n    ```\n\n- **list all installed packages**\n\n    ```bash\n    ndk-pkg ls-installed\n    ```\n\n- **list all outdated packages**\n\n    ```bash\n    ndk-pkg ls-outdated\n    ```\n\n- **check if the given package is available**\n\n    ```bash\n    ndk-pkg is-available curl\n    ```\n\n- **check if the given package is installed**\n\n    ```bash\n    ndk-pkg is-installed curl\n    ndk-pkg is-installed android-35-arm64-v8a/curl\n    ```\n\n- **check if the given package is outdated**\n\n    ```bash\n    ndk-pkg is-outdated  curl\n    ndk-pkg is-outdated  android-35-arm64-v8a/curl\n    ```\n\n- **list installed files of the given installed package in a tree-like format**\n\n    ```bash\n    ndk-pkg tree curl\n    ndk-pkg tree android-35-arm64-v8a/curl -L 3\n    ```\n\n- **show logs of the given installed package**\n\n    ```bash\n    ndk-pkg logs curl\n    ndk-pkg logs android-35-arm64-v8a/curl\n    ```\n\n- **bundle the given installed package into a single archive file**\n\n    ```bash\n    ndk-pkg bundle android-35-arm64-v8a/curl .tar.gz\n    ndk-pkg bundle android-35-arm64-v8a/curl .tar.xz\n    ndk-pkg bundle android-35-arm64-v8a/curl .tar.lz\n    ndk-pkg bundle android-35-arm64-v8a/curl .tar.bz2\n    ndk-pkg bundle android-35-arm64-v8a/curl .zip\n    ndk-pkg bundle android-35-arm64-v8a/curl xx.zip\n    ndk-pkg bundle android-35-arm64-v8a/curl a/.zip\n    ndk-pkg bundle android-35-arm64-v8a/curl a/xx.zip\n    ```\n\n- **export the given installed package as the google prefab aar**\n\n    ```bash\n    ndk-pkg export android-35-arm64-v8a,x86_64/curl -o .\n    ndk-pkg export android-35-arm64-v8a,x86_64/curl -o curl-8.1.2.aar\n    ```\n\n- **export the given installed package as the google prefab aar then deploy it to Maven Local Repository**\n\n    ```bash\n    ndk-pkg depoly android-35-arm64-v8a,x86_64/curl\n    ndk-pkg depoly android-35-arm64-v8a,x86_64/curl --debug\n    ndk-pkg depoly android-35-arm64-v8a,x86_64/curl --local=/somewhere\n    ```\n\n- **export the given installed package as the google prefab aar then deploy it to Sonatype OSSRH**\n\n    ```bash\n    ndk-pkg depoly android-35-arm64-v8a,x86_64/curl --remote \u003c ~/OSSRH-config\n    ndk-pkg depoly android-35-arm64-v8a,x86_64/curl --remote \u003c\u003cEOF\n    SERVER_ID=OSSRH\n    SERVER_URL=https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/\n    SERVER_USERNAME=your-sonatype-account-username\n    SERVER_PASSWORD=your-sonatype-account-password\n    GPG_PASSPHRASE=your-gpg-store-passphase\n    EOF\n    ```\n\n- **delete the unused cached files**\n\n    ```bash\n    ndk-pkg cleanup\n    ```\n\n## environment variables\n\n- **HOME**\n\n    This environment variable already have been set on the most operating systems, if not set or set a empty string, you may receive an error message.\n\n- **PATH**\n\n    This environment variable already have been set on the most operating systems, if not set or set a empty string, you may receive an error message.\n\n- **SSL_CERT_FILE**\n\n    ```bash\n    curl -LO https://curl.se/ca/cacert.pem\n    export SSL_CERT_FILE=\"$PWD/cacert.pem\"\n    ```\n\n    In general, you don't need to set this environment variable, but, if you encounter the reporting `the SSL certificate is invalid`, trying to run above commands in your terminal will do the trick.\n\n- **GOPROXY**\n\n    ```bash\n    export GOPROXY='https://goproxy.cn'\n    ```\n\n- **NDKPKG_URL_TRANSFORM**\n\n    ```bash\n    export NDKPKG_URL_TRANSFORM=/path/of/url-transform\n    ```\n\n    `/path/of/url-transform` command would be invoked as `/path/of/url-transform \u003cURL\u003e`\n\n    `/path/of/url-transform` command must output a `\u003cURL\u003e`\n\n    you can generate a url-transform sample via `ndk-pkg gen-url-transform-sample`\n\n    If you want to change the request url, you can set this environment variable. It is very useful for chinese users.\n\n- **NDKPKG_DNS_SERVERS**\n\n    DNS servers to be used instead of the system default.\n\n    ```bash\n    export NDKPKG_DNS_SERVERS='1.1.1.1,8.8.8.8'\n    ```\n\n- **NDKPKG_XTRACE**\n\n    For debugging purposes.\n\n    enable `set -x`:\n\n    ```bash\n    export NDKPKG_XTRACE=1\n    ```\n\n- **NDKPKG_HOME**\n\n    If this environment variable is not set or set a empty string, `~/.ndk-pkg` will be used as the default value.\n\n    ```bash\n    export NDKPKG_HOME=/path/of/ndk-pkg-home\n    ```\n\n- **NDKPKG_DEFAULT_TARGET**\n\n    Some ACTIONs of ndk-pkg are associated with an installed package which need `PACKAGE-SPEC` to be specified.\n\n    **PACKAGE-SPEC** : a formatted string that has form: `\u003cTARGET\u003e/\u003cPACKAGE-NAME\u003e`, represents an installed package.\n\n    **PACKAGE-NAME** : should match the regular expression pattern `^[A-Za-z0-9+-_.@]{1,50}$`\n\n    **TARGET** : a formatted string that has form: `android-\u003cANDROID-API\u003e-\u003cANDROID-ABI\u003e`\n\n    **ANDROID-API**  : indicates which minimum [Android SDK API Level](https://developer.android.com/tools/releases/platforms) was built with.\n\n    **ANDROID-ABI**  : indicates which [Android ABI](https://developer.android.com/ndk/guides/abis) was built for.\n\n    To simplify the usage, you are allowed to omit `\u003cTARGET\u003e/`. If `\u003cTARGET\u003e/` is omitted, environment variable `NDKPKG_DEFAULT_TARGET` would be checked, if this environment variable is not set, then `android-21-arm64-v8a` will be used as the default.\n\n    **Example**:\n\n    ```bash\n    export NDKPKG_DEFAULT_TARGET='android-35-arm64-v8a'\n    ```\n\n- **NDKPKG_FORMULA_SEARCH_DIRS**\n\n    colon-seperated list of directories to search formulas.\n\n\n**Note:** some commonly used environment variables are overridden by this software, these are `CC`, `CXX`, `CPP`, `AS`, `AR`, `LD`, `CFLAGS`, `CPPFLAGS`, `LDFLAGS`, `PKG_CONFIG_LIBDIR`, `PKG_CONFIG_PATH`, `ACLOCAL_PATH`\n\n## ndk-pkg formula scheme\n\nA ndk-pkg formula is a [YAML](https://yaml.org/spec/1.2.2/) format file, which is used to config a ndk-pkg package's meta-information such as one sentence description, package version, installation instructions, etc.\n\nA ndk-pkg formula's filename suffix must be `.yml`\n\nA ndk-pkg formula'a filename prefix would be treated as the package name.\n\nA ndk-pkg formula'a filename prefix must match regular expression pattern `^[A-Za-z0-9+-._@]{1,50}$`\n\nA ndk-pkg formula's file content only has one level mapping and shall/might have the following `KEY`s:\n\n|KEY|TYPE|overview|\n|-|-|-|\n|`pkgtype`|`ENUM`|the type of this package.\u003cbr\u003evalue shall be any one of `exe`, `lib`, `exe+lib`.\u003cbr\u003eIf this mapping is not present, `ndk-pkg` will determine the package type by package name, if the package name starts/ends with `lib` or ends with `-dev`, it would be recognized as type `lib`, otherwise, it would be recognized as type `exe`|\n|`linkage`|`ENUM`|This mapping is only for `exe` type package to specify the executable's link method.\u003cbr\u003evalue shall be any one of `static`, `static/pie`, `shared`, `shared/most`.\u003cbr\u003e`static` indicates this package only support creating fully statically linked executables.\u003cbr\u003e`shared` indicates this package only support creating dynamically linked executables and `ndk-pkg` will try to link as many static libraries as possible.\u003cbr\u003e`shared/most` indicates this package only support creating dynamically linked executables and `ndk-pkg` will try to link as many shared libraries as possible. \u003cbr\u003e`shared` as default if this mapping is not present.|\n|`summary`|`TEXT`|one sentence description of this package.|\n|`license`|`LIST`|A space-separated list of [SPDX license short identifiers](https://spdx.github.io/spdx-spec/v2.3/SPDX-license-list/#a1-licenses-with-short-identifiers)|\n|`version`|`TEXT`|the version of this package.\u003cbr\u003eIf this mapping is not present, it will be calculated from `src-url`, if `src-url` is also not present, it will be calculated from running time as format `date +%Y.%m.%d`|\n||||\n|`web-url`|`URL`|the home webpage of this package.\u003cbr\u003eIf this mapping is not present, if `git-url` mapping is present, use it as `web-url`, if `git-url` mapping is not present, extract from `src-url`.|\n||||\n|`git-url`|`URL`|the source code git repository url.\u003cbr\u003eIf `src-url` is not present, this mapping must be present.|\n|`git-ref`|`TEXT`|reference: \u003chttps://git-scm.com/book/en/v2/Git-Internals-Git-References\u003e \u003cbr\u003eexample values: `HEAD` `refs/heads/master` `refs/heads/main` `refs/tags/v1`, default value is `HEAD`|\n|`git-sha`|`SHA1SUM`|the full git commit id, 40-byte hexadecimal string, if `git-ref` and `git-sha` both are present, `git-sha` takes precedence over `git-ref`|\n|`git-nth`|`INT`|tell `ndk-pkg` that how many depth commits would you like to fetch. default is `1`, this would save your time and storage. If you have to fetch all commits, set this to `0`|\n||||\n|`src-url`|`URI`|the source code download url of this package.\u003cbr\u003eIf value of this mapping ends with one of `.zip` `.tar.xz` `.tar.gz` `.tar.lz` `.tar.bz2` `.tgz` `.txz` `.tlz` `.tbz2` `.crate`, it will be uncompressed to `$PACKAGE_WORKING_DIR/src` while this package is installing, otherwise, it will be copied to `$PACKAGE_WORKING_DIR/src`\u003cbr\u003ealso support format like `dir://DIR`|\n|`src-uri`|`URL`|the mirror of `src-url`.|\n|`src-sha`|`SHA256SUM`|the `sha256sum` of source code.\u003cbr\u003e`src-sha` and `src-url` must appear together.|\n||||\n|`fix-url`|`URL`|the patch file download url of this package.\u003cbr\u003eIf value of this mapping ends with one of `.zip` `.tar.xz` `.tar.gz` `.tar.lz` `.tar.bz2` `.tgz` `.txz` `.tlz` `.tbz2` `.crate`, it will be uncompressed to `$PACKAGE_WORKING_DIR/fix` while this package is installing, otherwise, it will be copied to `$PACKAGE_WORKING_DIR/fix`.|\n|`fix-uri`|`URL`|the mirror of `fix-url`.|\n|`fix-sha`|`SHA256SUM`|the `sha256sum` of patch file.\u003cbr\u003e`fix-sha` and `fix-url` must appear together.|\n|`fix-opt`|`LIST`|A space-separated list of arguments to be passed to `patch` command. default value is `-p1`.|\n||||\n|`patches`|`LIST`|A LF-delimited list of formatted TEXTs. each TEXT has format: `\u003cfix-sha\u003e\\|\u003cfix-url\u003e[\\|fix-uri][\\|fix-opt]`|\n||||\n|`res-url`|`URL`|other resource download url of this package.\u003cbr\u003eIf value of this mapping ends with one of `.zip` `.tar.xz` `.tar.gz` `.tar.lz` `.tar.bz2` `.tgz` `.txz` `.tlz` `.tbz2` `.crate`, it will be uncompressed to `$PACKAGE_WORKING_DIR/res` while this package is installing, otherwise, it will be copied to `$PACKAGE_WORKING_DIR/res`.|\n|`res-uri`|`URL`|the mirror of `res-url`.|\n|`res-sha`|`SHA256SUM`|the `sha256sum` of resource file.\u003cbr\u003e`res-sha` and `res-url` must appear together.|\n||||\n|`reslist`|`LIST`|A LF-delimited list of formatted TEXTs. each TEXT has format: `\u003cres-sha\u003e\\|\u003cres-url\u003e[\\|res-uri][\\|unpack-dir][\\|N]`. `unpack-dir` is relative to `$PACKAGE_WORKING_DIR/res`, default value is empty. `N` is `--strip-components=N`|\n||||\n|`dep-lib`|`LIST`|A space-separated list of `pkg-config` packages needed by this package when installing.\u003cbr\u003eeach of them will be calculated via `pkg-config --libs-only-l ` then passed to the linker.|\n|`dep-pkg`|`LIST`|A space-separated list of   `ndk-pkg packages` depended by this package when installing, which will be installed via [ndk-pkg](https://github.com/leleliu008/ndk-pkg).|\n|`dep-upp`|`LIST`|A space-separated list of   `uppm packages` depended by this package when installing, which will be installed via [uppm](https://github.com/leleliu008/uppm).|\n|`dep-plm`|`LIST`|A space-separated list of    `perl modules` depended by this package when installing, which will be installed via [cpan](https://metacpan.org/dist/CPAN/view/scripts/cpan).|\n|`dep-pip`|`LIST`|A space-separated list of `python packages` depended by this package when installing, which will be installed via [pip](https://github.com/pypa/pip).|\n|`dep-gem`|`LIST`|A space-separated list of    `ruby packages` depended by this package when installing, which will be installed via [gem](https://github.com/rubygems/rubygems).|\n|`dep-npm`|`LIST`|A space-separated list of    `nodejs packages` depended by this package when installing, which will be installed via [npm](https://github.com/npm/cli).|\n||||\n|`ccflags`|`LIST`|A space-separated list of arguments to be passed to the C compiler.|\n|`xxflags`|`LIST`|A space-separated list of arguments to be passed to the C++ compiler.|\n|`ppflags`|`LIST`|A space-separated list of arguments to be passed to the PreProcessor.|\n|`ldflags`|`LIST`|A space-separated list of arguments to be passed to the linker.\u003cbr\u003e`ndk-pkg` supports a custom option `-p\u003cPKG-CONFIG-PACKAGE-NAME\u003e`. It will be substituted by the result of `pkg-config --libs-only-l \u003cPKG-CONFIG-PACKAGE-NAME\u003e`|\n||||\n|`bsystem`|`LIST`|A space-separated list of build system names (e.g. `autogen` `autotools` `configure` `cmake` `cmake+gmake` `cmake+ninja` `meson` `xmake` `gmake` `ninja` `cargo` `cabal` `go` `rake` `ndk-build`)|\n|`bscript`|`PATH`|the directory where the build script is located, relative to `$PACKAGE_WORKING_DIR/src`. build script such as `configure`, `Makefile`, `CMakeLists.txt`, `meson.build`, `Cargo.toml`, etc.|\n|`binbstd`|`BOOL`|whether to build in the directory where the build script is located, otherwise build in other directory.\u003cbr\u003evalue shall be `0` or `1`. default value is `0`.|\n|`ltoable`|`BOOL`|whether support [LTO](https://gcc.gnu.org/wiki/LinkTimeOptimization).\u003cbr\u003evalue shall be `0` or `1`. default value is `1`.|\n|`movable`|`BOOL`|whether the installed files can be moved/copied to other locations.\u003cbr\u003evalue shall be `0` or `1`. default value is `1`.|\n|`parallel`|`BOOL`|whether to allow build system to run jobs in parallel.\u003cbr\u003evalue shall be `0` or `1`. default value is `1`.|\n||||\n|`dofetch`|`CODE`|POSIX shell code to be run to take over the fetching process.\u003cbr\u003eIt would be run in a separate process.\u003cbr\u003e`PWD` is `$PACKAGE_WORKING_DIR`|\n|`do12345`|`CODE`|POSIX shell code to be run for native build.\u003cbr\u003eIt is running in a separated process.|\n|`dopatch`|`CODE`|POSIX shell code to be run to apply patches manually.\u003cbr\u003e`PWD` is `$PACKAGE_BSCRIPT_DIR`|\n|`prepare`|`CODE`|POSIX shell code to be run to do some additional preparation before installing.\u003cbr\u003e`PWD` is `$PACKAGE_BSCRIPT_DIR`|\n|`install`|`CODE`|POSIX shell code to be run when user run `ndk-pkg install \u003cPKG\u003e`.\u003cbr\u003eIf this mapping is not present, `ndk-pkg` will run default install code according to `bsystem`.\u003cbr\u003e`PWD` is `$PACKAGE_BSCRIPT_DIR` if `binbstd` is `0`, otherwise it is `$PACKAGE_BCACHED_DIR`|\n|`dotweak`|`CODE`|POSIX shell code to be run to do some tweaks immediately after installing.\u003cbr\u003e`PWD` is `$PACKAGE_INSTALL_DIR`|\n||||\n|`bindenv`|`LIST`|A LF-delimited list of formatted TEXTs. each TEXT has format: `\u003cENV\u003e=\u003cVALUE\u003e`. `%s` in `\u003cVALUE\u003e` represents the install directory.\u003cbr\u003e`ndk-pkg` will bind these environment variables to executables while you are running `ndk-pkg bundle`.|\n||||\n|`wrapper`|`LIST`|A LF-delimited list of formatted TEXTs. each TEXT has format:  `\u003cSRC\u003e\\|\u003cDST\u003e`. e.g. `bear.c\\|bin/` means that `ndk-pkg` will fetch `bear.c` from https://raw.githubusercontent.com/leleliu008/ndk-pkg-formula-repository-official-core/refs/heads/master/wrappers/bear.c then install it to `$PACKAGE_INSTALL_DIR/bin/` directory.\u003cbr\u003e`ndk-pkg` will use these C source files to build the corresponding wrappers rather than a generic one while you are running `ndk-pkg bundle`.|\n||||\n|`caveats`|`TEXT`|plain text to be displayed after installing.|\n||||\n|`api-min`|`INT`|indicates which minimum [Android SDK API Level](https://apilevels.com/) is supported for this package.|\n\n**Notes:**\n\n- All mappings except `summary` are optional.\n- At least one of `web-url` `git-url` `src-url` mappings should be present.\n- Mappings not listed in the table above will be ignored.\n\n**phases of a package's installation:**\n\n```\n process-0      process-1      process-2      process-3     process-0\n┌─────────┐    ┌─────────┐    ┌─────────┐    ┌─────────┐\n│ dosetup │ -\u003e │ dofetch │ -\u003e │ do12345 │ -\u003e │ dopatch │\n└─────────┘    └─────────┘    └─────────┘    └─────────┘\n                                                  ⬇\n                                             ┌─────────┐\n                                             │ prepare │\n                                             └─────────┘\n                                                  ⬇\n                                             ┌─────────┐\n                                             │ install │\n                                             └─────────┘\n                                                  ⬇\n                                             ┌─────────┐\n                                             │ dotweak │\n                                             └─────────┘\n                                                  ⬇\n                                             ┌─────────┐    ┌─────────┐\n                                             │ docheck │ -\u003e │ caveats │\n                                             └─────────┘    └─────────┘\n```\n\n**commands that can be used out of the box:**\n\n|command|usage-example|\n|-|-|\n|`bash`|[Reference](https://www.gnu.org/software/bash/manual/bash.html)|\n|`CoreUtils`|[Reference](https://www.gnu.org/software/coreutils/manual/coreutils.html)|\n|`xargs`|[Reference](https://www.gnu.org/software/findutils/manual/html_node/find_html/Invoking-xargs.html)|\n|`find`|[Reference](https://www.gnu.org/software/findutils/manual/html_mono/find.html)|\n|`gawk`|[Reference](https://www.gnu.org/software/gawk/manual/gawk.html)|\n|`gsed`|[Reference](https://www.gnu.org/software/sed/manual/sed.html)|\n|`grep`|[Reference](https://www.gnu.org/software/grep/manual/grep.html)|\n|`tree`|[Reference](https://linux.die.net/man/1/tree)|\n|`jq`|[Reference](https://stedolan.github.io/jq/manual/)|\n|`yq`|[Reference](https://mikefarah.gitbook.io/yq/)|\n|`d2`|[Reference](https://github.com/terrastruct/d2)|\n|`dot_static`|[Reference](https://graphviz.org/doc/info/command.html)|\n|`bat`|[Reference](https://github.com/sharkdp/bat)|\n|`xxd`|[Reference](https://raw.githubusercontent.com/vim/vim/master/runtime/doc/xxd.man)|\n|`git`|[Reference](https://git-scm.com/docs/git)|\n|`curl`|[Reference](https://curl.se/docs/manpage.html)|\n|`bsdtar`|[Reference](https://man.archlinux.org/man/core/libarchive/bsdtar.1.en)|\n|`pkg-config`|[Reference](https://people.freedesktop.org/~dbn/pkg-config-guide.html)|\n|`patchelf`|[Reference](https://github.com/NixOS/patchelf)|\n|||\n|`echo`|`echo 'your message.'`|\n|`info`|`info 'your information.'`|\n|`warn`|`warn \"no package manager found.\"`|\n|`error`|`error 'error message.'`|\n|`abort`|`abort 1 \"please specify a package name.\"`|\n|`success`|`success \"build success.\"`|\n|`isInteger`|`isInteger $x \\|\\| abort 1 \"should be an integer.\"`|\n|`isCrossBuild`|`isCrossBuild \u0026\u0026 abort 1 \"This package is not supposed to be cross built.\"`|\n|`wfetch`|`wfetch \u003cURL\u003e [--uri=\u003cURL-MIRROR\u003e] [--sha256=\u003cSHA256\u003e] [-o \u003cPATH\u003e [-q]`|\n|||\n|`configure`|`configure --enable-pic`|\n|`mesonw`|`mesonw -Dneon=disabled -Darm-simd=disabled`|\n|`cmakew`|`cmakew -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON`|\n|`gmakew`|`gmakew`|\n|`xmakew`|`xmakew`|\n|`cargow`|`cargow`|\n|`gow`|`gow`|\n\n**shell variables can be used directly:**\n\n|variable|overview|\n|-|-|\n|`NDKPKG_ARG0`|the 1st arguments of `ndk-pkg` that you've supplied.|\n|`NDKPKG_ARG1`|the 2nd arguments of `ndk-pkg` that you've supplied.|\n|`NDKPKG_ARGV`|the all arguments of `ndk-pkg` that you've supplied.|\n|`NDKPKG_PATH`|the full path of `ndk-pkg` that you're running.|\n|`NDKPKG_HOME`|the home directory of `ndk-pkg` that you're running.|\n|`NDKPKG_VERSION`|the version of `ndk-pkg` that you're running.|\n|||\n|`UPPM`|the executable filepath of [uppm](https://github.com/leleliu008/uppm)|\n|||\n|`TIMESTAMP_UNIX`|the unix timestamp of this action.|\n|||\n|`NATIVE_PLATFORM_KIND`|current running os kind. value might be `linux` or `darwin`|\n|`NATIVE_PLATFORM_TYPE`|current running os type. value might be `linux` or `macos`|\n|`NATIVE_PLATFORM_NAME`|current running os name. value might be `Ubuntu`, `macOS`, etc|\n|`NATIVE_PLATFORM_VERS`|current running os version.|\n|`NATIVE_PLATFORM_ARCH`|current running os arch. value might be any one of `x86_64`, `arm64`, etc|\n|`NATIVE_PLATFORM_NCPU`|current running os's cpu core count.|\n|`NATIVE_PLATFORM_EUID`|current running os's effective user ID.|\n|`NATIVE_PLATFORM_EGID`|current running os's effective group ID.|\n|||\n|`TARGET_PLATFORM_VERS`|[android sdk api-level table](https://developer.android.google.cn/guide/topics/manifest/uses-sdk-element#api-level-table)|\n|`TARGET_PLATFORM_NBIT`|value shall be any one of `32` `64`|\n|`TARGET_PLATFORM_ARCH`|value shall be any one of `armv7a` `aarch64` `i686` `x86_64`|\n|`TARGET_PLATFORM_ABI`|value shall be any one of `armeabi-v7a` `arm64-v8a` `x86` `x86_64`|\n|`TARGET_TRIPLE`|value shall be any one of `armv7a-linux-androideabi` `aarch64-linux-android` `i686-linux-android` `x86_64-linux-android`|\n|||\n|`ANDROID_NDK_HOME`|the home directory of `Android NDK`.|\n|`ANDROID_NDK_ROOT`|the home directory of `Android NDK`.|\n|`ANDROID_NDK_VERSION`|the version of `Android NDK`.|\n|`ANDROID_NDK_VERSION_MAJOR`|the major part of version of `Android NDK`.|\n|`ANDROID_NDK_TOOLCHAIN_BIND`|the `bin` directory of `Android NDK`.|\n|`ANDROID_NDK_SYSROOT`|the `sysroot` directory of `Android NDK`.|\n|||\n|`CC_FOR_BUILD`|the C Compiler for native build.|\n|`CFLAGS_FOR_BUILD`|the flags of `CC_FOR_BUILD`.|\n|`CXX_FOR_BUILD`|the C++ Compiler for native build.|\n|`CXXFLAGS_FOR_BUILD`|the flags of `CXX_FOR_BUILD`.|\n|`CPP_FOR_BUILD`|the C/C++ PreProcessor for native build.|\n|`CPPFLAGS_FOR_BUILD`|the flags of `CPP_FOR_BUILD`.|\n|`AS_FOR_BUILD`|the assembler for native build.|\n|`AR_FOR_BUILD`|the archiver for native build.|\n|`RANLIB_FOR_BUILD`|the archiver extra tool for native build.|\n|`LD_FOR_BUILD`|the linker for native build.|\n|`LDFLAGS_FOR_BUILD`|the flags of `LD_FOR_BUILD`.|\n|`NM_FOR_BUILD`|a command line tool to list symbols from object files for native build.|\n|`STRIP_FOR_BUILD`|a command line tool to discard symbols and other data from object files for native build.|\n|||\n|`CC`|the C Compiler.|\n|`CFLAGS`|the flags of `CC`.|\n|`CXX`|the C++ Compiler.|\n|`CXXFLAGS`|the flags of `CXX`.|\n|`CPP`|the C/C++ PreProcessor.|\n|`CPPFLAGS`|the flags of `CPP`.|\n|`AS`|the assembler.|\n|`AR`|the archiver.|\n|`RANLIB`|the archiver extra tool.|\n|`LD`|the linker.|\n|`LDFLAGS`|the flags of `LD`.|\n|`NM`|a command line tool to list symbols from object files.|\n|`STRIP`|a command line tool to discard symbols and other data from object files.|\n|||\n|`PACKAGE_WORKING_DIR`|the working directory for installing.|\n|`PACKAGE_BSCRIPT_DIR`|the directory where the build script (e.g. `Makefile`, `configure`, `CMakeLists.txt`, `meson.build`, `Cargo.toml`, etc) is located.|\n|`PACKAGE_BCACHED_DIR`|the directory where the temporary files are stored in when building.|\n|`PACKAGE_INSTALL_DIR`|the directory where the final files will be installed to.|\n|||\n|`x_INSTALL_DIR`|the installation directory of x package.|\n|`x_INCLUDE_DIR`|`$x_INSTALL_DIR/include`|\n|`x_LIBRARY_DIR`|`$x_INSTALL_DIR/lib`|\n\n## build system name and corresponding build script file name\n\n|build system name|build script file name|\n|-|-|\n|`meson`|`meson.build`|\n|`cmake`|`CMakeLists.txt`|\n|`gmake`|`GNUMakefile` or `Makefile`|\n|`ninja`|`build.ninja`|\n|`xmake`|`xmake.lua`|\n|`cargo`|`Cargo.toml`|\n|`go`|`go.mod`|\n|`gn`|`BUILD.gn`|\n|`rake`|`Rakefile`|\n|`autogen`|`autogen.sh`|\n|`autotools`|`configure.ac`|\n|`configure`|`configure`|\n|`ndk-build`|`Android.mk`|\n\n## ndk-pkg formula repository\n\nA typical hierarchical structure of a ndk-pkg formula repository looks like below:\n\n```\nNDKPKGFormulaRepoName\n├── formula\n│   ├── packageA.yml\n│   └── packageB.yml\n├── LICENSE\n└── README.md\n```\n\n## ndk-pkg formula repository local location\n\n`${NDKPKG_HOME}/repos.d/${NDKPKGFormulaRepoName}`\n\n## ndk-pkg formula repository local config\n\nA ndk-pkg formula repository's config file is located at `${NDKPKG_HOME}/repos.d/${NDKPKGFormulaRepoName}/.ndk-pkg-formula-repo.yml`\n\nA typical ndk-pkg formula repository's config file content looks like below:\n\n```yaml\nurl: https://github.com/leleliu008/ndk-pkg-formula-repository-official-core\nbranch: master\npinned: 0\nenabled: 1\ncreated: 1673684639\nupdated: 1673684767\n```\n\nIf a ndk-pkg formula repository is `pinned`, it would not be updated.\n\nIf a ndk-pkg formula repository is `disabled`, it would not be searched.\n\n## ndk-pkg formula repository management\n\nrun `ndk-pkg formula-repo-add ` command to create a new formula repository locally.\n\n## ndk-pkg official formula repository\n\nndk-pkg official formula repository is hosted at \u003chttps://github.com/leleliu008/ndk-pkg-formula-repository-official-core\u003e\n\nIt would be automatically fetched to your local repository as name `official-core` when you run `ndk-pkg update` command.\n\n**Note:** If you find that a package is not in ndk-pkg official formula repository yet, PR is welcomed.\n\n## Using my prefab aars that have been published to GitHub-Hosted Maven Repository alongside with Android Gradle Plugin\n\nI have published some commonly used packages as google prefab aar to \u003chttps://github.com/leleliu008/ndk-pkg-prefab-aar-maven-repo\u003e\n\n## Using my prefab aars that have been published to Maven Central Repository alongside with Android Gradle Plugin\n\nI have published some commonly used packages as google prefab aar to `Maven Central Repository`.\n\nTo get the full list of my published packages, please visit the following websites:\n\n- \u003chttps://repo1.maven.org/maven2/com/fpliu/ndk/pkg/prefab/android/21/\u003e\n- \u003chttps://search.maven.org/search?q=com.fpliu.ndk.pkg.prefab\u003e\n\nIn the next two sections, I will show you how to configure with `Android Gradle Plugin` in `Kotlin DSL` and `Groovy DSL` respectively.\n\n## configure with Android Gradle Plugin Kotlin DSL\n\n**step1. enable prefab feature for Android Gradle Plugin**\n\n```gradle\nandroid {\n    buildFeatures {\n        prefab = true\n    }\n}\n```\n\n**step2. enable `Maven Central Repository` for Gradle**\n\n```gradle\nallprojects {\n    repositories {\n        maven {\n            mavenCentral()\n        }\n    }\n}\n```\n\n中国大陆的用户可使用如下配置：\n\n```gradle\nallprojects {\n    repositories {\n        maven {\n            maven { url = uri(\"https://maven.aliyun.com/repository/public\") }\n        }\n    }\n}\n```\n\n**step3. add dependencies in build.gradle.kts**\n\nEvery package's coordinate for Gradle is `com.fpliu.ndk.pkg.prefab.android.21:\u003cPACKAGE-NAME\u003e:\u003cPACKAGE-VERSION\u003e`, for example, `libpng` package has a version `1.6.37`, we could use it as follows:\n\n```gradle\ndependencies {\n    implementation (\"com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37\")\n}\n```\n\n**step4. invoke [find_package(PACKAGE-NAME [REQUIRED] CONFIG)](https://cmake.org/cmake/help/latest/command/find_package.html) command in your Android project's CMakeLists.txt**\n\nEvery package provides several cmake imported targets:\n\n|TARGET-NAME|example|summary|\n|-|-|-|\n|`\u003cPACKAGE-NAME\u003e::headers`|`libpng::headers`|C/C++ header files only|\n|`\u003cPACKAGE-NAME\u003e::lib*.a`|`libpng::libpng16.a`|static library|\n|`\u003cPACKAGE-NAME\u003e::lib*.so`|`libpng::libpng16.so`|shared library|\n|`\u003cPACKAGE-NAME\u003e::*`|`libpng::libpng`|base on .pc files|\n\nFollowing is a piece of codes show you how to link `libpng.a` which is provided by `libpng` package:\n\n```cmake\nfind_package(libpng REQUIRED CONFIG)\ntarget_link_libraries(app libpng::libpng.a)\n```\n\nor\n\n```cmake\nfind_package(libpng CONFIG)\nif (libpng_FOUND)\n    target_link_libraries(app libpng::libpng.a)\nendif()\n```\n\n**step5. configure C++ standard and STL in build.gradle.kts**\n\n```gradle\nandroid {\n    defaultConfig {\n        externalNativeBuild {\n            cmake {\n                arguments += \"-DANDROID_STL=c++_shared\"\n                cppFlags  += \"-std=c++17\"\n            }\n        }\n    }\n}\n```\n\n**Note:**\n\n- This step is only required for packages that use `libc++`.\n- If you link a shared library that depends on `libc++_shared.so`, then your Android app should use `libc++_shared.so` too.\n\n## configure with Android Gradle Plugin Groovy DSL\n\n**step1. enable prefab feature for Android Gradle Plugin**\n\n```gradle\nandroid {\n    buildFeatures {\n        prefab true\n    }\n}\n```\n\n**step2. enable `Maven Central Repository` for Gradle**\n\n```gradle\nallprojects {\n    repositories {\n        maven {\n            mavenCentral()\n        }\n    }\n}\n```\n\n中国大陆的用户可使用如下配置：\n\n```gradle\nallprojects {\n    repositories {\n        maven {\n            url 'https://maven.aliyun.com/repository/public'\n        }\n    }\n}\n```\n\n**step3. add dependencies in build.gradle**\n\nEvery package's coordinate for Gradle is `com.fpliu.ndk.pkg.prefab.android.21:\u003cPACKAGE-NAME\u003e:\u003cPACKAGE-VERSION\u003e`, for example, `libpng` package has a version `1.6.37`, we could use it as follows:\n\n```gradle\ndependencies {\n    implementation 'com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37'\n}\n```\n\n**step4. invoke [find_package(PACKAGE-NAME [REQUIRED] CONFIG)](https://cmake.org/cmake/help/latest/command/find_package.html) command in your Android project's CMakeLists.txt**\n\nEvery package provides several cmake imported targets:\n\n|TARGET-NAME|example|summary|\n|-|-|-|\n|`\u003cPACKAGE-NAME\u003e::headers`|`libpng::headers`|C/C++ header files only|\n|`\u003cPACKAGE-NAME\u003e::lib*.a`|`libpng::libpng16.a`|static library|\n|`\u003cPACKAGE-NAME\u003e::lib*.so`|`libpng::libpng16.so`|shared library|\n|`\u003cPACKAGE-NAME\u003e::*`|`libpng::libpng`|base on .pc files|\n\nFollowing is a piece of codes show you how to link `libpng.a` which is provided by `libpng` package:\n\n```cmake\nfind_package(libpng REQUIRED CONFIG)\ntarget_link_libraries(app libpng::libpng.a)\n```\n\nor\n\n```cmake\nfind_package(libpng CONFIG)\nif (libpng_FOUND)\n    target_link_libraries(app libpng::libpng.a)\nendif()\n```\n\n**step5. configure C++ standard and STL in build.gradle**\n\n```gradle\nandroid {\n    defaultConfig {\n        externalNativeBuild {\n            cmake {\n                arguments '-DANDROID_STL=c++_shared'\n                cppFlags  '-std=c++17'\n            }\n        }\n    }\n}\n```\n\n**Note:**\n\n- This step is only required for packages that use `libc++`.\n- If you link a shared library that depends on `libc++_shared.so`, then your Android app should use `libc++_shared.so` too.\n\n**References:**\n\n- \u003chttps://google.github.io/prefab/\u003e\n- \u003chttps://developer.android.com/studio/projects/android-library#aar-contents\u003e\n- \u003chttps://developer.android.com/studio/build/dependencies?agpversion=4.1#using-native-dependencies\u003e\n\n**Examples:**\n\n- \u003chttps://github.com/leleliu008/android-calendar-for-the-aged\u003e\n\n## Create the google prefab aar then deploy it to Maven Local Repository and use it alongside with Android Gradle Plugin\n\nIf my published packages don't meet your needs, you can use this software to install packages then deploy them to `Maven Local Repository`.\n\nIn the next two sections, I will show you how to configure with `Android Gradle Plugin` in `Kotlin DSL` and `Groovy DSL` respectively.\n\n## configure with Android Gradle Plugin Kotlin DSL\n\n**step1. build and install libpng**\n\nSuppose you want to build and install `libpng`, the following command will build `libpng` with `android-35` API and build for `arm64-v8a` and `armeabi-v7a` ABI respectively.\n\n```bash\nndk-pkg install android-35-arm64-v8a,armeabi-v7a/libpng\n```\n\n**step2. export the installed libpng package as the google prefab aar and deploy it to your Maven Local Repository**\n\n```bash\nndk-pkg deploy  android-35-arm64-v8a,armeabi-v7a/libpng\n```\n\n**step3. enable prefab feature for Android Gradle Plugin**\n\n```gradle\nandroid {\n    buildFeatures {\n        prefab = true\n    }\n}\n```\n\n**step4. enable `Maven Local Repository` for Gradle**\n\n```gradle\nallprojects {\n    repositories {\n        maven {\n            mavenLocal()\n        }\n    }\n}\n```\n\n**step5. add dependencies in build.gradle.kts**\n\nEvery package's coordinate for Gradle is `com.fpliu.ndk.pkg.prefab.android.21:\u003cPACKAGE-NAME\u003e:\u003cPACKAGE-VERSION\u003e`, for example, `libpng` package has a version `1.6.37`, we could use it as follows:\n\n```gradle\ndependencies {\n    implementation (\"com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37\")\n}\n```\n\n**step6. invoke [find_package(PACKAGE-NAME [REQUIRED] CONFIG)](https://cmake.org/cmake/help/latest/command/find_package.html) command in your Android project's CMakeLists.txt**\n\nEvery package provides several cmake imported targets:\n\n|TARGET-NAME|example|summary|\n|-|-|-|\n|`\u003cPACKAGE-NAME\u003e::headers`|`libpng::headers`|C/C++ header files only|\n|`\u003cPACKAGE-NAME\u003e::lib*.a`|`libpng::libpng16.a`|static library|\n|`\u003cPACKAGE-NAME\u003e::lib*.so`|`libpng::libpng16.so`|shared library|\n|`\u003cPACKAGE-NAME\u003e::*`|`libpng::libpng`|base on .pc files|\n\nFollowing is a piece of codes show you how to link `libpng.a` which is provided by `libpng` package:\n\n```cmake\nfind_package(libpng REQUIRED CONFIG)\ntarget_link_libraries(app libpng::libpng.a)\n```\n\nor\n\n```cmake\nfind_package(libpng CONFIG)\nif (libpng_FOUND)\n    target_link_libraries(app libpng::libpng.a)\nendif()\n```\n\n**step7. configure C++ standard and STL in build.gradle.kts**\n\n```gradle\nandroid {\n    defaultConfig {\n        externalNativeBuild {\n            cmake {\n                arguments += \"-DANDROID_STL=c++_shared\"\n                cppFlags  += \"-std=c++17\"\n            }\n        }\n    }\n}\n```\n\n**Note:**\n\n- This step is only required for packages that use `libc++`.\n- If you link a shared library that depends on `libc++_shared.so`, then your Android app should use `libc++_shared.so` too.\n\n## configure with Android Gradle Plugin Groovy DSL\n\n**step1. build and install libpng**\n\nSuppose you want to build and install `libpng`, the following command will build `libpng` with `android-35` API and build for `arm64-v8a` and `armeabi-v7a` ABI respectively.\n\n```bash\nndk-pkg install android-35-arm64-v8a,armeabi-v7a/libpng\n```\n\n**step2. export the installed libpng package as the google prefab aar and deploy it to your Maven Local Repository**\n\n```bash\nndk-pkg deploy  android-35-arm64-v8a,armeabi-v7a/libpng\n```\n\n**step3. enable prefab feature for Android Gradle Plugin**\n\n```gradle\nandroid {\n    buildFeatures {\n        prefab true\n    }\n}\n```\n\n**step4. enable `Maven Local Repository` for Gradle**\n\n```gradle\nallprojects {\n    repositories {\n        maven {\n            mavenLocal()\n        }\n    }\n}\n```\n\n**step5. add dependencies in build.gradle**\n\nEvery package's coordinate for Gradle is `com.fpliu.ndk.pkg.prefab.android.21:\u003cPACKAGE-NAME\u003e:\u003cPACKAGE-VERSION\u003e`, for example, `libpng` package has a version `1.6.37`, we could use it as follows:\n\n```gradle\ndependencies {\n    implementation 'com.fpliu.ndk.pkg.prefab.android.21:libpng:1.6.37'\n}\n```\n\n**step6. invoke [find_package(PACKAGE-NAME [REQUIRED] CONFIG)](https://cmake.org/cmake/help/latest/command/find_package.html) command in your Android project's CMakeLists.txt**\n\nEvery package provides several cmake imported targets:\n\n|TARGET-NAME|example|summary|\n|-|-|-|\n|`\u003cPACKAGE-NAME\u003e::headers`|`libpng::headers`|C/C++ header files only|\n|`\u003cPACKAGE-NAME\u003e::lib*.a`|`libpng::libpng16.a`|static library|\n|`\u003cPACKAGE-NAME\u003e::lib*.so`|`libpng::libpng16.so`|shared library|\n|`\u003cPACKAGE-NAME\u003e::*`|`libpng::libpng`|base on .pc files|\n\nFollowing is a piece of codes show you how to link `libpng.a` which is provided by `libpng` package:\n\n```cmake\nfind_package(libpng REQUIRED CONFIG)\ntarget_link_libraries(app libpng::libpng.a)\n```\n\nor\n\n```cmake\nfind_package(libpng CONFIG)\nif (libpng_FOUND)\n    target_link_libraries(app libpng::libpng.a)\nendif()\n```\n\n**step7. configure C++ standard and STL in build.gradle**\n\n```gradle\nandroid {\n    defaultConfig {\n        externalNativeBuild {\n            cmake {\n                arguments '-DANDROID_STL=c++_shared'\n                cppFlags  '-std=c++17'\n            }\n        }\n    }\n}\n```\n\n**Note:**\n\n- This step is only required for packages that use `libc++`.\n- If you link a shared library that depends on `libc++_shared.so`, then your Android app should use `libc++_shared.so` too.\n\n**References:**\n\n- \u003chttps://github.com/google/prefab\u003e\n- \u003chttps://developer.android.com/studio/projects/android-library#aar-contents\u003e\n- \u003chttps://developer.android.com/studio/build/dependencies?agpversion=4.1#using-native-dependencies\u003e\n\n**Examples:**\n\n- \u003chttps://github.com/leleliu008/ndk-pkg-prefab-example-ffmpeg\u003e\n- \u003chttps://github.com/leleliu008/ndk-pkg-prefab-example-libphonenumber\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleleliu008%2Fndk-pkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleleliu008%2Fndk-pkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleleliu008%2Fndk-pkg/lists"}