From 243e700bd66d30bc16743d0429f4267695a07bac Mon Sep 17 00:00:00 2001 From: ThatGeekyWeeb Date: Fri, 27 Aug 2021 07:06:43 -0400 Subject: [PATCH] init --- .gitignore | 1 + README | 32 ++++++++++++++++++++++++++++++++ base.sh | 25 +++++++++++++++++++++++++ deplist | 39 +++++++++++++++++++++++++++++++++++++++ loc | 15 +++++++++++++++ make.patch | 26 ++++++++++++++++++++++++++ sources | 23 +++++++++++++++++++++++ 7 files changed, 161 insertions(+) create mode 100644 .gitignore create mode 100644 README create mode 100644 base.sh create mode 100644 deplist create mode 100644 loc create mode 100644 make.patch create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a42434 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./chroot/* \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..2afe484 --- /dev/null +++ b/README @@ -0,0 +1,32 @@ +### +- nG: A base for xbps 100% GNU free + - nG is not an actual distro but rather a write up + - on the requirements for setting an xbps system + - 100% without GNU +- nG only provides the basics for avoiding GNU + - while creating a base xbps chroot +--- +- See `./deplist` for a list of dependencies + there replacements +--- +- Setup: + - 1: start by creating a new folder "somewhere" (the folder is called ) + - 2: steal a copy of the go compiler from alpine (see `./deplist`) and add it to your PATH + - 3: make sure a posix shell is present on the host system + - 4: compile/obtain a copy of bmake + - 5: obtain a copy of the kati source code + - 6: enter the folder of said source code and apply `./make.patch` using patch + - 7: compile kati via `bmake kati` (requires go and ninja (see `./deplist`)) + - This will produce a `ckati` binary, it can be used as a replacement for (GNU)make + - With the following flags + - `ckati --ninja --ninja_dir=build --regen --use_find_emulator --color_warnings` + - This requires a `./build` folder; and produces a `<>/build/ninja.sh` script + - Run said `<>/build/ninja.sh` script to compile (GNU)make projects + - 8: compile/obtain a copy of busybox (requires (GNU)make; use ckati; see above) + - Set it's prefix to when compiling; otherwise install to /(usr/) + - 9: compile/obtain a copy of musl (requires (GNU)make; use ckati; see 7) + - Set it's prefix to when compiling; otherwise install to / + -- The above creates a stage 0 system + -- Below is for compiling xbps; static xbps can be used + - 10: compile/obtain a C99 compiler (tcc, pcc, clang) + - +### diff --git a/base.sh b/base.sh new file mode 100644 index 0000000..49c7b92 --- /dev/null +++ b/base.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# create a base system at ./chroot +# EVERYTHING (minus go) is fresh compiled +has() { + case "$(command -v $1 2>/dev/null)" in + alias*|"") return 1 + esac +} +has go || { echo "The golang compiler is required on the host system..."; exit 1;} +# needed for kati +has curl || { echo "curl is required on the host systtem"; exit 1;} +# for downloading sources +has bsdtar || { echo "bsdtar is required on the host system"; exit 1;} +# for extracting sources +rm chroot/builddir -rf 2>/dev/null +mkdir -p chroot/builddir; bdir="$(realpath chroot/builddir)" +IFS=""; while read -r p; do # no need for EOF check + case "$p" in + "#"*) ;; # ignore lines with comments + *) org=${PWD}; url="${p##*- }" + echo "Downloading/Extracting ${p%% -*} ..." + cd ${bdir}; curl -L "$url" --progress-bar | bsdtar -xf -;; + esac +done < ./sources # read from sources and download +cd ${org} diff --git a/deplist b/deplist new file mode 100644 index 0000000..9af1aa4 --- /dev/null +++ b/deplist @@ -0,0 +1,39 @@ +# KISS (or void/alpine) - is used for dep references +# - X means none +# C compiler, linux-headers and a host libc are implied +--- Stage 0 system +- musl (libc) + - make -> GNU + - Replace with - kati +- busybox - make (X) + - make -> GNU + - Replace with - kati +--- Kati +- kati - golang, ninja + - golang - STEAL FROM ALPINE + - https://dl-cdn.alpinelinux.org/alpine/edge/community//go-.apk + - 1.16.7-r0 ATM + - ninja - python, asciidoc + - Replace with - samurai + - samurai - X + - bmake - X +--- XBPS +- C99 compiler + - tcc - make + - make -> GNU + - Replace with - kati +- pkgconf - X +- zlib - X +- openssl - make, perl + - make -> GNU + - Replace with - kati + - perl - zlib, bzip + - zlib - X + - bzip2 - X +- libarchive - liblz4, libzstd, zlib, bzip2, liblzma + - liblz4 - ? + - zlib - X + - bzip2 - X + - liblzma - ? + - libzstd - zlib, liblzma, liblz4 +--- diff --git a/loc b/loc new file mode 100644 index 0000000..0830d6f --- /dev/null +++ b/loc @@ -0,0 +1,15 @@ +# folder names of extracted sources +# this is for ease of use +musl - musl-1.1.24/ +busybox - busybox-1.32.1/ +kati - kati-master/ +samurai - samurai-1.2/ +tcc - tinycc-a4997bf/ +pkgconf - pkgconf-1.7.4/ +openssl - openssl-1.1.1k/ +perl - perl-5.34.0/ +bzip2 - bzip2-1.0.8/ +libarchive - libarchive-3.5.1/ +liblz4 - lz4-1.9.3/ +liblzma - xz-5.2.5/ +libzstd - zstd-1.5.0/ diff --git a/make.patch b/make.patch new file mode 100644 index 0000000..914ab1e --- /dev/null +++ b/make.patch @@ -0,0 +1,26 @@ +diff --git a/Makefile b/Makefile +index e1b9d46..15d8c1e 100644 +--- a/Makefile ++++ b/Makefile +@@ -17,21 +17,6 @@ all: ckati ckati_tests + include Makefile.kati + include Makefile.ckati + +-info: ckati +- @echo GNU MAKE VERSION +- make --version +- make -f Makefile version --no-print-directory +- @echo +- @echo CKATI VERSION +- ./ckati -f Makefile version +- @echo +- @echo SHELL VERSION +- @echo $(SHELL) +- $(SHELL) --version | head -n 1 +- +-version: +- @echo $(MAKE_VERSION) +- + test: all ckati_tests + go test --ckati --ninja + diff --git a/sources b/sources new file mode 100644 index 0000000..c43bb2f --- /dev/null +++ b/sources @@ -0,0 +1,23 @@ +musl - http://www.musl-libc.org/releases/musl-1.1.24.tar.gz +# note: stable is newer; but contains a security bug... void uses above +busybox - https://www.busybox.net/downloads/busybox-1.32.1.tar.bz2 +# note: busybox.net is extremely slow +kati - https://github.com/google/kati/archive/refs/heads/master.tar.gz +# note: no releases or tags currently exist +# bmake - http://www.crufty.net/ftp/pub/sjg/bmake-20210621.tar.gz +# note: bmake is not "ACTUALLY" required; kati can be compiled via go easily +# command: go build -o kati github.com/google/kati/golang/cmd/kati +samurai - https://github.com/michaelforney/samurai/archive/1.2.tar.gz +# note: needs to be linked to ninja +# -- FOLLOWING IS FOR XBPS +tcc - http://repo.or.cz/tinycc.git/snapshot/a4997bf3d952f904bce824ee3e8f3e12e8524071.tar.gz +pkgconf - https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.4.tar.xz +zlib - http://www.zlib.net/zlib-1.2.11.tar.gz +openssl - https://www.openssl.org/source/openssl-1.1.1k.tar.gz +perl - https://www.cpan.org/src/5.0/perl-5.34.0.tar.gz +bzip2 - https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz +libarchive - https://github.com/libarchive/libarchive/releases/download/3.5.1/libarchive-3.5.1.tar.gz +liblz4 - https://github.com/lz4/lz4/archive/v1.9.3.tar.gz +liblzma - https://tukaani.org/xz/xz-5.2.5.tar.bz2 +libzstd - https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz +# CHECKSUMS ARE NOT CHECKED; NOT MY ISSUE