{"id":16867073,"url":"https://github.com/leleliu008/ppkg","last_synced_at":"2025-03-17T05:32:45.487Z","repository":{"id":58040149,"uuid":"369439887","full_name":"leleliu008/ppkg","owner":"leleliu008","description":"A portable package builder/manager for Unix-like system.","archived":false,"fork":false,"pushed_at":"2024-10-23T08:34:19.000Z","size":2230,"stargazers_count":25,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-23T13:52:23.514Z","etag":null,"topics":["cli","package-manager","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","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}},"created_at":"2021-05-21T06:45:54.000Z","updated_at":"2024-10-23T08:34:23.000Z","dependencies_parsed_at":"2023-12-01T18:27:01.014Z","dependency_job_id":"0ab67b9f-553c-48ea-b363-1a403ef4b613","html_url":"https://github.com/leleliu008/ppkg","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fppkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fppkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fppkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leleliu008%2Fppkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leleliu008","download_url":"https://codeload.github.com/leleliu008/ppkg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243846978,"owners_count":20357297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cli","package-manager","shell"],"created_at":"2024-10-13T14:52:41.424Z","updated_at":"2025-03-17T05:32:45.472Z","avatar_url":"https://github.com/leleliu008.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ppkg\n\nA portable package builder/manager for Unix-like system.\n\n## Caveats\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 `~/.ppkg` directory, as `ppkg` will change files under `~/.ppkg` directory without notice.\n\n- Please do NOT run `ppkg` command in parallel so as not to generate dirty data.\n\n## Two implementations\n\nThis software provides two implementations:\n\n|implemented in language|branch|\n|-|-|\n|implemented in `POSIX Shell`|[master](https://github.com/leleliu008/ppkg/tree/master)|\n|implemented in `C`|[c](https://github.com/leleliu008/ppkg/tree/c)|\n\nIn theroy, these two implementations should have the same behaver except for have bugs.\n\n## Using ppkg via GitHub Actions\n\nIn this way, you will be liberated from the rut of setting up the build environmemt.\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/ppkg-package-manually-build\u003e\n\n## Install POSIX-Shell-based ppkg via curl\n\n```bash\ncurl -LO https://raw.githubusercontent.com/leleliu008/ppkg/master/ppkg\nchmod a+x ppkg\n./ppkg setup\n```\n\n## Install POSIX-Shell-based ppkg via wget\n\n```bash\nwget https://cdn.jsdelivr.net/gh/leleliu008/ppkg/ppkg\nchmod a+x ppkg\n./ppkg setup\n```\n\n## Build from C source locally dependencies\n\n|dependency|required?|purpose|\n|----|---------|-------|\n|[GCC](https://gcc.gnu.org/) or [LLVM+clang](https://llvm.org/)|required |for compiling C source code|\n|[cmake](https://cmake.org/)|required |for generating `build.ninja`|\n|[ninja](https://ninja-build.org/)|required |for doing jobs that read from `build.ninja`|\n|[pkg-config\u003e=0.18](https://www.freedesktop.org/wiki/Software/pkg-config/)|required|for finding libraries|\n||||\n|[jansson](https://github.com/akheron/jansson)|required|for parsing and creating JSON.|\n|[libyaml](https://github.com/yaml/libyaml/)|required|for parsing formula files whose format is YAML.|\n|[libgit2](https://libgit2.org/)|required|for updating formula repositories.|\n|[libcurl](https://curl.se/)|required|for http requesting support.|\n|[openssl](https://www.openssl.org/)|required|for https requesting support and SHA-256 sum checking support.|\n|[libarchive](https://www.libarchive.org/)|required|for uncompressing .zip and .tar.* files.|\n|[zlib](https://www.zlib.net/)|required|for compress and uncompress data.|\n|[pcre2](https://www.pcre.org/)||for Regular Expressions support. only required on OpenBSD.|\n\n## Build from C source locally via [ppkg](https://github.com/leleliu008/ppkg)\n\n```bash\nppkg install ppkg\n```\n\n## Build from C source locally via [xcpkg](https://github.com/leleliu008/xcpkg)\n\n```bash\nxcpkg install ppkg\n```\n\n## Build from C source locally using [vcpkg](https://github.com/microsoft/vcpkg)\n\n```bash\n# install g++ curl zip unzip tar git\n\ngit clone https://github.com/microsoft/vcpkg.git\ncd vcpkg\n./bootstrap-vcpkg.sh\nexport VCPKG_ROOT=\"$PWD/vcpkg\"\nexport PATH=\"$VCPKG_ROOT:$PATH\"\n\nvcpkg install curl openssl libgit2 libarchive libyaml jansson\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake\ncmake --build   build.d\ncmake --install build.d\n```\n\n## Build from C source locally via [HomeBrew](https://brew.sh/)\n\n```bash\nbrew install --HEAD leleliu008/fpliu/ppkg\n```\n\n## Build from C source locally using your system's default package manager\n\n**[Ubuntu](https://ubuntu.com/)**\n\n```bash\napt -y update\napt -y install git cmake ninja-build pkg-config gcc libcurl4 libcurl4-openssl-dev libgit2-dev libarchive-dev libyaml-dev libjansson-dev zlib1g-dev\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[Fedora](https://getfedora.org/)**\n\n```bash\ndnf -y update\ndnf -y install git cmake ninja-build pkg-config gcc libcurl-devel libgit2-devel libarchive-devel libyaml-devel jansson-devel zlib-devel\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[ArchLinux](https://archlinux.org/)**\n\n```bash\npacman -Syyuu --noconfirm\npacman -S     --noconfirm git cmake ninja pkg-config gcc curl openssl libgit2 libarchive libyaml jansson zlib\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[AlpineLinux](https://www.alpinelinux.org/)**\n\n```bash\napk add git cmake ninja pkgconf gcc libc-dev curl-dev openssl-dev libgit2-dev libarchive-dev yaml-dev jansson-dev zlib-dev\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[VoidLinux](https://voidlinux.org/)**\n\n```bash\nxbps-install -Suy xbps\nxbps-install -Suy cmake ninja gcc pkg-config libcurl-devel libgit2-devel libarchive-devel libyaml-devel jansson-devel zlib-devel\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[Gentoo Linux](https://www.gentoo.org/)**\n\n```bash\nemerge dev-vcs/git cmake dev-util/ninja gcc pkg-config net-misc/curl dev-libs/libgit2 libarchive dev-libs/libyaml dev-libs/jansson dev-libs/zlib\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[openSUSE](https://www.opensuse.org/)**\n\n```bash\nzypper update  -y\nzypper install -y git cmake ninja gcc pkg-config libcurl-devel libgit2-devel libarchive-devel libyaml-devel libjansson-devel zlib-devel\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[FreeBSD](https://www.freebsd.org/)** and **[DragonFlyBSD](https://www.dragonflybsd.org/)**\n\n```bash\npkg install -y git cmake ninja pkgconf gcc curl openssl libgit2 libarchive libyaml jansson zlib\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[OpenBSD](https://www.openbsd.org/)**\n\n```bash\npkg_add git cmake ninja pkgconf llvm curl libgit2 libarchive libyaml jansson zlib\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n**[NetBSD](https://www.netbsd.org/)**\n\n```bash\npkgin -y install git mozilla-rootcerts cmake ninja-build pkg-config clang curl openssl libgit2 libarchive libyaml jansson zlib\n\nmozilla-rootcerts install\n\ngit clone --depth=1 --branch=c https://github.com/leleliu008/ppkg\ncd ppkg\n\ncmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local\ncmake --build   build.d\ncmake --install build.d\n```\n\n## ~/.ppkg\n\nall relevant directories and files are located under `~/.ppkg` directory.\n\n## ppkg command usage\n\n- **show help of this command**\n\n    ```bash\n    ppkg -h\n    ppkg --help\n    ```\n\n- **show version of this command**\n\n    ```bash\n    ppkg -V\n    ppkg --version\n    ```\n\n- **generate url-transform sample**\n\n    ```bash\n    ppkg gen-url-transform-sample\n    ```\n\n- **install essential tools**\n\n    ```bash\n    ppkg setup\n    ```\n\n    This command is actually to do two things:\n\n  - install [uppm](https://github.com/leleliu008/uppm) to `~/.ppkg/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    - [sysinfo](https://github.com/leleliu008/C-examples/tree/master/utils/sysinfo)\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    - [jq](https://stedolan.github.io/jq/manual/)\n    - [yq](https://mikefarah.gitbook.io/yq/)\n    - [d2](https://github.com/terrastruct/d2)\n    - [fzf](https://github.com/junegunn/fzf)\n    - [bat](https://github.com/sharkdp/bat)\n    - [xxd](https://raw.githubusercontent.com/vim/vim/master/runtime/doc/xxd.man)\n\n- **show basic information about this software**\n\n    ```bash\n    ppkg about\n    ```\n\n- **show basic information about your current running operation system**\n\n    ```bash\n    ppkg sysinfo\n    ```\n\n- **integrate `zsh-completion` script**\n\n    ```bash\n    ppkg integrate zsh\n    ppkg integrate zsh --output-dir=/usr/local/share/zsh/site-functions\n    ppkg integrate zsh -v\n    ```\n\n    This software provides a zsh-completion script for `ppkg`. when you've typed `ppkg` 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- **update all available formula repositories**\n\n    ```bash\n    ppkg update\n    ```\n\n- **list all available formula repositories**\n\n    ```bash\n    ppkg formula-repo-list\n    ```\n\n- **create a new empty formula repository**\n\n    ```bash\n    ppkg formula-repo-init my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo\n    ppkg formula-repo-init my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --branch=master\n    ppkg formula-repo-init my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --branch=main --pin\n    ppkg formula-repo-init my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --unpin --disable\n    ppkg formula-repo-init my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --enable\n    ```\n\n- **create a new empty formula repository then sync with server**\n\n    ```bash\n    ppkg formula-repo-add my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo\n    ppkg formula-repo-add my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --branch=master\n    ppkg formula-repo-add my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --branch=main --pin\n    ppkg formula-repo-add my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --unpin --disable\n    ppkg formula-repo-add my_repo https://github.com/leleliu008/ppkg-formula-repository-my_repo --enable\n    ```\n\n- **delete the given formula repository**\n\n    ```bash\n    ppkg formula-repo-del my_repo\n    ```\n\n- **sync the given formula repository with server**\n\n    ```bash\n    ppkg formula-repo-sync my_repo\n    ```\n\n- **show information of the given formula repository**\n\n    ```bash\n    ppkg formula-repo-info my_repo\n    ```\n\n- **change the config of the given formula repository**\n\n    ```bash\n    ppkg formula-repo-conf my_repo --url=https://github.com/leleliu008/ppkg-formula-repository-my_repo\n    ppkg formula-repo-conf my_repo --branch=main\n    ppkg formula-repo-conf my_repo --pin\n    ppkg formula-repo-conf my_repo --unpin\n    ppkg formula-repo-conf my_repo --enable\n    ppkg formula-repo-conf my_repo --disable\n    ```\n\n- **search all available packages whose name matches the given regular expression partten**\n\n    ```bash\n    ppkg search curl\n    ppkg search curl -v\n    ppkg search curl -p macos\n    ```\n\n- **show information of the given available package**\n\n    ```bash\n    ppkg info-available curl\n    ppkg info-available curl --yaml\n    ppkg info-available curl --json\n    ppkg info-available curl version\n    ppkg info-available curl license\n    ppkg info-available curl summary\n    ppkg info-available curl web-url\n    ppkg info-available curl git-url\n    ppkg info-available curl git-sha\n    ppkg info-available curl git-ref\n    ppkg info-available curl src-url\n    ppkg info-available curl src-sha\n    ```\n\n- **show information of the given installed package**\n\n    ```bash\n    ppkg info-installed freebsd-13.2-amd64/curl\n    ppkg info-installed freebsd-13.2-amd64/curl --prefix\n    ppkg info-installed freebsd-13.2-amd64/curl --files\n    ppkg info-installed freebsd-13.2-amd64/curl --yaml\n    ppkg info-installed freebsd-13.2-amd64/curl --json\n    ppkg info-installed freebsd-13.2-amd64/curl version\n    ppkg info-installed freebsd-13.2-amd64/curl license\n    ppkg info-installed freebsd-13.2-amd64/curl summary\n    ppkg info-installed freebsd-13.2-amd64/curl web-url\n    ppkg info-installed freebsd-13.2-amd64/curl git-url\n    ppkg info-installed freebsd-13.2-amd64/curl git-sha\n    ppkg info-installed freebsd-13.2-amd64/curl git-ref\n    ppkg info-installed freebsd-13.2-amd64/curl src-url\n    ppkg info-installed freebsd-13.2-amd64/curl src-sha\n    ppkg info-installed freebsd-13.2-amd64/curl builtat\n    ppkg info-installed freebsd-13.2-amd64/curl builtat-iso-8601\n    ppkg info-installed freebsd-13.2-amd64/curl builtat-rfc-3339\n    ppkg info-installed freebsd-13.2-amd64/curl builtat-iso-8601-utc\n    ppkg info-installed freebsd-13.2-amd64/curl builtat-rfc-3339-utc\n    ```\n\n- **show packages that are depended by the given package**\n\n    ```bash\n    ppkg depends curl\n\n    ppkg depends curl -t d2\n    ppkg depends curl -t dot\n    ppkg depends curl -t box\n    ppkg depends curl -t png\n    ppkg depends curl -t svg\n\n    ppkg depends curl -o curl-dependencies.d2\n    ppkg depends curl -o curl-dependencies.dot\n    ppkg depends curl -o curl-dependencies.txt\n    ppkg depends curl -o curl-dependencies.png\n    ppkg depends curl -o curl-dependencies.svg\n\n    ppkg depends curl -t d2  -o dependencies/\n    ppkg depends curl -t dot -o dependencies/\n    ppkg depends curl -t box -o dependencies/\n    ppkg depends curl -t png -o dependencies/\n    ppkg depends curl -t svg -o dependencies/\n    ```\n\n- **download resources of the given package to the local cache**\n\n    ```bash\n    ppkg fetch curl\n    ppkg fetch curl -v\n    ```\n\n- **install the given packages**\n\n    ```bash\n    ppkg install curl\n    ppkg install curl bzip2 -v\n    ```\n\n    **Note:** C and C++ compiler should be installed by yourself using your system's default package manager before running this command.\n\n- **reinstall the given packages**\n\n    ```bash\n    ppkg reinstall curl\n    ppkg reinstall curl bzip2 -v\n    ```\n\n- **uninstall the given packages**\n\n    ```bash\n    ppkg uninstall curl\n    ppkg uninstall curl bzip2 -v\n    ```\n\n- **upgrade the outdated packages**\n\n    ```bash\n    ppkg upgrade\n    ppkg upgrade curl\n    ppkg upgrade curl bzip2 -v\n    ```\n\n- **upgrade this software**\n\n    ```bash\n    ppkg upgrade-self\n    ppkg upgrade-self -v\n    ```\n\n- **check if the given package is available**\n\n    ```bash\n    ppkg is-available curl -p macos\n    ```\n\n- **check if the given package is installed**\n\n    ```bash\n    ppkg is-installed curl\n    ```\n\n- **check if the given package is outdated**\n\n    ```bash\n    ppkg is-outdated  curl\n    ```\n\n- **list all available packages**\n\n    ```bash\n    ppkg ls-available\n    ppkg ls-available -v\n    ppkg ls-available -p macos\n    ```\n\n- **list all installed packages**\n\n    ```bash\n    ppkg ls-installed\n    ppkg ls-installed -v\n    ppkg ls-installed --target=linux-musl-x86_64\n    ```\n\n- **list all outdated packages**\n\n    ```bash\n    ppkg ls-outdated\n    ppkg ls-outdated -v\n    ppkg ls-outdated --target=linux-musl-x86_64\n    ```\n\n- **list installed files of the given installed package in a tree-like format**\n\n    ```bash\n    ppkg tree curl\n    ppkg tree curl -L 3\n    ```\n\n- **show logs of the given installed package**\n\n    ```bash\n    ppkg logs curl\n    ```\n\n- **bundle the given installed package into a single archive file**\n\n    ```bash\n    ppkg bundle curl .tar.gz\n    ppkg bundle curl .tar.xz\n    ppkg bundle curl .tar.lz\n    ppkg bundle curl .tar.bz2\n    ppkg bundle curl .zip\n    ppkg bundle curl xx.zip\n    ppkg bundle curl a/.zip\n    ppkg bundle curl a/xx.zip\n    ```\n\n- **export the given installed package as another package format (e.g. .deb, .rpm, .apk, .pkg.tar.xz, etc)**\n\n    ```bash\n    ppkg export curl .deb\n    ppkg export curl curl-8.1.2-linux-x86_64.deb\n    ppkg export curl a/curl-8.1.2-linux-x86_64.deb\n    ppkg export curl a/.deb\n\n    ppkg export curl .rpm\n    ppkg export curl curl-8.1.2-linux-x86_64.rpm\n    ppkg export curl a/curl-8.1.2-linux-x86_64.rpm\n    ppkg export curl a/.rpm\n\n    ppkg export curl .apk\n    ppkg export curl curl-8.1.2-linux-x86_64.apk\n    ppkg export curl a/curl-8.1.2-linux-x86_64.apk\n    ppkg export curl a/.apk\n\n    ppkg export curl .pkg.tar.xz\n    ppkg export curl curl-8.1.2-linux-x86_64.pkg.tar.xz\n    ppkg export curl a/curl-8.1.2-linux-x86_64.pkg.tar.xz\n    ppkg export curl a/*.pkg.tar.xz\n    ```\n\n- **delete the unused cached files**\n\n    ```bash\n    ppkg cleanup\n    ```\n\n## environment variables\n\n- **HOME**\n\n    this environment variable already have been set on most systems, if not set or set a empty string, you will receive an error message.\n\n- **PATH**\n\n    this environment variable already have been set on most systems, if not set or set a empty string, you will 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- **PPKG_HOME**\n\n    If this environment variable is not set or set a empty string, `$HOME/.ppkg` will be used as the default value.\n\n    ```bash\n    export PPKG_HOME=$HOME/ppkg-home\n    ```\n\n- **PPKG_URL_TRANSFORM**\n\n    ```bash\n    export PPKG_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 `ppkg 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- **PPKG_XTRACE**\n\n    for debugging purposes.\n\n    enables `set -x`:\n\n    ```bash\n    export PPKG_XTRACE=1\n    ```\n\n- **PPKG_DEFAULT_TARGET**\n\n    Some ACTIONs of ppkg are associated with an installed package which need `PACKAGE-SPEC` to be specified.\n\n    **PACKAGE-SPEC** : a formatted string that has form: `\u003cTARGET-PLATFORM\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-PLATFORM** : a formatted string that has form: `\u003cTARGET-PLATFORM-NAME\u003e-\u003cTARGET-PLATFORM-VERSION\u003e-\u003cTARGET-PLATFORM-ARCH\u003e`\n\n    **TARGET-PLATFORM-ARCH** : indicates which cpu arch was built for. value might be any one of `x86_64` `amd64` `arm64` `aarch64`, `ppc64le`, `riscv64`, `s390x`\n\n    **TARGET-PLATFORM-NAME** : indicates which platform name was built for. value shall be any one of `linux` `macos` `freebsd` `netbsd` `openbsd` `dragonflybsd`\n\n    **TARGET-PLATFORM-VERSION** : indicates which platform version was built with.\n\n    To simplify the usage, you are allowed to omit `\u003cTARGET-PLATFORM\u003e/`. If `\u003cTARGET-PLATFORM\u003e/` is omitted, environment variable `PPKG_DEFAULT_TARGET` would be checked, if this environment variable is not set, then your current running os target will be used as the default.\n\n    **Example**:\n\n    ```bash\n    export PPKG_DEFAULT_TARGET=linux-glibc-x86_64\n    export PPKG_DEFAULT_TARGET=linux-musl-x86_64\n    export PPKG_DEFAULT_TARGET=macos-13.0-arm64\n    export PPKG_DEFAULT_TARGET=macos-13.0-x86_64\n    export PPKG_DEFAULT_TARGET=freebsd-13.2-amd64\n    export PPKG_DEFAULT_TARGET=openbsd-7.4-amd64\n    export PPKG_DEFAULT_TARGET=netbsd-9.3-amd64\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## ppkg formula scheme\n\na ppkg formula is a [YAML](https://yaml.org/spec/1.2.2/) format file which is used to config a ppkg package's meta-information including one sentence description, package version, installation instructions, etc.\n\na ppkg formula's filename suffix must be `.yml`\n\na ppkg formula'a filename prefix would be treated as the package name.\n\na ppkg formula'a filename prefix must match the regular expression partten `^[A-Za-z0-9+-._@]{1,50}$`\n\na ppkg formula's file content only has one level mapping and shall has following KEY:\n\n|KEY|required?|overview|\n|-|-|-|\n|`pkgtype`|optional|indicates what type of this package. value shall be any one of `exe`, `pie`, `lib`, `exe+lib`.\u003cbr\u003eTo `exe` type package, `ppkg` would add `--static -static` options to `LDFLAGS` if `--static` install option is given.\u003cbr\u003eTo `pie` type package, it means that it doesn't support fully statically linking, it is supposed to be dynamically linked.\u003cbr\u003eIf this mapping is not present, `ppkg` will determine the package type by package name, if a package name starts/ends with `lib`, it would be recognized as type `lib`, otherwise, it would be recognized as type `exe`|\n|`summary`|required|describe this package in one sentence.|\n|`license`|optional|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`|optional|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`|optional|the home webpage of this package.\u003cbr\u003eIf this mapping is not present, `git-url` must be present.|\n||||\n|`git-url`|optional|the source code git repository.\u003cbr\u003eIf `src-url` is not present, this mapping must be present.|\n|`git-ref`|optional|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`|optional|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`|optional|tell `ppkg` that how many depth commits would you like to be fetched. default is `1`, this would save your time and storage. If you want to fetch all commits, set this to `0`|\n||||\n|`src-url`|optional|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` when this package is installing, otherwise, it will be copied to `$PACKAGE_WORKING_DIR/src`\u003cbr\u003ealso support format like `dir://DIR`|\n|`src-uri`|optional|the mirror of `src-url`.|\n|`src-sha`|optional|the `sha256sum` of source code.\u003cbr\u003e`src-sha` and `src-url` must appear together.|\n||||\n|`fix-url`|optional|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` when this package is installing, otherwise, it will be copied to `$PACKAGE_WORKING_DIR/fix`.|\n|`fix-uri`|optional|the mirror of `fix-url`.|\n|`fix-sha`|optional|the `sha256sum` of patch file.\u003cbr\u003e`fix-sha` and `fix-url` must appear together.|\n|`fix-opt`|optional|options to be passed to `patch` command. default value is `-p1`.|\n||||\n|`patches`|optional|multiple lines of `\u003cfix-sha\u003e\\|\u003cfix-url\u003e[\\|fix-uri][\\|fix-opt]`.|\n||||\n|`res-url`|optional|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` when this package is installing, otherwise, it will be copied to `$PACKAGE_WORKING_DIR/res`.|\n|`res-uri`|optional|the mirror of `res-url`.|\n|`res-sha`|optional|the `sha256sum` of resource file.\u003cbr\u003e`res-sha` and `res-url` must appear together.|\n||||\n|`reslist`|optional|multiple lines of `\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-pkg`|optional|a space-separated list of   `ppkg packages` that are depended by this package when installing and/or runtime, which will be installed via [ppkg](https://github.com/leleliu008/ppkg).|\n|`dep-lib`|optional|a space-separated list of libraries that will be linked. library name starts with `-l` will be directly passed to the linker. otherwise, it will be recognized as a `pkg-config` package name and it will be calculated via `pkg-config --libs-only-l ` then passed to the linker.|\n|`dep-upp`|optional|a space-separated list of   `uppm packages` that are depended by this package when installing and/or runtime, which will be installed via [uppm](https://github.com/leleliu008/uppm).|\n|`dep-pym`|optional|a space-separated list of `python packages` that are depended by this package when installing and/or runtime, which will be installed via [pip3](https://github.com/pypa/pip).|\n|`dep-plm`|optional|a space-separated list of    `perl modules` that are depended by this package when installing and/or runtime, which will be installed via [cpan](https://metacpan.org/dist/CPAN/view/scripts/cpan).|\n||||\n|`ccflags`|optional|append to `CFLAGS`|\n|`xxflags`|optional|append to `CXXFLAGS`|\n|`ppflags`|optional|append to `CPPFLAGS`|\n|`ldflags`|optional|append to `LDFLAGS`|\n||||\n|`bsystem`|optional|build system name.\u003cbr\u003evalues can be one or a combination of `autogen` `autotools` `configure` `cmake` `cmake+gmake` `cmake+ninja` `meson` `xmake` `gmake` `ninja` `cargo` `cabal` `go` `rake`|\n|`bscript`|optional|the directory where the build script is located in, relative to `PACKAGE_WORKING_DIR`. build script such as `configure`, `Makefile`, `CMakeLists.txt`, `meson.build`, `Cargo.toml`, etc.|\n|`binbstd`|optional|whether to build in the directory where the build script is located in, otherwise build in other directory.\u003cbr\u003evalue shall be `0` or `1`. default value is `0`.|\n|`movable`|optional|whether can be moved/copied to other locations.\u003cbr\u003evalue shall be `0` or `1`. default value is `1`.|\n|`parallel`|optional|whether to allow build system running jobs in parallel.\u003cbr\u003evalue shall be `0` or `1`. default value is `1`.|\n||||\n|`onstart`|optional|POSIX shell code to be run when this package's formula is loaded.\u003cbr\u003e`PWD` is `$PACKAGE_WORKING_DIR`|\n|`onready`|optional|POSIX shell code to be run when this package's needed resources all are ready.\u003cbr\u003e`PWD` is `$PACKAGE_BSCRIPT_DIR`|\n||||\n|`do12345`|optional|POSIX shell code to be run for native build.\u003cbr\u003eIt is only meaningful when requesting for cross building.\u003cbr\u003eIt is running in a separated process.|\n|`dopatch`|optional|POSIX shell code to be run to apply patches manually.\u003cbr\u003e`PWD` is `$PACKAGE_BSCRIPT_DIR`|\n|`dosetup`|optional|POSIX shell code to be run to do some additional preparation before installing.\u003cbr\u003e`PWD` is `$PACKAGE_BSCRIPT_DIR`|\n|`install`|optional|POSIX shell code to be run when user run `ppkg install \u003cPKG\u003e`. If this mapping is not present, `ppkg` 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|`doextra`|optional|POSIX shell code to be run to do some extra works immediately after installing.\u003cbr\u003e`PWD` is `$PACKAGE_INSTALL_DIR`|\n|`dotweak`|optional|POSIX shell code to be run to do some tweaks after `doextra`.\u003cbr\u003e`PWD` is `$PACKAGE_INSTALL_DIR`|\n||||\n|`bindenv`|optional|bind environment variables to executables. multiple lines of formatted string `\u003cKEY\u003e=\u003cVALUE\u003e`. `%s` represents the install directory.|\n||||\n|`caveats`|optional|multiple lines of plain text to be displayed after installation.|\n\n|phases|\n|-|\n|![phases](phases.svg)|\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|`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|`sysinfo`|[Reference](https://github.com/leleliu008/C-examples/tree/master/utils/sysinfo)|\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|`PPKG_ARG0`|the 1st arguments of `ppkg` that you've supplied.|\n|`PPKG_ARG1`|the 2nd arguments of `ppkg` that you've supplied.|\n|`PPKG_ARGV`|the all arguments of `ppkg` that you've supplied.|\n|`PPKG_PATH`|the full path of `ppkg` that you're running.|\n|`PPKG_HOME`|the home directory of `ppkg` that you're running.|\n|`PPKG_VERSION`|the version of `ppkg` 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 shall be any one of `linux` `darwin` `freebsd` `netbsd` `openbsd` `dragonflybsd`|\n|`NATIVE_PLATFORM_TYPE`|current running os type. value shall be any one of `linux` `macos` `freebsd` `netbsd` `openbsd` `dragonflybsd`|\n|`NATIVE_PLATFORM_NAME`|current running os name. value might be any one of `Debian GNU/Linux` `Ubuntu` `CentOS` `Fedora` `FreeBSD` `NetBSD` `OpenBSD`, `DragonFlyBSD`, 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` `amd64` `arm64` `aarch64`, `ppc64le`, `riscv64`, `s390x`, etc|\n|`NATIVE_PLATFORM_NCPU`|current running os's cpu core count.|\n|`NATIVE_PLATFORM_LIBC`|current running os's libc name. value shall be any one of `glibc` and `musl`.|\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_NAME`|target platform name that is built for. value shall be any one of `linux` `macos` `freebsd` `netbsd` `openbsd` `dragonflybsd`|\n|`TARGET_PLATFORM_VERS`|target platform version that is built with.|\n|`TARGET_PLATFORM_ARCH`|target platform arch that is built for. value might be any one of `x86_64` `amd64` `arm64` `aarch64`, `ppc64le`, `riscv64`, `s390x`, etc|\n|||\n|`CROSS_COMPILING`|value shall be 0 or 1. indicates whether is cross-compiling.|\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 when installing.|\n|`PACKAGE_BSCRIPT_DIR`|the directory where the build script (e.g. `Makefile`, `configure`, `CMakeLists.txt`, `meson.build`, `Cargo.toml`, etc) is located in.|\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|`cabal`|`cabal.project` `cabal.project.freeze` `cabal.project.local`|\n|`go`|`go.mod`|\n|`rake`|`Rakefile`|\n|`autogen`|`autogen.sh`|\n|`autotools`|`configure.ac`|\n|`configure`|`configure`|\n\n## ppkg formula repository\n\na typical hierarchical structure of a ppkg formula repository looks like below:\n\n```\nPPKGFormulaRepoName\n├── formula\n│   ├── packageA.yml\n│   └── packageB.yml\n├── LICENSE\n└── README.md\n```\n\n## ppkg formula repository local location\n\n`${PPKG_HOME}/repos.d/${PPKGFormulaRepoName}`\n\n## ppkg formula repository local config\n\na ppkg formula repository's config file is located at `${PPKG_HOME}/repos.d/${PPKGFormulaRepoName}/.ppkg-formula-repo.yml`\n\na typical ppkg formula repository's config file content looks like below:\n\n```yaml\nurl: https://github.com/leleliu008/ppkg-formula-repository-official-core\nbranch: master\npinned: 0\nenabled: 1\ncreated: 1673684639\nupdated: 1673684767\n```\n\nIf a ppkg formula repository is `pinned`, which means it would not be updated.\n\nIf a ppkg formula repository is `disabled`, which means ppkg would not search formulas in this formula repository.\n\n## ppkg formula repository management\n\nrun `ppkg formula-repo-add ` command to create a new formula repository locally from an exsting remote git repository.\n\nrun `ppkg formula-repo-init` command to create a new formula repository locally without taking any further action.\n\n## ppkg official formula repository\n\nppkg official formula repository is hosted at \u003chttps://github.com/leleliu008/ppkg-formula-repository-official-core\u003e\n\nIt would be automatically fetched to your local repository as name `official-core` when you run `ppkg update` command.\n\n**Note:** If you find that a package is not in ppkg official formula repository yet, PR is welcomed.\n\n## prebuild packages built by this software\n\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-loongarch64\u003e\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-x86_64\u003e\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-aarch64\u003e\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-riscv64\u003e\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-ppc64le\u003e\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-s390x\u003e\n- \u003chttps://github.com/leleliu008/uppm-package-repository-linux-armv7l\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleleliu008%2Fppkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleleliu008%2Fppkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleleliu008%2Fppkg/lists"}