xcpkg

August 1, 2026 · View on GitHub

A package builder for Apple platforms using Xcode

Why another package manager ?

  • I need a package manager that can build not only for macOS but also for all Apple platforms (iOS, tvOS, watchOS, etc).

  • I need a package manager that can easily build for mostly statically linked executables.

  • I need a package manager that should have a simple and super easy to use CLI.

  • I need a package manager whose formula files should have a simple syntax, preferably using YAML rather than a programming language such as Python, Ruby, or something that is rarely used.

At first, I tried several widely used package managers, such as HomeBrew, MacPorts, Nix and vcpkg, but none of them felt right, so I finally rolled my own, this saves me from trying to persuade anyone else to cater to my needs.

Caveats

  • This software is being actively developed. It's in beta stage and may not be stable. Some features are subject to change without notice.

  • Please do NOT place your own files under ~/.xcpkg directory, as xcpkg will change files under ~/.xcpkg directory without notice.

  • Please do NOT run xcpkg command in parallel so as not to generate dirty data.

Using xcpkg via GitHub Actions

This is the recommended way of using this software.

In this way, you don't need a computer in hand, you could use GitHub mobile Apps.

In this way, you will be liberated from the rut of setting up the build environment.

In this way, you do NOT need to frequently update this software, you always use the latest version.

In 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.

For more details please refer to https://github.com/leleliu008/xcpkg-package-manually-build

Build from C source remotely via GitHub Actions

Build from C source locally dependencies

dependencyrequired?purpose
Xcode or Clangrequiredfor compiling C source code
cmakerequiredfor generating build.ninja
ninjarequiredfor doing jobs that read from build.ninja
pkg-config>=0.18requiredfor finding libraries
janssonrequiredfor parsing JSON
libyamlrequiredfor parsing YAML
libgit2requiredfor updating git repositories.
libcurlrequiredfor downloading files.
libarchiverequiredfor uncompressing files (.zip, .tar.gz, .tar.xz, etc).
opensslrequiredfor SSL support and SHA-256 sum checking support.
zlibrequiredfor compress and uncompress data.

Build from C source locally via ppkg

ppkg install xcpkg

Build from C source locally via xcpkg itself

xcpkg install xcpkg

Build from C source locally using vcpkg

git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
export VCPKG_ROOT="$PWD/vcpkg"
export PATH="$VCPKG_ROOT:$PATH"

vcpkg install 'curl[http2,brotli,zstd,openssl]' libgit2 libarchive libyaml jansson

git clone --depth=1 https://github.com/leleliu008/xcpkg
cd xcpkg

cmake -S . -B   build.d -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
cmake --build   build.d
cmake --install build.d

Build from C source locally via HomeBrew

cat > xcpkg.rb <<EOF
class Xcpkg < Formula
    desc     "A package builder for Apple platforms using Xcode"
    homepage "https://github.com/leleliu008/xcpkg"
    head     "https://github.com/leleliu008/xcpkg.git", branch: "master"
    url      "https://github.com/leleliu008/xcpkg.git", revision: "302840bc853df7c64daef575781beae4378db5c9"
    version  "0.30.1"
    license  "Apache-2.0"

    depends_on "cmake" => :build
    depends_on "ninja" => :build
    depends_on "pkg-config" => :build

    depends_on "zlib"
    depends_on "curl"
    depends_on "openssl@3"
    depends_on "jansson"
    depends_on "libyaml"
    depends_on "libgit2"
    depends_on "libarchive"

    def install
      system "cmake", "-S", ".", "-B", "build.d", *std_cmake_args
      system "cmake", "--build",   "build.d"
      system "cmake", "--install", "build.d"
    end

    test do
      system "#{bin}/xcpkg", "--help"
    end
end
EOF

MY_FORMULA_DIR="$(brew --repository)/Library/Taps/leleliu008/homebrew-xcpkg/Formula"
install -d  "$MY_FORMULA_DIR/"
mv xcpkg.rb "$MY_FORMULA_DIR/"

brew trust leleliu008/xcpkg
brew install xcpkg

Directories

default locationenvironment variable
uppm home directory~/.uppmUPPM_HOME
xcpkg home directory~/.xcpkgXCPKG_HOME
xcpkg downloads directory$XCPKG_HOME/downloadsXCPKG_DOWNLOADS_DIR

