A minimal package manager for OPENSTEP.
sh ./pkg install zlibpkg automatically installs pdksh when it needs the build shell, and
wget-bootstrap when a remote source needs a downloader or SHA-256 tool.
You can also run sh ./pkg install wget-bootstrap explicitly. It builds with
stock /bin/cc, using only inputs kept in this repository.
Its offline dependency set is pdksh, patch,
texinfo, grep, gawk, gzip, tar, openssl, and ca-certificates. Keep these package
directories beside wget-bootstrap, pkg, and build-helpers.sh when transferring
the bootstrap to a machine without an HTTP client.
The downloader is installed as /usr/local/bin/wget-bootstrap. It uses the
OpenSSL port and its CA bundle; certificate verification stays enabled. Set the
machine's clock correctly before downloading over HTTPS. pkg prefers a curl
that supports the requested protocol, then wget-bootstrap, then a suitable
ordinary wget. The existing HTTP-only wget package remains usable for HTTP.
Unlike the dependency-free shell bootstrap, wget-bootstrap installs its
declared dependencies normally and builds under pdksh. Local-only packages
do not trigger downloader installation.
The offline tar package builds GNU tar 1.15.1 with stock /bin/cc and installs
/usr/local/bin/gnutar. pkg prefers it for archive extraction and installation
copies: OPENSTEP's GNU tar 1.12 truncates names that fill the 100-byte archive
name field, and its BSD tar cannot copy longer paths. Existing installations can
upgrade with sh ./pkg install tar; gcc42 also declares it as a dependency.
The gzip bootstrap uses its portable copy loop because OPENSTEP's memcpy
corrupts some overlapping decompression-window copies.
Other package archives are fetched on demand from their upstream releases or
source repositories, with SHA-256 hashes pinned in each package's checksums.
Only the bootstrap archives and local port patches/helpers are kept in Git.
This changes the current tree; old archives remain in Git history.
sh ./pkg download bash
sh ./pkg build bash
sh ./pkg install bash
sh ./pkg install bash grep
sh ./pkg test bash
sh ./pkg list
sh ./pkg remove bashPackages that need the newer compiler depend on gcc42 and explicitly use
/usr/local/bin/gcc-4.2 or /usr/local/bin/g++-4.2, including their test hooks.
The GCC 4.2 package bootstraps directly from stock /bin/cc: stage 1 uses
-O0, stages 2/3 and runtimes use -O2, and stage 2 is compared with stage 3.
gcc42 depends on cctools and uses its OPENSTEP-compatible cctools-806
linker. The matched ar and ranlib preserve long archive member names.
They live in /usr/local/lib/cctools/bin, with public commands ar-806,
ranlib-806, and ld-806. Package builds select AR and RANLIB
explicitly. Stock-compiler bootstrap builds use /bin/ar and /bin/ranlib.
The separate cctools-as package supplies the newer assembler. Select it
with -specs=/usr/local/lib/cctools-as/gcc42.specs; GCC otherwise keeps
using /bin/as. Existing GCC installations can select the newer linker
with -specs=/usr/local/lib/cctools/gcc42.specs until GCC is rebuilt.
Both options can be used together.
Python 3.11 builds at -O3, except its generated deepfreeze.c unit, which uses
-O0 -g0 to avoid GCC42 allocation failures and optimizer crashes on OPENSTEP.
Each package is a directory named after the package:
bash/
build
version
depends
sources
checksums
post-install
pre-remove
test
Required:
buildversion
Optional:
dependssourceschecksums(required for remote sources)post-installpre-removetest
Contains the package version as a single field.
Example:
3.2.57
One source per line. Blank lines and # comments are ignored.
Examples:
https://ftp.gnu.org/gnu/bash/bash-3.2.57.tar.gz
bash-3.2.57-openstep.patch
files/site.h patches
Rules:
- remote URLs are downloaded into the source cache and verified before use
- local paths are copied from the package directory
.tar.gz,.tgz, and.tararchives are extracted into the build root- non-archive files are copied as plain files
.tar.bz2and.tbz2requirebzip2independs.tar.xzand.txzrequirexzindepends
The optional second field is the destination directory inside the build root, for local files and URLs alike. It does not rename the cached download.
One lowercase SHA-256 digest and URL filename per line, separated by whitespace.
Blank lines and # comments are ignored. Generate hashes from the exact upstream
download, including its compression format; do not repack it first. Every remote
source needs exactly one entry. Missing, malformed, or duplicate entries fail.
pkg verifies with sha256sum or the bootstrap's openssl dgst -sha256.
Verified downloads are renamed into the cache only after transfer and hash
verification succeed. Existing cache files are rechecked before reuse; corrupt
ones are discarded and fetched again. Local sources remain usable offline.
Optional file with one package name per line.
Prefix a package name with ! to declare a conflicting package that must not be installed.
Example:
make
grep
!alternative-make
Behavior:
pkg buildchecks them before buildingpkg buildrequires positive dependencies to already be installedpkg buildrequires negative dependencies to be absentpkg installinstalls missing dependencies automatically when their package directories can be found alongside the requested packagepkg installfails if a negative dependency is already installedpkg installaccepts multiple package directories and installs them in the order provided- no build-vs-runtime distinction
build is run with:
- current directory set to the extracted source root when possible
$1set toDESTDIR$2set to the package versionDESTDIRexported in the environmentPKG_BUILD_HELPERSexported as the path tobuild-helpers.sh/usr/local/bin/kshused as the build shell for normal packages when available; the bootstrappdkshpackage is built with/bin/sh
pkg test uses the same shell selection and propagates test failures explicitly.
This avoids stock OPENSTEP /bin/sh masking a failure with a successful cleanup
trap.
Example:
#!/bin/sh
set -e
DESTDIR=$1
. "$PKG_BUILD_HELPERS"
run_configure --prefix=/usr/local
gnumake
gnumake install DESTDIR="$DESTDIR"test is an optional /bin/sh script that validates the installed package.
sh ./pkg test <name>runs the installed copy from/usr/local/var/pkg/db/installed/<name>/test- the package must already be installed
PKG_NAME,PKG_VERSION,ROOT_DIR, andLOCAL_ROOTare exported for the scriptPATHis prefixed with$LOCAL_ROOT/bin:$LOCAL_ROOT/sbin
Installed packages are tracked under:
/usr/local/var/pkg/db/installed
The default cache/staging area is:
/usr/local/var/pkg/cache
After a successful pkg build, the download cache and unpacked build tree
under:
/usr/local/var/pkg/cache/sources/<name>
/usr/local/var/pkg/cache/build/<name>
are removed automatically to save space.
The staged install image under:
/usr/local/var/pkg/cache/pkg/<name>
is kept so a later pkg install can reuse it without rebuilding.
After a successful pkg install, that staged install image is also removed,
so no per-package cache remains.
If a package ships a test script, pkg install copies it into the installed
package database so pkg test <name> can validate the installed files later.
This layout assumes /usr/local is writable by the installing user. That lets
non-root users build and install packages into the shared /usr/local tree.
Paths can still be overridden with:
PKG_ROOTPKG_DBPKG_CACHE