Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
0518896
wip
MrCyjaneK Sep 17, 2025
b17fd77
fixes to ct tools
MrCyjaneK Sep 17, 2025
08cdae5
wip
MrCyjaneK Oct 11, 2025
10ff3d9
fix: linux build on macOS
MrCyjaneK Oct 14, 2025
095b9fb
aarch64 fixes
MrCyjaneK Oct 14, 2025
a45801a
rust: back to stage 3 build, update to 1_90_0
MrCyjaneK Oct 14, 2025
bacaaef
wip
MrCyjaneK Oct 15, 2025
e908829
packages:
MrCyjaneK Oct 15, 2025
0c36be4
wip
MrCyjaneK Oct 15, 2025
0365289
fix: buildweb templates and paths
MrCyjaneK Oct 16, 2025
09be1eb
wip: add google llvm
MrCyjaneK Oct 16, 2025
feb99cb
fix: ct-tools: symlink tools to avoid accidentally using host tools w…
MrCyjaneK Oct 16, 2025
74d1099
all -> *
MrCyjaneK Oct 17, 2025
c3321bc
chore: don't use `/usr/share` use /share instead
MrCyjaneK Oct 17, 2025
a948923
osx fixes
MrCyjaneK Oct 19, 2025
25770ba
sip
MrCyjaneK Oct 23, 2025
ee7d340
feat: dart bootstrap
MrCyjaneK Oct 25, 2025
9baf8ae
feat: properly define prefix
MrCyjaneK Oct 26, 2025
39d0ea3
package unistring
MrCyjaneK Oct 27, 2025
78fe32b
gettext: use lubunistring
MrCyjaneK Oct 27, 2025
3214f0e
fix: libunistring link in gettext
MrCyjaneK Oct 27, 2025
460ba6a
fix: asm patch
MrCyjaneK Nov 6, 2025
17cab0e
split apple sdk
MrCyjaneK Nov 6, 2025
0369803
tor: update to 0.4.8.20
MrCyjaneK Nov 12, 2025
a95084a
wip rust
MrCyjaneK Nov 6, 2025
8f88f21
wip
MrCyjaneK Nov 7, 2025
f465637
wip
MrCyjaneK Nov 17, 2025
c5cb851
wip
MrCyjaneK Nov 17, 2025
91b3240
wip
MrCyjaneK Nov 17, 2025
3449cd7
fix: android torch builds
MrCyjaneK Nov 18, 2025
8b6dcb6
fix: android sysroot fix: add triplet to env unless override by ENV
MrCyjaneK Nov 18, 2025
c91e7fe
fix: only include osx-cross on darwin targets
MrCyjaneK Nov 18, 2025
75b88cb
macos fixes
MrCyjaneK Nov 20, 2025
2714fc6
update python dependency in libxml2
MrCyjaneK Nov 20, 2025
a2752af
fix: missing imports, python3 symlinks
MrCyjaneK Nov 20, 2025
4be941a
fix sdk checksum
MrCyjaneK Nov 20, 2025
36d70ab
fix -list
MrCyjaneK Nov 21, 2025
cf90b28
add libxar
MrCyjaneK Nov 21, 2025
cc4d9fc
chore: update p7zip 16 to 7zip 25
MrCyjaneK Nov 24, 2025
b844a60
fix: ndk
MrCyjaneK Nov 24, 2025
5a503ac
fix: libevent c mode
MrCyjaneK Nov 24, 2025
797572a
fix: symlinking clang to clang++ by accident
MrCyjaneK Nov 24, 2025
b9796df
update to forked osx-cross
MrCyjaneK Nov 27, 2025
1d205c4
minor fixes
MrCyjaneK Nov 30, 2025
d3cc5af
fix
MrCyjaneK Nov 30, 2025
1f77eb6
reduce ram usage
MrCyjaneK Nov 30, 2025
109b0a3
bump
MrCyjaneK Nov 30, 2025
f844112
ios cross builds from linux
Dec 1, 2025
ec5f742
fix ios/ios-simulator builds on linux/arm64
MrCyjaneK Dec 2, 2025
e3d3e9d
suffix builddir with h.Triplet
MrCyjaneK Dec 8, 2025
6d11762
disable systemd
MrCyjaneK Dec 8, 2025
1969df5
fix python3 build
MrCyjaneK Dec 8, 2025
f8688cc
update to caching
MrCyjaneK Dec 22, 2025
ecddd26
fix -cleanup, package names fix
MrCyjaneK Dec 22, 2025
2d0cde8
deb creation, add go bootstrap
MrCyjaneK Dec 22, 2025
8e06070
package apt
MrCyjaneK Dec 29, 2025
9a48f2e
disable deb by default
MrCyjaneK Jan 1, 2026
b3884e2
minor fixes
MrCyjaneK Jan 13, 2026
483f1d3
lint
MrCyjaneK Jan 13, 2026
be149c3
wip
Jan 21, 2026
e800afb
wip
MrCyjaneK Jan 22, 2026
2f3c5a1
fix: replace unzip
MrCyjaneK Jan 23, 2026
a8d8832
mac fixes
Jan 26, 2026
bc542e6
feat: x86_64-linux-gnu
MrCyjaneK Jan 27, 2026
a76ea1c
fix: linux binutils
Jan 27, 2026
a916e5a
fix: x86_64 and aarch64 linux builds
MrCyjaneK Jan 27, 2026
41e0754
fixes
Jan 28, 2026
dd81e91
mingw32
Jan 29, 2026
7df862d
wip
MrCyjaneK Jan 29, 2026
afce0f0
fix: mingw32 builds
MrCyjaneK Jan 30, 2026
6833c9f
macos fix
MrCyjaneK Jan 30, 2026
9b39402
add missing env vars
MrCyjaneK Feb 5, 2026
120c5e0
fix mingw builds
MrCyjaneK Feb 5, 2026
842139e
boost fix
MrCyjaneK Feb 5, 2026
eee48c5
_source_me for extract
MrCyjaneK Feb 6, 2026
0c9d34e
fix: linux cross, git build
MrCyjaneK Feb 6, 2026
7620afd
fix: unbound deps
MrCyjaneK Feb 6, 2026
a717739
fix: osx-cross minver
MrCyjaneK Feb 6, 2026
8674271
fix: sodium
MrCyjaneK Feb 6, 2026
f05e047
boost ios fix
MrCyjaneK Feb 6, 2026
ce9536d
fix aarch64 linux
MrCyjaneK Feb 7, 2026
1d94e94
lniux amd64 fixes
MrCyjaneK Feb 8, 2026
4b94ce4
wip
MrCyjaneK Feb 8, 2026
ee29c67
wip
MrCyjaneK Feb 10, 2026
0afdf26
add .DS_Store to gitignore
MrCyjaneK Feb 10, 2026
61ccf85
bump sdk
Feb 19, 2026
9adf984
fix: compiler for aarch64-apple-ios-simulator
MrCyjaneK Feb 20, 2026
b188479
add patch dep
Feb 22, 2026
848fb4d
add unzip
Feb 22, 2026
f759303
add 7zz
Feb 22, 2026
96f3efe
add patch
Feb 22, 2026
7def8bc
use correct binutils
Feb 23, 2026
70ca89d
fix: unbound builds
MrCyjaneK Feb 25, 2026
ec07ce4
missing deps
MrCyjaneK Feb 28, 2026
ce28fb7
missing dep
MrCyjaneK Feb 28, 2026
d1f3c85
missing dep
MrCyjaneK Feb 28, 2026
198e833
feat: NATIVEPREFIX
MrCyjaneK Mar 1, 2026
a9a67b7
add boost 1_90_0 and 1_83_0
MrCyjaneK Mar 2, 2026
0426e51
make native pkgs unique
MrCyjaneK Mar 2, 2026
b39d0ef
boost fixes
MrCyjaneK Mar 3, 2026
0414efe
mkdir
MrCyjaneK Mar 4, 2026
f6eb673
qemu
MrCyjaneK Mar 6, 2026
f6e2a53
fix: static boost
MrCyjaneK Mar 6, 2026
603fc7b
wip
MrCyjaneK Mar 6, 2026
1842357
armv7a-linux-androideabi fix
MrCyjaneK Mar 7, 2026
a374427
git fix
MrCyjaneK Mar 8, 2026
8d511c4
fix: perl build on new xcode
MrCyjaneK Apr 2, 2026
c8036e9
rust
MrCyjaneK Apr 17, 2026
0bd12c7
add sqlite3 (3350500, 3510100) and curl packages
Agatha-luna Apr 6, 2026
711c108
fix: protobuf build
MrCyjaneK May 5, 2026
7b59e7a
minor build fixes
MrCyjaneK May 6, 2026
0ea74cb
don't patch protobuf
MrCyjaneK May 6, 2026
09cbbb9
cleanup protobuf
MrCyjaneK May 7, 2026
8621f89
wip
MrCyjaneK May 7, 2026
bcd7bd1
crosscomp fixes
MrCyjaneK May 9, 2026
7095fe6
wip
MrCyjaneK May 10, 2026
2a96b36
add pkgconf
MrCyjaneK May 10, 2026
2091e08
wip
MrCyjaneK May 11, 2026
c70cb5f
minor fixes + tor update
MrCyjaneK Jun 2, 2026
751644c
fix x86_64-linux-android
MrCyjaneK Jun 2, 2026
f060b28
fix: binutils
MrCyjaneK Jun 6, 2026
5783f30
....
MrCyjaneK Jun 23, 2026
7678d70
add: -archive
MrCyjaneK Jun 9, 2026
63484cd
refactor: streamline environment variable handling and improve downlo…
MrCyjaneK Jun 9, 2026
5edbfa7
wip rust
MrCyjaneK Jun 23, 2026
1a45bdc
feat: use easybs for bootstrap
MrCyjaneK Jun 26, 2026
23d3006
fix: build issues
MrCyjaneK Jun 26, 2026
d2f8557
export-env
MrCyjaneK Jun 27, 2026
4f543d8
wip
MrCyjaneK Jun 29, 2026
b9ab847
build fixes
MrCyjaneK Jun 30, 2026
3273b96
wip
MrCyjaneK Jul 1, 2026
fbfbbca
sources.json update
MrCyjaneK Jul 2, 2026
36340a1
minor fixes
MrCyjaneK Jul 2, 2026
87a52ed
rust fixes wip
MrCyjaneK Jul 7, 2026
684ec2c
fix: rust bootstrap
MrCyjaneK Jul 9, 2026
855d5bd
add Qt@6.11.1
MrCyjaneK Jul 9, 2026
91bd6d9
rust
MrCyjaneK Jul 13, 2026
8c35cb4
add Qt@6.11.1
MrCyjaneK Jul 13, 2026
3b7d20d
rust wip
MrCyjaneK Jul 15, 2026
59a6c4a
rust fixes
MrCyjaneK Jul 15, 2026
f5fe9f2
macos fixes
MrCyjaneK Jul 18, 2026
33763fd
win32 fixes
MrCyjaneK Jul 18, 2026
5a3e0a3
commet update
MrCyjaneK Jul 18, 2026
d10260c
darwin build fix
MrCyjaneK Jul 18, 2026
8eae203
simplify
MrCyjaneK Jul 18, 2026
f8fc01f
fix: ndk
MrCyjaneK Jul 18, 2026
80604d9
install proper toolchain for osx-cross
MrCyjaneK Jul 19, 2026
346bea8
fix: rust builds
MrCyjaneK Jul 21, 2026
e160c2d
macos?
MrCyjaneK Jul 21, 2026
817d048
aHHHHHHHHHHHH
MrCyjaneK Jul 21, 2026
71d3b8b
shenanigans
MrCyjaneK Jul 24, 2026
862136e
fix: platform detection in config.guess
MrCyjaneK Jul 24, 2026
e03b253
apple fix
MrCyjaneK Jul 24, 2026
5c6048e
fix: linux fix osx-cross
MrCyjaneK Jul 25, 2026
1cf40b6
better _source_me
MrCyjaneK Jul 25, 2026
218e973
disable python libxml2
MrCyjaneK Jul 26, 2026
fb40262
fix: workaround protobuf use of (wrong?) CPP
MrCyjaneK Jul 27, 2026
819b708
fix: iconv: host override for iOSsim
MrCyjaneK Jul 27, 2026
210dca4
fix: expat: iosSIM host
MrCyjaneK Jul 27, 2026
210e1db
fix: unbound: iosSIM
MrCyjaneK Jul 27, 2026
6f491f1
eh?
MrCyjaneK Jul 30, 2026
21813d6
wip
MrCyjaneK Aug 1, 2026
06a8bed
aasaas
MrCyjaneK Aug 2, 2026
d0c4edb
ios patch
MrCyjaneK Aug 2, 2026
91f3378
wip
MrCyjaneK Aug 2, 2026
0547208
tmp
MrCyjaneK Aug 5, 2026
5dca003
Revert "tmp"
MrCyjaneK Aug 5, 2026
b540455
build fixes
MrCyjaneK Aug 5, 2026
a95e437
fix: x64
MrCyjaneK Aug 7, 2026
e14af40
uhhh
MrCyjaneK Aug 7, 2026
2969e90
lint
MrCyjaneK Aug 9, 2026
2d5076e
separate env-native by default
MrCyjaneK Aug 9, 2026
61c2472
add onnxruntime, fix mingw builds in custom ENV
MrCyjaneK Aug 9, 2026
a140923
fix: macos?
MrCyjaneK Aug 9, 2026
cac2406
fix: build
MrCyjaneK Aug 11, 2026
7622c39
Revert "fix: build" - didn't fix
MrCyjaneK Aug 11, 2026
3036b79
Reapply "fix: build" - didn't fix - it did
MrCyjaneK Aug 12, 2026
35d8736
wip?
MrCyjaneK Aug 12, 2026
c82675f
win
MrCyjaneK Aug 12, 2026
aeca8cf
Add minimal Cloud Agent development environment (go + gh) (#1)
MrCyjaneK Aug 12, 2026
5138a70
Set SIMPLYBS_CACHE_* env vars box-wide in install
cursoragent Aug 12, 2026
e1e9e49
Selective GitHub Release build cache (pull needed / push changed) (#2)
MrCyjaneK Aug 13, 2026
0db773d
Document rust-std all-platforms build in AGENTS.md
cursoragent Aug 14, 2026
340e503
Revert BuildStepPATH order: bin before _/bin
cursoragent Aug 15, 2026
d7aad9e
cleanup
MrCyjaneK Aug 15, 2026
fd43c83
wip
MrCyjaneK Aug 16, 2026
d375bd8
ugh
MrCyjaneK Aug 16, 2026
0359059
sdanojl
MrCyjaneK Aug 16, 2026
cf71888
win
MrCyjaneK Aug 16, 2026
6addb59
add ffmpeg n9.0 from git
cursoragent Aug 10, 2026
7057f27
add whisper-cpp v1.9.2 from git
cursoragent Aug 10, 2026
76c4524
add filament v1.75.0 from git
cursoragent Aug 10, 2026
1271667
build onnxruntime for Android (cpuinfo properties, log sink, libiconv)
MrCyjaneK Aug 15, 2026
d903cea
Downgrade linux-gnu ct-tools glibc to 2.41
cursoragent Aug 16, 2026
72300a7
static-link libstdc++ for onnxruntime linux-gnu builds
MrCyjaneK Aug 18, 2026
5c8da8d
tmp -fPIC zlib
MrCyjaneK Aug 20, 2026
00d4635
Fix native/python@3.11 install symlinks and add bash dep to diffutils
cursoragent Aug 15, 2026
36677d5
Fix native/python@3.14 install symlinks (same as 3.11)
cursoragent Aug 15, 2026
e127d31
Run go run . -lint (reformat package JSON)
cursoragent Aug 27, 2026
75b490a
Pin *-linux-gnu ct-tools to GCC 13.4.0 (CXXABI 1.3.14)
cursoragent Aug 27, 2026
9b1e869
Pin *-linux-gnu toolchain to GCC 13.4.0 (CXXABI 1.3.14)
MrCyjaneK Aug 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .cursor/environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "simplybs",
"install": "./.cursor/install.sh"
}
49 changes: 49 additions & 0 deletions .cursor/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Idempotent environment bootstrap for simplybs.
# Runs after the repository is checked out. The dev loop is just `go run .`,
# so this only warms the Go module/build caches (which also validates the
# toolchain). go and gh are provided by the base image.
set -euo pipefail

cd "$(dirname "$0")/.."

echo "==> go version"
go version

echo "==> go mod download"
go mod download

echo "==> go build ./..."
go build ./...

# --- simplybs cache env vars --------------------------------------------
# Make the cache settings available to every command on the box. Two places:
# * /etc/environment -> picked up by PAM for all sessions (no shell
# expansion allowed, so we write resolved values).
# * /etc/profile.d/ -> sourced by login shells (keeps the dynamic form).
configure_cache_env() {
local repo="mrcyjanek/simplybs_private"
local tag="v0-sbs-${USER}-$(go env GOOS)-$(go env GOARCH)"

echo "==> configuring SIMPLYBS_CACHE_* (tag=${tag}, repo=${repo})"

# /etc/environment: replace any prior entries, then append resolved values.
sudo touch /etc/environment
sudo sed -i '/^SIMPLYBS_CACHE_TAG=/d;/^SIMPLYBS_CACHE_REPO=/d' /etc/environment
printf 'SIMPLYBS_CACHE_TAG=%s\nSIMPLYBS_CACHE_REPO=%s\n' "$tag" "$repo" \
| sudo tee -a /etc/environment >/dev/null

# /etc/profile.d: dynamic exports for login shells (safe if go is missing).
sudo tee /etc/profile.d/simplybs-cache.sh >/dev/null <<'EOF'
export SIMPLYBS_CACHE_REPO=mrcyjanek/simplybs_private
if command -v go >/dev/null 2>&1; then
export SIMPLYBS_CACHE_TAG="v0-sbs-${USER}-$(go env GOOS)-$(go env GOARCH)"
else
export SIMPLYBS_CACHE_TAG="v0-sbs-${USER}-linux-amd64"
fi
EOF
}

configure_cache_env

echo "==> install complete"
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
.buildlib
*.tar.gz
*.tar.gz
.build
ct-config
.DS_Store
logs

*.log
*.pid

# Local Windows Cygwin+clang seed (keep README only)
patches/native/_/windows_amd64_cygwin_clang/**
!patches/native/_/windows_amd64_cygwin_clang/README.md
104 changes: 104 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# AGENTS.md

`simplybs` is a cross-compilation build system written in Go. Package definitions
live in `packages/*.json` (and `packages/native/*.json`); patches live in `patches/`.

## Dev loop

The tool is run directly from source — there is no separate build step for
day-to-day work:

```bash
go run . <flags>
```

Common invocations:

```bash
go run . -host x86_64-linux-gnu -package zlib -list # show a package + its dep tree
go run . -host x86_64-linux-gnu -package zlib -download # fetch sources (verifies sha256)
go run . -host x86_64-linux-gnu -package zlib -build # build a package (+ its deps)
go run . -world -host <triplet> -build # build everything for a host
```

Supported host triplets are defined in `host/main.go` (e.g. `x86_64-linux-gnu`,
`aarch64-linux-android`, `x86_64-w64-mingw32`, `aarch64-apple-darwin`).

## rust-std (all platforms)

`rust-std` builds the Rust standard library (`library/std`, stage 1) for a
given `-host` triplet. **“All platforms”** means every entry in
`host.SupportedHosts` — pass them as a comma-separated `-host` list:

| `-host` (simplybs triplet) | Rust target (`$RUST_TRIPLET`) |
| --- | --- |
| `x86_64-linux-gnu` | `x86_64-unknown-linux-gnu` |
| `aarch64-linux-gnu` | `aarch64-unknown-linux-gnu` |
| `x86_64-w64-mingw32` | `x86_64-pc-windows-gnu` |
| `aarch64-apple-darwin` | `aarch64-apple-darwin` |
| `x86_64-apple-darwin` | `x86_64-apple-darwin` |
| `aarch64-apple-ios` | `aarch64-apple-ios` |
| `aarch64-apple-ios-simulator` | `aarch64-apple-ios-sim` |
| `aarch64-linux-android` | `aarch64-linux-android` |
| `x86_64-linux-android` | `x86_64-linux-android` |
| `armv7a-linux-androideabi` | `armv7-linux-androideabi` |

```bash
go run . -host \
aarch64-apple-darwin,x86_64-apple-darwin,aarch64-apple-ios,aarch64-apple-ios-simulator,\
x86_64-w64-mingw32,x86_64-linux-gnu,aarch64-linux-gnu,aarch64-linux-android,\
x86_64-linux-android,armv7a-linux-androideabi \
-package rust-std -build
```

Each host build is independent (separate artifact under `.buildlib/<goos>_<goarch>/built/`).
Requires `native/rust` (and the full native toolchain for that target) to already be built.

## After editing packages — always run lint

Whenever you add or change a package definition (new source, new git ref, bumped
version, new dependency, etc.), regenerate metadata and validate with:

```bash
go run . -lint
```

`-lint` reformats every `packages/**.json`, checks for invalid/cyclic
dependencies, and regenerates the checked-in `sources.json`. Commit the resulting
`sources.json` changes together with your package edits.

To generate git `download` entries from repos you've checked out locally:

```bash
go run ./cmd/gengitdeps # prints download JSON to stdout
```

## Tests

```bash
go test ./...
```

Note: `host.TestHosts` is data-driven from `packages/native/_.json` and may
already fail on a clean checkout — unrelated to environment setup.

## Tooling

`go` and `gh` are provided by the base image; there is nothing else to install.

## Cache environment variables

`install.sh` exports the shared cache settings box-wide (via `/etc/environment`
and `/etc/profile.d/simplybs-cache.sh`), so every command sees them:

- `SIMPLYBS_CACHE_TAG=v0-sbs-<user>-<goos>-<goarch>` (e.g. `v0-sbs-ubuntu-linux-amd64`)
- `SIMPLYBS_CACHE_REPO=mrcyjanek/simplybs_private`

When both are set, cache is enabled: `-build` auto-pulls needed artifacts and
auto-pushes new/changed ones (see README). Explicit flags:

```bash
go run . -host x86_64-linux-gnu -package zlib -cache-pull
go run . -host x86_64-linux-gnu -package zlib -build
go run . -host x86_64-linux-gnu -package zlib -cache-push
```
76 changes: 61 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ All package definitions live inside of this repo (this is going to change soon *
// (soon) "source" indicationg a package that only contains source code (e.g. that was pulled using custom tools such as `repo` or are too complex for the built in system to handle)
"type": "host",
// where to find the source code
"download": {
"download": [{
// "tar.gz" indicates a (who wouldn't have guessed) .tar.gz archive that will be extracted before build steps occur
// "tar.bz2" indicares a (no way.. is it gonna be..) .tar.bz2 archive that will be extracted.. you get the drill
// "git" indicates a Git repository being used
Expand All @@ -50,33 +50,79 @@ All package definitions live inside of this repo (this is going to change soon *
// build all packages recursively but it won't inherit parent dependencies)
"*-android*:native/android_ndk",
// all is a magic keyword that works just like *
"all:native/make",
"all:native/libtool"
"*:native/make",
"*:native/libtool"
],
"build": {
"env": [
// same logic as in dependencies applies, most variables are available during this phase (like $PREFIX or $HOST)
"all:CFLAGS=$CFLAGS -fPIC",
"all:config_opts=--prefix=$PREFIX --static",
"all:LIBTOOL=$PREFIX/native/bin/libtool",
"all:CROSS_PREFIX=$HOST-"
"*:CFLAGS=$CFLAGS -fPIC",
"*:config_opts=--prefix=$PREFIX --static",
"*:LIBTOOL=$NATIVEPREFIX/bin/libtool",
"*:CROSS_PREFIX=$HOST-"
],
"steps": [
// step-by-step instructions to build the package.
"all:./configure $config_opts",
"all:sed -i.bak s\\|^AR=.*\\|AR=$AR\\|g Makefile",
"all:sed -i.bak s\\|^ARFLAGS=.*\\|ARFLAGS=$ARFLAGS\\|g Makefile",
"all:make -j$NUM_CORES",
"all:make DESTDIR=$STAGING_DIR install"
"*:./configure $config_opts",
"*:sed -i.bak s\\|^AR=.*\\|AR=$AR\\|g Makefile",
"*:sed -i.bak s\\|^ARFLAGS=.*\\|ARFLAGS=$ARFLAGS\\|g Makefile",
"*:make -j$NUM_CORES",
"*:make DESTDIR=$STAGING_DIR install"
]
}
}
```

## Usage

In order to build, let's say, `libtor` for armv7a-linux-androideabi you would run the following command (on either a Mac or Linux x64 device).
In order to build, let's say, `tor` for armv7a-linux-androideabi you would run the following command (on either a Mac or Linux x64 device).

```
$ go run . -host armv7a-linux-androideabi -package libtor -build
```
$ go run . -host armv7a-linux-androideabi -package tor -build
```

## Recommended / "official" cache settings

```bash
SIMPLYBS_ENV_DIR=/opt/_
```

## Build cache (GitHub Releases)

Built package archives are content-addressed (`package-version-<8-char-hash>`).
They can be shared via a rolling GitHub Release without downloading the whole
cache on every run.

Cache is enabled only when **both** required variables are set:

| Variable | Required | Purpose |
| --- | --- | --- |
| `SIMPLYBS_CACHE_TAG` | yes | Release tag (e.g. `v0-sbs-$USER-$GOOS-$GOARCH`) |
| `SIMPLYBS_CACHE_REPO` | yes | `owner/repo` hosting the release |
| `SIMPLYBS_GH` | no | Optional path to `gh` |

```bash
# export SIMPLYBS_CACHE_TAG=v0-sbs-$USER-$(go env GOOS)-$(go env GOARCH)
# export SIMPLYBS_CACHE_REPO=mrcyjanek/simplybs_private
```

With those set, `-build` auto-pulls the needed package tree up front, pulls
per-package inside `EnsureBuilt` as a fallback, pushes each package after a
successful local build, and runs a final tree push for anything still missing
on the release:

```bash
go run . -host x86_64-linux-gnu -package zlib -build
```

Explicit pull/push still work:

```bash
go run . -host x86_64-linux-gnu -package zlib -cache-pull
go run . -cache-push # all local built/
go run . -host x86_64-linux-gnu -package zlib -cache-push # that package tree only
```

Push only uploads local artifacts that are not already on the release (a
package rebuild with a new hash is a new asset name, so “changed” caches
upload naturally).
16 changes: 0 additions & 16 deletions builder/builder_darwin_arm64.go
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
package builder

var HostBuilder = Builder{
GlobalEnv: []string{
"all:HOST=aarch64-apple-darwin",
"all:TARGET=aarch64-apple-darwin",
"all:OSX_MIN_VERSION=10.15",
"all:CC=/usr/bin/clang",
"all:CXX=/usr/bin/clang++",
"all:AR=" + shellOutput("xcrun --sdk macosx --find ar"),
"all:RANLIB=" + shellOutput("xcrun --sdk macosx --find ranlib"),
"all:STRIP=" + shellOutput("xcrun --sdk macosx --find strip"),
"all:NM=" + shellOutput("xcrun --sdk macosx --find nm"),
"all:OTOOL=" + shellOutput("xcrun --sdk macosx --find otool"),
"all:INSTALL_NAME_TOOL=" + shellOutput("xcrun --sdk macosx --find install_name_tool"),
},
}
16 changes: 0 additions & 16 deletions builder/builder_linux_amd64.go
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
package builder

var HostBuilder = Builder{
GlobalEnv: []string{
"all:HOST=x86_64-linux-gnu",
"all:TARGET=x86_64-linux-gnu",
"all:CC=clang",
"all:CXX=clang++",
"all:AR=ar",
"all:RANLIB=ranlib",
"all:STRIP=strip",
"all:NM=nm",
"all:OTOOL=otool",
"all:AUTOMAKE=automake",
"all:INSTALL_NAME_TOOL=install_name_tool",
},
}
16 changes: 0 additions & 16 deletions builder/builder_linux_arm64.go
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
package builder

var HostBuilder = Builder{
GlobalEnv: []string{
"all:HOST=aarch64-linux-gnu",
"all:TARGET=aarch64-linux-gnu",
"all:CC=clang",
"all:CXX=clang++",
"all:AR=ar",
"all:RANLIB=ranlib",
"all:STRIP=strip",
"all:NM=nm",
"all:OTOOL=otool",
"all:AUTOMAKE=automake",
"all:INSTALL_NAME_TOOL=install_name_tool",
},
}
1 change: 1 addition & 0 deletions builder/builder_windows_amd64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package builder
30 changes: 19 additions & 11 deletions builder/default.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
package builder

import (
"os/exec"
"strings"
"log"
"runtime"
)

type Builder struct {
GlobalEnv []string
func GetName() string {
return runtime.GOOS + "_" + runtime.GOARCH
}

var Builders = []string{"darwin_arm64", "linux_amd64", "linux_arm64"}

func shellOutput(cmd string) string {
output, err := exec.Command("bash", "-c", cmd).Output()
if err != nil {
return "$(" + cmd + ")"
func NativeTriplet() string {
switch GetName() {
case "darwin_arm64":
return "aarch64-apple-darwin"
case "linux_amd64":
return "x86_64-linux-gnu"
case "linux_arm64":
return "aarch64-linux-gnu"
case "windows_amd64":
return "x86_64-pc-cygwin"
default:
log.Fatalf("unknown builder: %s", GetName())
return ""
}
return strings.TrimSpace(string(output))
}

var Builders = []string{"darwin_arm64", "linux_amd64", "linux_arm64", "windows_amd64"}
Loading