Notes:

  • you can change these via corresponding environment variable.
  • Don't place your own files under these directories, as xcpkg will change files under these directories without notice.

xcpkg command usage

  • show help of this command

    xcpkg -h
    xcpkg --help
    
  • show version of this command

    xcpkg -V
    xcpkg --version
    
  • show basic information about this software

    xcpkg about
    
  • show basic information about your current running operation system

    xcpkg sysinfo
    
  • show your current activated Xcode information

    xcpkg xcinfo
    
  • show the given Xcode information

    xcpkg xcinfo /Applications/Xcode12.app/Contents/Developer
    
  • save tab-completion script for zsh to a file

    xcpkg completion zsh > _xcpkg
    sudo mv _xcpkg /usr/local/share/zsh/site-functions/
    

    This project provides a tab-completion script for zsh for xcpkg. when you've typed xcpkg then type TAB key, the rest of the arguments will be automatically complete for you.

    Note: to apply this feature, you may need to run the command autoload -U compinit && compinit in your terminal (your current running shell must be zsh).

  • update all available formula repositories

    xcpkg update
    
  • search all available packages whose name matches the given regular expression pattern

    xcpkg search curl
    xcpkg search curl -v
    xcpkg search '^lib'
    
  • show information of the given available package

    xcpkg info curl
    xcpkg info curl --yaml
    xcpkg info curl --json
    xcpkg info curl version
    xcpkg info curl license
    xcpkg info curl summary
    xcpkg info curl web-url
    xcpkg info curl git-url
    xcpkg info curl git-sha
    xcpkg info curl git-ref
    xcpkg info curl src-url
    xcpkg info curl src-sha
    
  • show information of the given installed package

    xcpkg show iPhoneOS-12.0-arm64/curl
    xcpkg show iPhoneOS-12.0-arm64/curl --prefix
    xcpkg show iPhoneOS-12.0-arm64/curl --files
    xcpkg show iPhoneOS-12.0-arm64/curl --yaml
    xcpkg show iPhoneOS-12.0-arm64/curl --json
    xcpkg show iPhoneOS-12.0-arm64/curl version
    xcpkg show iPhoneOS-12.0-arm64/curl license
    xcpkg show iPhoneOS-12.0-arm64/curl summary
    xcpkg show iPhoneOS-12.0-arm64/curl web-url
    xcpkg show iPhoneOS-12.0-arm64/curl git-url
    xcpkg show iPhoneOS-12.0-arm64/curl git-sha
    xcpkg show iPhoneOS-12.0-arm64/curl git-ref
    xcpkg show iPhoneOS-12.0-arm64/curl src-url
    xcpkg show iPhoneOS-12.0-arm64/curl src-sha
    xcpkg show iPhoneOS-12.0-arm64/curl builtat
    xcpkg show iPhoneOS-12.0-arm64/curl builtat-iso-8601
    xcpkg show iPhoneOS-12.0-arm64/curl builtat-rfc-3339
    xcpkg show iPhoneOS-12.0-arm64/curl builtat-iso-8601-utc
    xcpkg show iPhoneOS-12.0-arm64/curl builtat-rfc-3339-utc
    
  • show packages that are depended by the given package

    xcpkg depends curl
    
    xcpkg depends curl -t d2
    xcpkg depends curl -t dot
    xcpkg depends curl -t box
    xcpkg depends curl -t png
    xcpkg depends curl -t svg
    
    xcpkg depends curl -t d2  -o dependencies/
    xcpkg depends curl -t dot -o dependencies/
    xcpkg depends curl -t box -o dependencies/
    xcpkg depends curl -t png -o dependencies/
    xcpkg depends curl -t svg -o dependencies/
    
    xcpkg depends curl -o curl-dependencies.d2
    xcpkg depends curl -o curl-dependencies.dot
    xcpkg depends curl -o curl-dependencies.box
    xcpkg depends curl -o curl-dependencies.png
    xcpkg depends curl -o curl-dependencies.svg
    
  • download resources of the given package to the local cache

    xcpkg fetch curl
    xcpkg fetch curl -v
    
  • install packages

    xcpkg install curl
    xcpkg install curl -U
    xcpkg install curl --target=iPhoneOS-12.0-arm64
    xcpkg install curl --developer-dir=/Applications/Xcode12.app/Contents/Developer
    xcpkg install iPhoneOS-12.0-arm64/curl
    
  • reinstall packages

    xcpkg reinstall curl
    xcpkg reinstall iPhoneOS-12.0-arm64/curl
    
  • uninstall packages

    xcpkg uninstall curl
    xcpkg uninstall iPhoneOS-12.0-arm64/curl
    
  • upgrade the outdated packages

    xcpkg upgrade
    xcpkg upgrade curl
    xcpkg upgrade iPhoneOS-12.0-arm64/curl
    
  • upgrade this software

    xcpkg upgrade-self
    xcpkg upgrade-self -v
    
  • list all available formula repositories

    xcpkg formula-repo-list
    
  • add a new formula repository

    xcpkg formula-repo-add my_repo https://github.com/leleliu008/xcpkg-formula-repository-my_repo
    xcpkg formula-repo-add my_repo https://github.com/leleliu008/xcpkg-formula-repository-my_repo master
    xcpkg formula-repo-add my_repo https://github.com/leleliu008/xcpkg-formula-repository-my_repo main
    
  • delete a existing formula repository

    xcpkg formula-repo-del my_repo
    
  • show formula of the give package

    xcpkg formula-cat curl
    
  • show formula of the give package using bat

    xcpkg formula-bat curl
    xcpkg formula-bat curl --language=yaml --paging=never --color=always --theme=Dracula --style=plain
    
  • change the give mapping of the formula of the given package

    xcpkg formula-set curl git-sha 7994b29a004065e98dc114928a93fc11fb104479
    
  • open formula of the give package in a text editor for editing

    xcpkg formula-edit curl
    xcpkg formula-edit curl --editor=vim
    
  • parse the give formula file

    xcpkg formula-parse curl.yml
    xcpkg formula-parse curl.yml version
    
  • check if the given package is available

    xcpkg is-available curl
    
  • check if the given package is installed

    xcpkg is-installed curl
    xcpkg is-installed iPhoneOS-12.0-arm64/curl
    
  • check if the given package is outdated

    xcpkg is-outdated  curl
    xcpkg is-outdated  iPhoneOS-12.0-arm64/curl
    
  • list all available packages

    xcpkg ls-available
    xcpkg ls-available -v
    
  • list all installed packages

    xcpkg ls-installed
    xcpkg ls-installed -v
    
  • list all outdated packages

    xcpkg ls-outdated
    xcpkg ls-outdated -v
    
  • list installed files of the given installed package in a tree-like format

    xcpkg tree curl
    xcpkg tree iPhoneOS-12.0-arm64/curl -L 3
    
  • show logs of the given installed package

    xcpkg logs curl
    xcpkg logs iPhoneOS-12.0-arm64/curl
    
  • bundle the given installed package into a single archive file

    xcpkg bundle iPhoneOS-12.0-arm64/curl .tar.xz
    xcpkg bundle iPhoneOS-12.0-arm64/curl .tar.gz
    xcpkg bundle iPhoneOS-12.0-arm64/curl .tar.lz
    xcpkg bundle iPhoneOS-12.0-arm64/curl .tar.bz2
    xcpkg bundle iPhoneOS-12.0-arm64/curl .zip
    xcpkg bundle iPhoneOS-12.0-arm64/curl a/.zip
    xcpkg bundle iPhoneOS-12.0-arm64/curl a/x.zip
    
  • delete the unused cached files

    xcpkg cleanup
    

