Skip to content

About

A minimal package manager for OPENSTEP

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Latest commit

 

History

98 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pkg

A minimal package manager for OPENSTEP.

First install on OPENSTEP

sh ./pkg install zlib

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

Usage

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 bash

Compiler selection

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

Package layout

Each package is a directory named after the package:

bash/
  build
  version
  depends
  sources
  checksums
  post-install
  pre-remove
  test

Required:

  • build
  • version

Optional:

  • depends
  • sources
  • checksums (required for remote sources)
  • post-install
  • pre-remove
  • test

version

Contains the package version as a single field.

Example:

3.2.57

sources

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 .tar archives are extracted into the build root
  • non-archive files are copied as plain files
  • .tar.bz2 and .tbz2 require bzip2 in depends
  • .tar.xz and .txz require xz in depends

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.

checksums

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.

depends

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 build checks them before building
  • pkg build requires positive dependencies to already be installed
  • pkg build requires negative dependencies to be absent
  • pkg install installs missing dependencies automatically when their package directories can be found alongside the requested package
  • pkg install fails if a negative dependency is already installed
  • pkg install accepts multiple package directories and installs them in the order provided
  • no build-vs-runtime distinction

build

build is run with:

  • current directory set to the extracted source root when possible
  • $1 set to DESTDIR
  • $2 set to the package version
  • DESTDIR exported in the environment
  • PKG_BUILD_HELPERS exported as the path to build-helpers.sh
  • /usr/local/bin/ksh used as the build shell for normal packages when available; the bootstrap pdksh package 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

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, and LOCAL_ROOT are exported for the script
  • PATH is prefixed with $LOCAL_ROOT/bin:$LOCAL_ROOT/sbin

Install database

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_ROOT
  • PKG_DB
  • PKG_CACHE

About

A minimal package manager for OPENSTEP

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages