pthbs_genpkgpy

Template engine for producing packages for pthbs written using Python and Jinja
git clone https://ccx.te2000.cz/git/pthbs_genpkgpy
Log | Files | Refs | Submodules | README

commit 506b55ea9357bc22b19728b4b20bf250641918c4
parent 12a9473d9eb9d9137cffaf01d7bdacca10aeffd4
Author: Jan Pobříslo <ccx@te2000.cz>
Date:   Thu, 22 Feb 2024 13:41:19 +0100

Make core-system part of default.environment, libretls

Diffstat:
MREADME | 8+++++---
Mpackages/default.environment | 1+
Apackages/libressl | 120+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpackages/userspace.environment | 9+++------
Mtemplates/pkg/default.environment | 4++++
Atemplates/pkg/libressl | 14++++++++++++++
Mtemplates/pkg/userspace.environment | 5+----
7 files changed, 148 insertions(+), 13 deletions(-)

diff --git a/README b/README @@ -111,10 +111,10 @@ Packaged software * s6-dns * s6-linux-init * s6-linux-utils -* s6-networking * s6-portable-utils * s6-rc * skalibs +* popt * m4 * flex * bison @@ -131,13 +131,15 @@ Work in progress * add acl and xattr support * possibly libretls or xxhash for faster hashes * linux - * fully-featured kernel for real hardware + * build fully-featured kernel for real hardware * libelf +* s6-networking + * add TLS support +* libretls Planned packages ~~~~~~~~~~~~~~~~ -* libretls * curl * git * cgroup-tools (cgconfigparser) diff --git a/packages/default.environment b/packages/default.environment @@ -14,6 +14,7 @@ #+s6-linux-init.163646f3a337341ddb9ce39a5fc8afbd3507c0c3c94bc8f4d0458c0cee753448 #+mdevd.1ccacf0514eeffea88fc8203b470398b95638632eae38f1048a6f3bf5754f6dd #+s6-dns.41e9bc09d7f62576c34aad13f3e57168c5052ec4674abbbb9d2ccf78ee0db6e0 +#+libressl.cc0501557666329ab84addad7a5bfd021da64afb50174d854b64b3ff6c77d2c6 #+s6-networking.15adf950be6728a030816bedd5b2283e78e41796cea59b614b22c44690dfd6fa #+zsh.f8b4dc59a1d38643db3a4ec70dca58f74f4c9407c809b0fc519402f0bcccfbdb #+pthbs-banginstall.089f7542767b49f891e4acbca5ddf214ee7f45ba958f866fdbc514d6f7e39276 diff --git a/packages/libressl b/packages/libressl @@ -0,0 +1,120 @@ +#!/usr/bin/env pthbs-build +#+musl-cross-make.6377e568aa49eae6525f0f5ed4a7d2505704941ef74850d2f208da7b12c7865d +#+gnu-make.1d42a93ec73db6119517d6554dbd49317209dc527295acb4ea8e804be913b9a3 +#+busybox.a41e637082cdc82c38a093db7af3615cc2f417a0e8034f7a7ba88d64e852e101 +#+busybox-diffutils.28aa9a4a515da839eaf2e9873bccf363e8eb4829bff3307d2f000204690dfc82 +#+m4.b4d536e5f08f9c11575bfc61d943c9714bc556ed473eedb0520288720ff13871 +#@git:a5f207bea5b54c5066ac99cc8112a5aa0b56dec4:libressl + +autotools() { + cd "$1" + shift + export LD_LIBRARY_PATH="$pthbs_build_environment/library:$pthbs_build_environment/library.so" + export CPATH="$pthbs_build_environment/include" + export CFLAGS="-L$pthbs_build_environment/library -D_GNU_SOURCE $CFLAGS" + prefix=/home/ccx/versions/$pthbs_package + ./configure -C \ + --prefix="$prefix" \ + --build="$(${CC:-gcc} -dumpmachine)" \ + --bindir="$prefix/command" \ + --sbindir="$prefix/command" \ + --infodir="$prefix/info" \ + --localedir="$prefix/locale" \ + --mandir="$prefix/man" \ + --libdir="$prefix/library" \ + --docdir="$prefix/doc/libressl" \ + --localstatedir='/home/ccx/.local/var' \ + "$@" + # --libexecdir=DIR program executables [EPREFIX/libexec] + # --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + # --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + # --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + # --includedir=DIR C header files [PREFIX/include] + # --oldincludedir=DIR C header files for non-gcc [/usr/include] + # --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + # --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + + # ac_cv_func_malloc_0_nonnull=yes \ + # ac_cv_func_realloc_0_nonnull=yes + make -j${JOBS:-1} -l$((1+${JOBS:-1})) + make DESTDIR="$pthbs_destdir" install +} + +autotools_static() { + export LDFLAGS="-static -L$pthbs_build_environment/library $LDFLAGS" + autotools "$@" --enable-static --disable-shared +} + +check_static() { + local exe || true + exe=$pthbs_destdir/'/home/ccx/versions'/$pthbs_package/$1 + if ! test -f $exe; then + printf '%s\n' "Error: file '$1' doesn't exist!" + exit 1 + fi + interp_info=$(readelf --string-dump=.interp "$exe") || exit $? + if test x '!=' "x$interp_info"; then + printf '%s\n' "Error: '$1' is a dynamic binary!" + exit 1 + fi +} + + + +autotools_static libressl +check_static command/ocspcheck + + + +cd "$pthbs_destdir/home/ccx/versions/$pthbs_package" +find -type d -o -print | awk -F/ ' +BEGIN { + x["./command/ocspcheck"]=1 +} + +function r1(s) { + sub("^[.]/[^/]*", ".", s) + return s +} +function s1(repl, s) { + sub("^[.]/[^/]*", "./"repl, s) + return s +} +function link(src) { + x[$0]=0 + printf "%s\t%s\n", $0, src + printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr" +} +$1!="."{exit 1} + + +$2 == "command" { link($0); next } +$2 == "bin" { link(s1("command", $0)); next } + +$2 == "library.so" { link($0); next } +$2 == "library" { link($0); next } +$2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next } +$2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next } + +$2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next } + +$2 == "man" { link($0); next } +$2 == "info" { link($0); next } +$2 == "doc" { link($0); next } +$2 == "icons" { link($0); next } +$2 == "terminfo" { link($0); next } + +$2 == "include" { link($0); next } + +{ printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" } + +END { + for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" } + for(fname in x) { + if(x[fname]) { + printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr" + exit 3 + } + } +}' >.install-links.new +mv .install-links.new .install-links diff --git a/packages/userspace.environment b/packages/userspace.environment @@ -14,6 +14,7 @@ #+s6-linux-init.163646f3a337341ddb9ce39a5fc8afbd3507c0c3c94bc8f4d0458c0cee753448 #+mdevd.1ccacf0514eeffea88fc8203b470398b95638632eae38f1048a6f3bf5754f6dd #+s6-dns.41e9bc09d7f62576c34aad13f3e57168c5052ec4674abbbb9d2ccf78ee0db6e0 +#+libressl.cc0501557666329ab84addad7a5bfd021da64afb50174d854b64b3ff6c77d2c6 #+s6-networking.15adf950be6728a030816bedd5b2283e78e41796cea59b614b22c44690dfd6fa #+zsh.f8b4dc59a1d38643db3a4ec70dca58f74f4c9407c809b0fc519402f0bcccfbdb #+pthbs-banginstall.089f7542767b49f891e4acbca5ddf214ee7f45ba958f866fdbc514d6f7e39276 @@ -22,8 +23,4 @@ #+containers.de880d8cacbb87b0a30e88654c81e291178ecd2c3717de59e0a64f694a8da8b8 #+fileset.f6f04ce01f2f3903f917b62be00ae696e8692478b44f946528379ebbb426eea0 #+logincaps.0296b3435c8943a4138dbe4ccbb27d29cee31f1437c74b4c45218fb77873b10a -#+snaprep.9fc58ee4729913adada7f715d37f7af5b6ef324f46e73b27ea939323b83c5a46 -#+core-system-conf.ee44833f65709792d6a577809e1b59b2d21c647b8a9c34ca560c351bea6ddc85 -#+core-system-rc.41a4b72e1f805c1285fdfc17917a55490d98cc5d893b88b976b8ade0836274a1 -#+core-system-scripts.a6948d0ca8f36e41bf5f0ec5acc13bc2fc6c9787282984ff089482ee5c587a9d -#+core-system-init.c55889e425a8c194b5a6954cd9345290f68caacbdbfff152b79eb7eff67607b1- \ No newline at end of file +#+snaprep.9fc58ee4729913adada7f715d37f7af5b6ef324f46e73b27ea939323b83c5a46+ \ No newline at end of file diff --git a/templates/pkg/default.environment b/templates/pkg/default.environment @@ -1,2 +1,6 @@ {% include "pkg/userspace.environment" %} +#+{{pkg_install_name("core-system-conf")}} +#+{{pkg_install_name("core-system-rc")}} +#+{{pkg_install_name("core-system-scripts")}} +#+{{pkg_install_name("core-system-init")}} #+{{pkg_install_name("linux")}} diff --git a/templates/pkg/libressl b/templates/pkg/libressl @@ -0,0 +1,14 @@ +{% extends "autotools" %} +{%- block extra_deps %} +#@git:{{submodule.current[name]}}:{{name}} +{%- endblock %} +{% block at_script %} + +autotools_static libressl +check_static command/ocspcheck + +{% endblock %} +{% block genlinks_begin %} + x["./command/ocspcheck"]=1 +{% endblock %} + diff --git a/templates/pkg/userspace.environment b/templates/pkg/userspace.environment @@ -14,6 +14,7 @@ #+{{pkg_install_name("s6-linux-init")}} #+{{pkg_install_name("mdevd")}} #+{{pkg_install_name("s6-dns")}} +#+{{pkg_install_name("libressl")}} #+{{pkg_install_name("s6-networking")}} #+{{pkg_install_name("zsh")}} #+{{pkg_install_name("pthbs-banginstall")}} @@ -23,7 +24,3 @@ #+{{pkg_install_name("fileset")}} #+{{pkg_install_name("logincaps")}} #+{{pkg_install_name("snaprep")}} -#+{{pkg_install_name("core-system-conf")}} -#+{{pkg_install_name("core-system-rc")}} -#+{{pkg_install_name("core-system-scripts")}} -#+{{pkg_install_name("core-system-init")}}