influential environment variables

  • HOME

    This environment variable already have been set on macOS, if not set or set a empty string, you will receive an error message.

  • PATH

    This environment variable already have been set on macOS, if not set or set a empty string, you will receive an error message.

  • DEVELOPER_DIR

    If this environment variable is set, xcpkg will use it as the Xcode developer dir, otherwise, xcpkg will run command xcode-select -p to determine the Xcode developer dir.

  • SSL_CERT_FILE

    curl -LO https://curl.se/ca/cacert.pem
    chmod -w cacert.pem
    export SSL_CERT_FILE="$PWD/cacert.pem"
    

    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.

  • GOPROXY

    export GOPROXY='https://goproxy.cn'
    
  • XCPKG_HOME

    If this environment variable is not set or set a empty string, $HOME/.xcpkg will be used as the default value.

    export XCPKG_HOME=$HOME/xcpkg-home
    
  • XCPKG_GITHUB_PROXY

    export XCPKG_GITHUB_PROXY='https://ghfast.top'
    

    This is very useful for chinese users.

  • XCPKG_XTRACE

    for debugging purposes.

    enables set -x:

    export XCPKG_XTRACE=1
    
  • XCPKG_TARGET

    Some ACTIONs of xcpkg are associated with an installed package which need PACKAGE-SPEC to be specified.

    PACKAGE-SPEC : a formatted string that has form: <TARGET-PLATFORM>/<PACKAGE-NAME>, represents an installed package.

    PACKAGE-NAME : should match the regular expression pattern ^[A-Za-z0-9+-_.@]{1,50}$

    TARGET-PLATFORM : a formatted string that has form: <TARGET-PLATFORM-NAME>-<TARGET-PLATFORM-VERSION>-<TARGET-PLATFORM-ARCH>

    TARGET-PLATFORM-ARCH : indicates which cpu arch was built for. value might be any one of x86_64 arm64, etc

    TARGET-PLATFORM-NAME : indicates which platform name was built for. value shall be any one of AppleTVOS AppleTVSimulator DriverKit MacOSX WatchOS WatchSimulator iPhoneOS iPhoneSimulator

    TARGET-PLATFORM-VERSION : indicates which platform version was built with.

    To simplify the usage, you are allowed to omit <TARGET-PLATFORM>/. If <TARGET-PLATFORM>/ is omitted, environment variable XCPKG_TARGET would be checked, if this environment variable is not set, then your current running platform target will be used as the default.

    Example:

    export XCPKG_TARGET=MacOSX-10.15-x86_64
    
  • XCPKG_FORMULA_DIRS

    colon-separated list of directories to be searched for formulas.

environment variables unset by this software

ENVused by
SDKROOTclang clang++
MACOSX_DEPLOYMENT_TARGETclang clang++
WATCHOS_DEPLOYMENT_TARGETclang clang++
IPHONEOS_DEPLOYMENT_TARGETclang clang++
TARGET_ARCHgmake

environment variables overridden by this software

ENVused by
CCconfigure
CXXconfigure
CPPconfigure
ASconfigure
ARconfigure
LDconfigure
CFLAGSconfigure
CXXFLAGSconfigure
CPPFLAGSconfigure
LDFLAGSconfigure
LIBSconfigure
CMAKE_GENERATORcmake
CMAKE_BUILD_PARALLEL_LEVELcmake
CMAKE_EXPORT_COMPILE_COMMANDScmake
RUST_BACKTRACEcargo
RUSTFLAGScargo
CARGO_BUILD_JOBScargo
CARGO_BUILD_TARGETcargo
CARGO_BUILD_TARGET_DIRcargo
CGO_ENABLEDgo
CGO_CFLAGSgo
CGO_CXXFLAGSgo
CGO_CPPFLAGSgo
CGO_LDFLAGSgo
GO111MODULEgo
GOOSgo
GOARCHgo
PKG_CONFIG_LIBDIRpkg-config
PKG_CONFIG_PATHpkg-config
PKG_CONFIG_DEBUG_SPEWpkg-config
ACLOCAL_PATHaclocal
XDG_DATA_DIRSg-ir-scanner
XML_CATALOG_FILESxsltproc
PERL_MM_USE_DEFAULTcpan
BAT_THEMEbat
IFSshell

xcpkg formula scheme

A xcpkg formula is a YAML format file, which is used to config a xcpkg package's meta-information such as one sentence description, package version, installation instructions, etc.

A xcpkg formula's filename suffix must be .yml

A xcpkg formula'a filename prefix would be treated as the package name.

A xcpkg formula'a filename prefix must match the regular expression pattern ^[A-Za-z0-9+-._@]{1,50}$

A xcpkg formula's file content only has one level mapping and shall/might have the following KEYs:

KEYTYPEoverview
pkgtypeENUMthe type of this package.
value shall be any one of exe, lib, exe+lib.
If this mapping is not present, xcpkg 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
summaryTEXTone sentence description of this package.
licenseLISTA space-separated list of SPDX license short identifiers
versionTEXTthe version of this package.
If 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
web-urlURLthe home webpage of this package.
If this mapping is not present, git-url must be present.
git-urlURLthe source code git repository url.
If src-url is not present, this mapping must be present.
git-refTEXTreference: https://git-scm.com/book/en/v2/Git-Internals-Git-References
example values: HEAD refs/heads/master refs/heads/main refs/tags/v1, default value is HEAD
git-shaSHA1SUMthe full git commit id, 40-byte hexadecimal string, if git-ref and git-sha both are present, git-sha takes precedence over git-ref
git-nthINTtell xcpkg 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
src-urlURLthe source code download url of this package.
If 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
also support format like dir://DIR
src-uriURLthe mirror of src-url.
src-shaSHA256SUMthe sha256sum of source code.
src-sha and src-url must appear together.
fix-urlURLthe patch file download url of this package.
If 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.
fix-uriURLthe mirror of fix-url.
fix-shaSHA256SUMthe sha256sum of patch file.
fix-sha and fix-url must appear together.
fix-optLISTA space-separated list of arguments to be passed to patch command. default value is -p1.
patchesLISTA LF-delimited list of formatted TEXTs. each TEXT has format: <fix-sha>|<fix-url>[|fix-uri][|fix-opt]
res-urlURLother resource download url of this package.
If 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.
res-uriURLthe mirror of res-url.
res-shaSHA256SUMthe sha256sum of resource file.
res-sha and res-url must appear together.
reslistLISTA LF-delimited list of formatted TEXTs. each TEXT has format: <res-sha>|<res-url>[|res-uri][|unpack-dir][|N]. unpack-dir is relative to $PACKAGE_WORKING_DIR/res, default value is empty. N is --strip-components=N
dep-pkgLISTA space-separated list of xcpkg packages depended by this package when installing and/or runtime, which will be installed via xcpkg.
dep-libLISTA space-separated list of pkg-config packages needed by this package when installing.
each of them will be calculated via pkg-config --libs-only-l then passed to the linker.
dep-uppLISTA space-separated list of uppm packages depended by this package when installing and/or runtime, which will be installed via uppm.
dep-plmLISTA space-separated list of perl modules depended by this package when installing and/or runtime, which will be installed via cpan.
dep-pipLISTA space-separated list of python packages depended by this package when installing and/or runtime, which will be installed via pip.
dep-gemLISTA space-separated list of ruby modules depended by this package when installing and/or runtime, which will be installed via gem.
dep-npmLISTA space-separated list of nodejs packages depended by this package when installing and/or runtime, which will be installed via npm.
ccflagsLISTA space-separated list of arguments to be passed to the C compiler.
xxflagsLISTA space-separated list of arguments to be passed to the C++ compiler.
oxflagsLISTA space-separated list of arguments to be passed to the Objc compiler.
ppflagsLISTA space-separated list of arguments to be passed to the PreProcessor.
ldflagsLISTA space-separated list of arguments to be passed to the linker.
xcpkg supports a custom option -p<PKG-CONFIG-PACKAGE-NAME>. It will be substituted by the result of pkg-config --libs-only-l <PKG-CONFIG-PACKAGE-NAME>
bsystemLISTA space-separated list of build system names (e.g. autogen autotools configure cmake cmake+gmake cmake+ninja meson xmake gmake ninja cargo cabal swift zig go gn waf rake netsurf)
bscriptPATHthe directory where the build script is located, relative to PACKAGE_WORKING_DIR. build script such as configure, Makefile, CMakeLists.txt, meson.build, Cargo.toml, etc.
binbstdBOOLwhether to build in the directory where the build script is located, otherwise build in other directory.
value shall be 0 or 1. default value is 0.
ltoableBOOLwhether support LTO.
value shall be 0 or 1. default value is 1.
mslableBOOLwhether support creating Mostly Statically Linked executables.
value shall be 0 or 1. default value is 1.
This mapping is only for exe type of package.
movableBOOLwhether can be moved/copied to other locations.
value shall be 0 or 1. default value is 1.
parallelBOOLwhether to allow build system running jobs in parallel.
value shall be 0 or 1. default value is 1.
dofetchCODEPOSIX shell code to be run to take over the fetching process.
It would be run in a separate process.
PWD is $PACKAGE_WORKING_DIR
do12345CODEPOSIX shell code to be run for native build.
It is running in a separated process.
dopatchCODEPOSIX shell code to be run to apply patches manually.
PWD is $PACKAGE_BSCRIPT_DIR
prepareCODEPOSIX shell code to be run to do some additional preparation before installing.
PWD is $PACKAGE_BSCRIPT_DIR
installCODEPOSIX shell code to be run when user run xcpkg install <PKG>.
If this mapping is not present, xcpkg will run default install code according to bsystem.
PWD is $PACKAGE_BSCRIPT_DIR if binbstd is 0, otherwise it is $PACKAGE_BCACHED_DIR
dotweakCODEPOSIX shell code to be run to do some tweaks immediately after installing.
PWD is $PACKAGE_INSTALL_DIR
bindenvLISTA LF-delimited list of formatted TEXTs. each TEXT has format: <ENV>=<VALUE>. %s in <VALUE> represents the install directory.
xcpkg will bind these environment variables to executables while you are running xcpkg bundle.
wrapperLISTA LF-delimited list of formatted TEXTs. each TEXT has format: <SRC>|<DST>. e.g. bear.c|bin/ means that xcpkg will fetch bear.c from https://raw.githubusercontent.com/leleliu008/xcpkg-formula-repository-official-core/refs/heads/master/wrappers/bear.c then install it to $PACKAGE_INSTALL_DIR/bin/ directory.
xcpkg will use these C source files to build the corresponding wrappers rather than a generic one while you are running xcpkg bundle.
caveatsTEXTplain text to be displayed after installing.

Notes:

  • All mappings except summary are optional.
  • Mappings not listed in the table above will be ignored.

phases of a package's installation:

 process-0      process-1      process-2      process-3     process-0
┌─────────┐    ┌─────────┐    ┌─────────┐    ┌─────────┐
│ dosetup │ -> │ dofetch │ -> │ do12345 │ -> │ dopatch │
└─────────┘    └─────────┘    └─────────┘    └─────────┘

                                             ┌─────────┐
                                             │ prepare │
                                             └─────────┘

                                             ┌─────────┐
                                             │ install │
                                             └─────────┘

                                             ┌─────────┐
                                             │ dotweak │
                                             └─────────┘

                                             ┌─────────┐    ┌─────────┐
                                             │ docheck │ -> │ caveats │
                                             └─────────┘    └─────────┘

commands that can be used out of the box:

commandusage-example
bashReference
CoreUtilsReference
xargsReference
findReference
gawkReference
gsedReference
grepReference
treeReference
pkg-configReference
echoecho 'your message.'
infoinfo 'your information.'
warnwarn "no package manager found."
errorerror 'error message.'
abortabort 1 "please specify a package name."
successsuccess "build success."
isIntegerisInteger $x || abort 1 "should be an integer."
isCrossBuildisCrossBuild && abort 1 "This package is not supposed to be cross built."
wfetchwfetch <URL> [--uri=<URL-MIRROR>] [--sha256=<SHA256>] [-o <PATH> [-q]
configureconfigure --enable-pic
mesonwmesonw -Dneon=disabled -Darm-simd=disabled
cmakewcmakew -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON
gmakewgmakew
xmakewxmakew
cargowcargow
gowgow

shell variables can be used directly:

variableoverview
TIMESTAMP_UNIXthe unix timestamp of this action.
TIMESTAMP_ISO8601the ISO-8601 format timestamp of this action.
NATIVE_PLATFORM_VERScurrent running platform version.
NATIVE_PLATFORM_ARCHcurrent running platform arch. value might be any one of x86_64, arm64, etc
NATIVE_PLATFORM_NCPUcurrent running platform's cpu core count.
NATIVE_PLATFORM_EUIDcurrent running platform's effective user ID.
NATIVE_PLATFORM_EGIDcurrent running platform's effective group ID.
TARGET_PLATFORM_NAMEtarget platform name that is built for. value shall be any one of AppleTVOS AppleTVSimulator DriverKit MacOSX WatchOS WatchSimulator iPhoneOS iPhoneSimulator
TARGET_PLATFORM_VERStarget platform version that is built with.
TARGET_PLATFORM_ARCHtarget platform arch that is built for. value might be any one of x86_64, arm64, etc
CROSS_COMPILINGvalue shall be 0 or 1. indicates whether is cross-compiling.
XCPKG_PATHthe full path of xcpkg that you're running.
XCPKG_HOMEthe home directory of xcpkg that you're running.
XCPKG_VERSIONthe version of xcpkg that you're running.
CC_FOR_BUILDthe C Compiler for native build.
CFLAGS_FOR_BUILDthe flags of CC_FOR_BUILD.
CXX_FOR_BUILDthe C++ Compiler for native build.
CXXFLAGS_FOR_BUILDthe flags of CXX_FOR_BUILD.
CPP_FOR_BUILDthe C/C++ PreProcessor for native build.
CPPFLAGS_FOR_BUILDthe flags of CPP_FOR_BUILD.
AS_FOR_BUILDthe assembler for native build.
AR_FOR_BUILDthe archiver for native build.
RANLIB_FOR_BUILDthe archiver extra tool for native build.
LD_FOR_BUILDthe linker for native build.
LDFLAGS_FOR_BUILDthe flags of LD_FOR_BUILD.
NM_FOR_BUILDa command line tool to list symbols from object files for native build.
STRIP_FOR_BUILDa command line tool to discard symbols and other data from object files for native build.
CCthe C Compiler.
CFLAGSthe flags of CC.
CXXthe C++ Compiler.
CXXFLAGSthe flags of CXX.
CPPthe C/C++ PreProcessor.
CPPFLAGSthe flags of CPP.
ASthe assembler.
ARthe archiver.
RANLIBthe archiver extra tool.
LDthe linker.
LDFLAGSthe flags of LD.
NMa command line tool to list symbols from object files.
STRIPa command line tool to discard symbols and other data from object files.
PACKAGE_WORKING_DIRthe working directory when installing.
PACKAGE_BSCRIPT_DIRthe directory where the build script (Makefile, configure, CMakeLists.txt, meson.build, Cargo.toml, etc) is located in.
PACKAGE_BCACHED_DIRthe directory where the temporary files are stored in when building.
PACKAGE_INSTALL_DIRthe directory where the final files will be installed to.
x_INSTALL_DIRthe installation directory of x package.
x_INCLUDE_DIR$x_INSTALL_DIR/include
x_LIBRARY_DIR$x_INSTALL_DIR/lib

build system name and corresponding build script file name

build system namebuild script file name
mesonmeson.build
cmakeCMakeLists.txt
gmakeGNUMakefile or Makefile
ninjabuild.ninja
xmakexmake.lua
cargoCargo.toml
cabalcabal.project cabal.project.freeze cabal.project.local
swiftPackage.swift
zigbuild.zig
wafwaf
gogo.mod
rakeRakefile
autogenautogen.sh
autotoolsconfigure.ac
configureconfigure

xcpkg formula repository

a typical hierarchical structure of a xcpkg formula repository looks like below:

XCPKGFormulaRepoName
├── formula
│   ├── packageA.yml
│   └── packageB.yml
├── LICENSE
└── README.md

xcpkg formula repository local location

${XCPKG_HOME}/repos.d/${XCPKGFormulaRepoName}

xcpkg formula repository local config

a xcpkg formula repository's config file is located at ${XCPKG_HOME}/repos.d/${XCPKGFormulaRepoName}/.xcpkg-formula-repo.yml

a typical xcpkg formula repository's config file content looks like below:

url: https://github.com/leleliu008/xcpkg-formula-repository-official-core
branch: master
pinned: 0
enabled: 1
created: 1673684639
updated: 1673684767

If a xcpkg formula repository is pinned, which means it would not be updated.

If a xcpkg formula repository is disabled, which means xcpkg would not search formulas in this formula repository.

xcpkg formula repository management

run xcpkg formula-repo-add command to create a new formula repository locally from an existing remote git repository.

run xcpkg formula-repo-init command to create a new formula repository locally without taking any further action.

xcpkg official formula repository

xcpkg official formula repository is hosted at https://github.com/leleliu008/xcpkg-formula-repository-official-core

It would be automatically fetched to your local repository as name official-core when you run xcpkg update command.

Note: If you find that a package is not in xcpkg official formula repository yet, PR is welcomed.

prebuild packages built by this software