summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-05 22:54:29 +0100
committerdavidovski <david@davidovski.xyz>2022-05-05 22:54:29 +0100
commitb273972f3fcbc84c9114d32646c2ae3e46dd1590 (patch)
treefc66d2c13528d9e2e5a86895c6291c30679b5723
parent00ad91b7aa7266ae2ddd9b5e5264bb4cb3380b70 (diff)
removed old xibuild files with new xib.sh
-rwxr-xr-xbuild.sh14
-rw-r--r--sitegen/build_site.sh15
-rw-r--r--xib.sh138
-rwxr-xr-xxibuild/build_all.sh100
-rwxr-xr-xxibuild/build_order.pm134
-rwxr-xr-xxibuild/build_package.sh256
-rw-r--r--xibuild/build_profile26
-rwxr-xr-xxibuild/make_infos.sh91
-rwxr-xr-xxibuild/make_tools.sh619
-rwxr-xr-xxibuild/prepare.sh20
10 files changed, 114 insertions, 1299 deletions
diff --git a/build.sh b/build.sh
deleted file mode 100755
index 30ce94a..0000000
--- a/build.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-. ./xib_env
-
-cd xibuild
-./prepare.sh
-./build_all.sh || exit 1
-./make_infos.sh
-
-keychain="$XIB_EXPORT"/keychain
-mkdir -p $keychain
-cp $PUB_KEY $keychain/
-
-
diff --git a/sitegen/build_site.sh b/sitegen/build_site.sh
deleted file mode 100644
index 8daef8c..0000000
--- a/sitegen/build_site.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# builds the html files required for the xilinux website
-
-generate_index () {
- envsubst < templ/index.html
-}
-
-generate_package_list() {
- local repo_dir=$1
- for info_file in $repo_dir/*.xipkg.info; do
-
- done;
-}
-
-"$XIB_CHROOT"/
diff --git a/xib.sh b/xib.sh
index b380a75..e52d9dc 100644
--- a/xib.sh
+++ b/xib.sh
@@ -10,7 +10,9 @@ XIPKG_INSTALL=/usr/lib/xipkg/install.sh
xib_dir="/var/lib/xib"
priv_key="xi.pem"
-buildfiles="$xib_dir/buildfiles"
+#buildfiles="$xib_dir/buildfiles"
+buildfiles="/home/david/docs/proj/xilinux/buildfiles"
+seen="$xib_dir/seen"
chroot="$xib_dir/chroot"
stage="$xib_dir/stage"
local_repo="$xib_dir/repo"
@@ -19,13 +21,16 @@ keychain="$xib_dir/keychain"
# add a package to the repo's packages.list
#
publish_package () {
- local repo=$1
+ local repo=$1 name=$2
xipkgs=$(ls $stage/*.xipkg)
mv $stage/build.log $stage/$name.log
packageslist="$local_repo/$repo/packages.list"
depsgraph="$local_repo/deps.graph"
+ [ ! -d "$local_repo/$repo" ] && mkdir -p "$local_repo/$repo"
+ [ ! -f "$packageslist" ] && touch $packageslist
+ [ ! -f "$depsgraph" ] && touch $depsgraph
for xipkg in $xipkgs; do
local name=$(basename $xipkg ".xipkg")
@@ -40,43 +45,55 @@ publish_package () {
sed -i "s/^$name: //" $depsgraph
echo "$name: $deps" >> $depsgraph
- mv $stage/$xipkg $local_repo/$repo/$name.xipkg
- mv $stage/$xipkg.info $local_repo/$repo/$name.xipkg.info
- mv $stage/$name.xibuild $local_repo/$repo/$name.xibuild
- cp $stage/build.log $local_repo/$repo/$name.log
+ [ -f $stage/$name.xipkg ] && mv $stage/$name.xipkg $local_repo/$repo/$name.xipkg
+ [ -f $stage/$name.xipkg.info ] && mv $stage/$name.xipkg.info $local_repo/$repo/$name.xipkg.info
+ [ -f $stage/$name.xibuild ] && mv $stage/$name.xibuild $local_repo/$repo/$name.xibuild
+ [ -f $stage/build.log ] && cp $stage/build.log $local_repo/$repo/$name.log
+ done
+
+ [ ! -d "$seen" ] && mkdir -p $seen
+ for s in $stage/*.xibsum; do
+ s=$(basename $s)
+ mv $stage/$s $seen/$s
done
}
# get root package from package name
#
get_package_build () {
- local name=$1
- local buildfile=$(find $buildfiles/repo -name "$name.xibuild" | head -1)
- local name="$(realpath $buildfile | rev | cut -d'/' -f2 | rev)"
- local repo="$(realpath $buildfile | rev | cut -d'/' -f3 | rev)"
+ local buildfile=$(find $buildfiles/repo -name "$1.xibuild" | head -1)
+ echo ${buildfile%/*}
+}
- echo $buildfiles/repo/$repo/$name
+list_all () {
+ for repo in $(ls -1 $buildfiles/repo); do
+ for name in $(ls -1 $buildfiles/repo/$repo); do
+ echo "$repo/$name"
+ done
+ done
}
# get package file from package name
#
get_package_file () {
- local name=$1
- local pkgfile=$(find $local_repo/ -name "$name.xipkg" | head -1)
- echo $pkgfile
+ find $local_repo/ -name "$1.xipkg" | head -1
}
-# Use xibuild to build a singular package
+# Use xibuild to build a singular package, input is packagebuild dir
#
build_package () {
- local package=$(get_package_build $1)
+ local name=$(basename $1)
+
rm -rf $stage
mkdir -p $stage
- xibuild -k $keychain/$priv_key -c $package -d $stage -r $chroot
+ xibuild -v -k $keychain/$priv_key -c $1 -d $stage -r $chroot || return 1
+ get_buildfiles_hash $1 > $stage/$name.xibsum
}
+
package_install () {
local name=$1
local xipkg=$(get_package_file $1)
+
INSTALLED_DIR="$chroot/var/lib/xipkg/installed/"
SYSROOT=$chroot
VERBOSE=false
@@ -88,12 +105,12 @@ package_install () {
# get the direct dependencies of a single package
#
get_deps () {
- package=$(get_package_build $1)
- [ -d $package ] && {
+ local package=$(get_package_build $1)
+ [ -d $package ] &&
for buildfile in $package/*.xibuild; do
sed -rn "s/^.*DEPS=\"(.*)\"/\1/p" $buildfile
- done
- }
+ done | tr '\n' ' '
+
}
list_deps () {
@@ -114,13 +131,86 @@ list_deps () {
echo "$deps"
}
+get_buildfiles_hash () {
+ cat $1/*.xibuild | sha512sum | cut -d' ' -f1
+}
+
xib_single () {
local name=$1
- local deps=$(list_deps $name)
+ local deps=$(get_deps $name)
+ missing=""
for dep in $deps; do
- [ -e "$chroot/var/lib/xipkg/installed/$name" ] || {
- install_package $(get_package_file $name) $name
+ [ -e "$chroot/var/lib/xipkg/installed/$dep" ] || {
+ pkgfile=$(get_package_file $dep)
+ [ "${#pkgfile}" = "0" ] && missing="$missing $dep"
+ printf "${LIGHT_GREEN}+${LIGHT_CYAN}install $dep"
+ install_package $(get_package_file $dep) $dep
+ }
+ done
+
+ [ "${#missing}" != "0" ] && {
+ printf "${RED}This package requires the following to be installed in order to build: ${LIGHT_RED}$missing\n"
+ return 1
+ }
+
+ package=$(get_package_build $name)
+ repo=$(echo "$package" | rev | cut -f2 -d'/' | rev)
+ build_package $package || return 1
+ publish_package $repo $name
+}
+
+xib_all () {
+ for name in $(build_order); do
+ # TODO CHECK IF the package is already built
+
+ package=$(get_package_build $name)
+ [ "${#package}" != 0 ] && [ -d "$package" ] && {
+ xibsum=$(get_buildfiles_hash $package)
+ [ -f "$seen/$name.xibsum" ] && [ "$(cat "$seen/$name.xibsum")" = "$xibsum" ] && {
+ printf "${BLUE}$name${LIGHT_BLUE}...already built!\n"
+ } || {
+ xib_single $name || return 1
+ }
+ } || {
+ printf "${RED} could not find package for $name in $package $RESET\n"
+ return 1
}
done
}
+reverse_lines () {
+ local result=
+ while IFS= read -r line; do
+ result="$line
+ $result"
+ done
+ echo "$result"
+}
+
+build_order () {
+ for pkg in $(list_all); do
+ set -- $(echo $pkg | tr '/' ' ')
+ repo=$1
+ name=$2
+ [ "$repo" != "meta" ] &&
+ for dep in $(get_deps $name); do
+ echo $name $dep
+ done
+ done | tsort | reverse_lines
+}
+
+xibd () {
+ cd $buildfiles
+ git pull
+ cd $xib_dir
+ xib_all
+}
+
+[ "$#" = 0 ] && {
+ xib_all
+} || {
+ for x in $@; do
+ xib_single $x
+ done
+}
+
diff --git a/xibuild/build_all.sh b/xibuild/build_all.sh
deleted file mode 100755
index ffa6c03..0000000
--- a/xibuild/build_all.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-ERROR="\033[0;31m"
-INFO="\033[0;34m"
-PASS="\033[0;32m"
-NEUTRAL="\033[0;33m"
-EXTRA="\033[0;30m"
-RESET="\033[0m"
-
-XIPKG_INSTALL=/usr/lib/xipkg/install.sh
-[ -f $XIPKG_INSTALL ] && . $XIPKG_INSTALL
-
-# scan and run all postinstall scripts
-#
-run_postinstall () {
- postinstall="$XIB_CHROOT/var/lib/xipkg/postinstall"
- if [ -d $postinstall ]; then
- printf "${EXTRA}(postinstall "
- for file in $(ls $postinstall); do
- file=$postinstall/$file
- f=$(basename $file)
-
- # run the postinstall file
- #
- chmod 755 $file
- xichroot "$XIB_CHROOT" "/var/lib/xipkg/postinstall/$f"
- if [ "$?" = "0" ]; then
- rm $file
- printf "${PASS}${CHECKMARK}"
- else
- printf "${EXTRA}x"
- fi
- done
- printf ")\n"
-
- [ "$(ls $postinstall | wc -w)" = 0 ] && \
- rmdir $postinstall
- fi
-}
-
-extract () {
- tar -h -p -vvxf $1 -C ${SYSROOT} 2>${LOG_FILE} | grep ^- | tr -s " " | cut -d" " -f6 | cut -c2-
-}
-
-
-# build a package by its name
-#
-build_package () {
-
- local name=$(echo $1 | cut -d"+" -f1)
- local install=$(echo $line | grep -q '+' && echo "true" || echo "false")
- local buildfile=$(find $XIB_BUILDFILES/repo/ -wholename "*/$name.xibuild" | head -1)
-
- if [ -f "$buildfile" ]; then
- printf "${INFO}%s\n${RESET}" $name
- ./build_package.sh $buildfile || return 1
-
- # install the package it exists
- local exported_pkg=$(find $XIB_EXPORT -wholename "*/$name.xipkg" | head -1 | xargs realpath)
- if $install && [ -f $exported_pkg ] ; then
- printf "${INFO}${TABCHAR}install "
- INSTALLED_DIR="$XIB_CHROOT/var/lib/xipkg/installed/"
- SYSROOT=$XIB_CHROOT
- VERBOSE=false
- install_package $exported_pkg $name && printf "${PASS}${CHECKMARK}\n" || printf "${NEUTRAL}${CHECKMARK}\n"
- run_postinstall
- fi
-
- return 0
- fi
-
- printf "${ERROR}${CROSSMARK} ${name}\n"
-}
-
-# build all of the packages
-#
-build_all () {
- all="$(perl build_order.pm)"
- echo "Building $(echo "$all" | wc -l )"
- for line in $all; do
- build_package $line || return 1
- done
-}
-
-while true; do
- if build_all; then
- printf "\n${PASS}Built all packages!\n${RESET}"
- exit 0
- else
- printf "${ERROR} Something went wrong!${NEUTRAL} Press enter to view recent log"
- read out;
-
- less $(ls -t1 $XIB_EXPORT/repo/*/*.log | head -1 | xargs realpath)
-
- read -p "Retry build? [Y/n]" response
- if [ "$response" = "n" ]; then
- exit 1
- fi
- fi
-done
diff --git a/xibuild/build_order.pm b/xibuild/build_order.pm
deleted file mode 100755
index c3f31f6..0000000
--- a/xibuild/build_order.pm
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/env perl
-
-# TODO for building the whole system
-# We first need to have a base system that we can build from
-# (up to chapter 6 in lfs book, done by make_tools.sh)
-# packages need to be build in order of importance
-# need to some how find out which packages are the most important and build and install them to the chroot first
-# build a package, install it if necessary
-# copy the generated package/info to a safe place
-# sign the package
-# put the package in the export folder
-
-# TODO for building a single package:
-# do all the preliminary checks (exists, deps are installed, etc)
-# download source to $chroot/source
-# download additional tools
-# copy xibuild to the chroot
-# create a "build.sh" script in the chroot
-# - run the 3 stages of package building
-# - create the pacakage in $chroot/$name.xipkg
-# - add some info to package info
-# - if requested, install to the chroot
-
-use strict;
-use warnings;
-
-use Env;
-use File::Basename;
-use lib dirname (__FILE__);
-use Sort::TSort "tsort";
-
-our $buildfiles = $ENV{XIB_BUILDFILES};
-
-sub list_dependencies{
- my $file = $_;
- my @deps = ();
-
- open (my $fh, "<", $file) or warn "Cannot open $file";
-
- while (my $line = <$fh>) {
- if ($line =~ /DEPS="(.+)"/) {
- my @words = split(/ /, $1);
- push(@deps, @words);
- }
- }
-
- return @deps;
-}
-
-sub list_buildfiles{
- my @files = glob("$buildfiles/repo/*/*.xibuild");
- # ignore any meta packages during this stage, they can be added later
- @files = grep(!/\/meta\//, @files);
- @files = grep(!/\/skip\//, @files);
-
- return @files
-}
-
-sub list_meta_pkgs{
- return map({basename($_, ".xibuild")} glob("$buildfiles/repo/meta/*.xibuild"));
-}
-
-sub get_packages{
- my %pkgs = ();
-
- my @files = list_buildfiles();
-
- foreach (@files) {
- my $pkg_file = $_;
- my $pkg_name = basename($pkg_file, ".xibuild");
-
- my @deps = list_dependencies($pkg_file);
- $pkgs{$pkg_name} = \@deps;
- }
-
- return %pkgs;
-}
-
-# Get a list of all the edges
-sub get_edges{
- my %pkgs = @_;
-
- my @edges = ();
- foreach (keys(%pkgs)) {
- my $pkg = $_;
- my @deps = @{$pkgs{$_}};
- foreach (@deps) {
- my $dep = $_;
-
- my @edge = ($pkg, $dep);
- push @edges, [ @edge ];
-
- }
- }
- return @edges;
-}
-
-# Determine which packages are depended on
-sub get_depended_on{
- my @edges = @_;
-
- my %install = ();
- foreach (@edges) {
- my @edge = @{$_};
- $install{$edge[1]} = $edge[0];
- }
-
- return keys(%install);
-}
-
-sub determine_build_order{
- my %pkgs = get_packages();
-
- my @edges = get_edges(%pkgs);
-
- my @install = get_depended_on(@edges);
-
- # use tsort to determine the build order
- my @sorted = reverse(@{tsort(\@edges)});
-
- my @meta = list_meta_pkgs();
- push(@sorted, @meta);
-
- foreach(@sorted) {
- my $pkg = $_;
- print("$pkg");
- print("+") if (grep(/^$pkg/, @install));
- print("\n");
- }
-}
-
-unless (caller) {
- determine_build_order();
-}
diff --git a/xibuild/build_package.sh b/xibuild/build_package.sh
deleted file mode 100755
index fcdf881..0000000
--- a/xibuild/build_package.sh
+++ /dev/null
@@ -1,256 +0,0 @@
-#!/bin/bash
-
-GREEN="\033[0;32m"
-BLUE="\033[0;34m"
-
-BUILDFILE=$1
-REPO=$(echo $BUILDFILE | rev | cut -d/ -f2 | rev)
-NAME=$(basename $BUILDFILE .xibuild)
-
-
-# extract an archive using its appropriate tool
-#
-extract () {
- FILE=$1
- case "${FILE##*.}" in
- "gz" )
- tar -zxf $FILE
- ;;
- "lz" )
- tar --lzip -xf "$FILE"
- ;;
- "zip" )
- unzip -qq -o $FILE
- ;;
- * )
- tar -xf $FILE
- ;;
- esac
-}
-
-# check if the package we want to build already exists, comparing hashes of the build file
-#
-package_exists () {
- local exported="$XIB_EXPORT/repo/$REPO/$NAME"
- local exported_pkg="$exported.xipkg"
- local exported_pkg_info="$exported.xipkg.info"
- local exported_pkg_build="$exported.xibuild"
-
- if [ -f $exported_pkg ] && [ -f $exported_pkg_build ]; then
- local built_sum=$(md5sum $exported_pkg_build | cut -d" " -f1)
- local current_sum=$(md5sum $BUILDFILE | cut -d" " -f1)
-
- if [ "$built_sum" = "$current_sum" ]; then
- return 0
- fi
- fi
-
- return 1
-}
-
-# downloads the source and any additional files
-#
-fetch_source () {
- local src_dir="$XIB_CHROOT/build/source"
- mkdir -p $src_dir
-
- cd $src_dir
-
- if [ ! -z ${SOURCE} ]; then
-
- if git ls-remote -q $SOURCE $BRANCH > /dev/null 2>&1; then
- # the source is a git repo
- git clone $SOURCE . > /dev/null 2>&1
- git checkout $BRANCH > /dev/null 2>&1
- else
- # otherwise the source is a file
-
- local downloaded_file=$(basename $SOURCE)
- curl -SsL $SOURCE > $downloaded_file
- extract $downloaded_file
-
- # if the extracted file only had one directory
- if [ "$(ls -1 | wc -l)" = "2" ]; then
- for file in */* */.*; do
- echo $file | grep -q '\.$' || mv $file .
- done;
- fi
- fi
- fi
-
- set -- ${ADDITIONAL}
- # download additional files
- if [ "$#" != 0 ]; then
- for url in $@; do
- case $url in
- http*)
- ;;
- *)
- url="file://${XIB_BUILDFILES}/repo/$REPO/$NAME/$url"
- ;;
- esac
-
- local name=$(basename $url)
- curl -SsL $url > $src_dir/$name
- done
- fi
-}
-
-# removes any unecessary files from the chroot, from previous builds
-#
-clean_chroot () {
- local export_dir="$XIB_CHROOT/export"
- local build_dir="$XIB_CHROOT/build"
-
- rm -rf $export_dir
- rm -rf $build_dir
-
- mkdir -p $export_dir
- mkdir -p $build_dir
-
- mkdir -p "$XIB_EXPORT/repo/$REPO/"
-}
-
-prepare_build_env () {
- clean_chroot
-
- cp "$BUILDFILE" "$XIB_CHROOT/build/"
- printf $NAME > "$XIB_CHROOT/build/name"
-}
-
-# generate the script that will be used to build the xibuild
-#
-make_buildscript () {
-
- cat $BUILD_PROFILE > "$XIB_CHROOT/build/profile"
- cat > "$XIB_CHROOT/build/build.sh" << "EOF"
-#!/bin/sh
-. /build/profile
-export PKG_NAME=$(cat /build/name)
-export PKG_DEST=/export
-
-prepare () {
- echo "passing prepare"
-}
-
-build () {
- echo "passing build"
-}
-
-check () {
- echo "passing check"
-}
-
-package () {
- echo "passing package"
-}
-
-cd /build
-ls
-. ./$PKG_NAME.xibuild
-cd /build/source
-
-echo "==========================PREPARE STAGE=========================="
-prepare || exit 1
-echo "==========================BUILD STAGE=========================="
-build || exit 1
-echo "==========================CHECK STAGE=========================="
-check || exit 1
-echo "==========================PACKAGE STAGE=========================="
-package || exit 1
-
-printf "checking for postinstall... "
-if command -v postinstall > /dev/null; then
- echo "adding postinstall"
- POST_DIR=$PKG_DEST/var/lib/xipkg/postinstall
- mkdir -p $POST_DIR
- cat /build/$PKG_NAME.xibuild > $POST_DIR/$PKG_NAME.sh
- echo "" >> $POST_DIR/$PKG_NAME.sh
- echo "postinstall" >> $POST_DIR/$PKG_NAME.sh
-else
- echo "no postinstall"
-fi
-EOF
- chmod 700 "$XIB_CHROOT/build/build.sh"
-}
-
-# package the dest files into a xipkg
-#
-package_dest () {
- local export_repo="$XIB_EXPORT/repo/$REPO"
- local export_pkg="$XIB_EXPORT/repo/$REPO/$NAME.xipkg"
- local pkg_dest="$XIB_CHROOT/export"
-
- cd "$pkg_dest"
-
- # ensure that the package actually exists
- if [ "$(ls -1 | wc -l)" = "0" ]; then
- printf " package is empty;"
- [ -z "${SOURCE}" ] || exit 1;
- fi
-
- tar -C $pkg_dest -czf $export_pkg ./
-
- # export the buildfile
- cp "$BUILDFILE" "$XIB_EXPORT/repo/$REPO/"
-}
-
-# strip debug symbols
-#
-strip_dest () {
- local pkg_dest="$XIB_CHROOT/export"
- for file in \
- $(find $pkg_dest/ -type f -name \*.so* ! -name \*dbg) \
- $(find $pkg_dest/ -type f -name \*.a) \
- $(find $pkg_dest/ -type f -executable ); do
- strip --strip-unneeded $file
- done
-
- find $pkg_dest -name \*.la -delete
-}
-
-# build the package
-#
-build_pkg () {
- local log_file="$XIB_EXPORT/repo/$REPO/$NAME.log"
-
- printf "${BLUE}${TABCHAR}prepare "
- prepare_build_env || return 1
- printf "${GREEN}${CHECKMARK}\n"
-
- printf "${BLUE}${TABCHAR}fetch "
- fetch_source || return 1
- printf "${GREEN}${CHECKMARK}${RESET}${INFOCHAR}$(du -sh "$XIB_CHROOT/build/source" | awk '{ print $1 }')\n"
-
- printf "${BLUE}${TABCHAR}generate "
- make_buildscript || return 1
- printf "${GREEN}${CHECKMARK}\n"
-
- printf "${BLUE}${TABCHAR}build "
- xichroot $XIB_CHROOT /build/build.sh > $log_file 2>&1 || return 1
- printf "${GREEN}${CHECKMARK}\n"
-
- printf "${BLUE}${TABCHAR}clean "
- strip_dest >> $log_file 2>&1 || return 1
- printf "${GREEN}${CHECKMARK}\n"
-
- printf "${BLUE}${TABCHAR}package "
- package_dest || return 1
- printf "${GREEN}${CHECKMARK}${RESET}${INFOCHAR}$(du -sh "$XIB_EXPORT/repo/$REPO/$NAME.xipkg" | awk '{ print $1 }')!\n"
-
- # export the buildfile
-}
-
-#
-# IMPORTANT
-#
-# this script will attempt to build the package in a suitable chroot environment
-# if one is not specified then unwanted consequences can occur
-# using XIB_CHROOT=/ could be a possbility but be aware of the risks
-#
-[ -z "${XIB_CHROOT}" ] && echo "${RED}CRITICAL! ${RESET}No chroot env variable set!" && exit 1;
-
-# import all of the functions and constants in the build file, so we know what to do
-. $BUILDFILE
-package_exists || build_pkg
-
diff --git a/xibuild/build_profile b/xibuild/build_profile
deleted file mode 100644
index b1ddb89..0000000
--- a/xibuild/build_profile
+++ /dev/null
@@ -1,26 +0,0 @@
-export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin:/tools/sbin
-export LIBRARY_PATH=/lib:/usr/lib/:/tools/lib:/tools/lib64
-
-apply_patches () {
- for p in *.patch; do
- echo "Applying $p"
- patch -Np1 -i $p
- done
-}
-
-export JOBS=$(grep "processor" /proc/cpuinfo | wc -l)
-export HOME=/root
-
-export MAKEFLAGS="-j$JOBS"
-export XORG_PREFIX="/usr"
-
-export XORG_CONFIG="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-static"
-export BUILD_ROOT="/build/source"
-export RUST_TARGET="x86_64-unknown-linux-musl"
-#command -v clang &&
-# export CC="clang"
-
-#command -v clang++ &&
-# export CXX="clang++"
-
-ldconfig
diff --git a/xibuild/make_infos.sh b/xibuild/make_infos.sh
deleted file mode 100755
index 7d76c86..0000000
--- a/xibuild/make_infos.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-
-
-# TODO remember to update this if there are ever changes
-XIPKG_INFO_VERSION='03'
-
-get_info() {
- local name=$(basename $1 ".xipkg")
-
- local pkg_ver=$PKG_VER
- [ -z "$pkg_ver" ] && pkg_ver=$BRANCH
- [ -z "$pkg_ver" ] && pkg_ver="latest"
-
- echo "# XiPKG info file version $XIPKG_INFO_VERSION"
- echo "# automatically generated from the built packages"
- echo "NAME=$name"
- echo "DESCRIPTION=$DESC"
- echo "PKG_FILE=$name.xipkg"
- echo "CHECKSUM=$(md5sum $1 | awk '{ print $1 }')"
- echo "VERSION=$pkg_ver"
- echo "SOURCE=$SOURCE"
- echo "DATE=$(stat -t $1 | cut -d' ' -f13 | xargs date -d)"
- echo "DEPS=${DEPS}"
- echo "MAKE_DEPS=${MAKE_DEPS}"
-}
-
-sign () {
- printf "SIGNATURE="
- openssl dgst -sign $PRIV_KEY $1 | base64 | tr '\n' ' '
- printf "\n"
-}
-
-list_line() {
- local pkg_file=$1
-
- local name=$(basename $pkg_file ".xipkg" )
- local filecount=$(gzip -cd $pkg_file | tar -tvv | grep -c ^-)
- local checksum=$(md5sum $pkg_file | awk '{ print $1 }')
- local size=$(stat -t $pkg_file | cut -d" " -f2)
-
- echo $name.xipkg $checksum $size $filecount
-}
-
-list_deps() {
- local info_file=$1
- local deps=$(grep "^DEPS=" $info_file | sed -rn 's/DEPS=(.*)/\1/p')
- local name=$(basename $info_file ".xipkg.info" )
-
- echo "$name: $deps"
-}
-
-
-list=$(ls -d "$XIB_EXPORT"/repo/*)
-total=$(echo $list | wc -w)
-i=0
-for repo in $list; do
- file="$repo/packages.list"
- [ -e $file ] && rm $file
- touch $file
-
- hbar -T "removing old repos" $i $total
- i=$((i+1))
-done
-hbar -t -T "removing old repos" $i $total
-
-graph_file="$XIB_EXPORT"/repo/deps.graph
-[ -f $graph_file ] && rm $graph_file
-
-list=$(find "$XIB_EXPORT"/repo/ -name "*.xipkg")
-total=$(echo $list | wc -w)
-i=0
-for pkg in $list; do
- name=$(basename $pkg ".xipkg")
- repo=$(echo $pkg | rev | cut -d/ -f2 | rev)
- info_file="$XIB_EXPORT/repo/$repo/$name.xipkg.info"
- build_file="$XIB_EXPORT/repo/$repo/$name.xibuild"
-
- . $build_file
-
- get_info $pkg > $info_file
- sign $pkg >> $info_file
- list_line $pkg >> "$XIB_EXPORT"/repo/$repo/packages.list
- [ -f $info_file ] && list_deps $info_file >> $graph_file
-
- hbar -T "generating info" $i $total
- i=$((i+1))
-done
-hbar -t -T "generating info" $i $total
-printf "${INFO}Created $i info files!\n"
-
-
diff --git a/xibuild/make_tools.sh b/xibuild/make_tools.sh
deleted file mode 100755
index 10b70b5..0000000
--- a/xibuild/make_tools.sh
+++ /dev/null
@@ -1,619 +0,0 @@
-#!/bin/bash
-# A small script to generate the chroot environment where building will take place
-
-export MAKEFLAGS="-j$(grep "processor" /proc/cpuinfo | wc -l)"
-export WORKING_DIR="/var/lib/xib"
-BUILDFILES_REPO_URL="https://xi.davidovski.xyz/git/buildfiles.git"
-export SYSTEM_DIR="$WORKING_DIR/xib-chroot"
-
-TOOL_DIR="$SYSTEM_DIR/tools"
-SOURCES="$SYSTEM_DIR/sources"
-
-TGT=$(uname -m)-xi-linux-gnu
-
-
-export PATH=/usr/bin
-if [ ! -L /bin ]; then export PATH=/bin:$PATH; fi
-export PATH=$SYSTEM_DIR/tools/bin:$PATH
-export CONFIG_SITE=$SYSTEM_DIR/usr/share/config.site
-export LC_ALL=POSIX
-
-set +h
-umask 022
-
-
-
-packages=(binutils gcc linux glibc mpfr gmp mpc m4 ncurses bash coreutils diffutils file findutils gawk grep gzip make patch sed tar xz)
-
-get_build_files() {
- mkdir -p $WORKING_DIR/buildfiles
- git clone "$BUILDFILES_REPO_URL" $WORKING_DIR/buildfiles
-}
-
-list_build_files() {
- ls -1 $WORKING_DIR/buildfiles/repo/*/*.xibuild
-}
-
-parse_package_versions() {
- for pkg_file in $(list_build_files); do
- local pkg_name=$(basename -s .xibuild $pkg_file)
- local pkg_ver=$(sed -n "s/^PKG_VER=\(.*\)$/\1/p" $pkg_file)
-
- [ -z "$pkg_ver" ] && pkg_ver=$(sed -n "s/^BRANCH=\(.*\)$/\1/p" $pkg_file)
- [ -z "$pkg_ver" ] && pkg_ver="latest"
- printf "%-16s %16s\n" $pkg_name $pkg_ver
- done
-}
-
-extract () {
- FILE=$1
- case "${FILE#*.}" in
- "tar.gz" )
- tar -zxf $FILE
- ;;
- "tar.lz" )
- tar --lzip -xf "$FILE"
- ;;
- "zip" )
- unzip $FILE
- ;;
- * )
- tar -xf $FILE
- ;;
- esac
-}
-
-
-make_dir_struct() {
- local system=$1
-
- mkdir -pv $system/{etc,var,proc,sys,run,tmp} $system/usr/{bin,lib,sbin} $system/dev/{pts,shm}
-
- for i in bin lib sbin; do
- ln -sv usr/$i $system/$i
- done
-
- case $(uname -m) in
- x86_64) mkdir -pv $system/lib64 ;;
- esac
-}
-
-extract () {
- FILE=$1
- case "${FILE#*.}" in
- "tar.gz" )
- tar -zxf $FILE
- ;;
- "tar.lz" )
- tar --lzip -xf "$FILE"
- ;;
- "zip" )
- unzip $FILE
- ;;
- * )
- tar -xf $FILE
- ;;
- esac
-}
-
-init_versions() {
- local versions_file="$SYSTEM_DIR/versions"
-
- [ -f $versions_file ] || exit 1
-
- for i in ${packages[@]}; do
- local name=${i^^}
- local version=$(sed -n "s/^$i \s*\(.*\)$/\1/p" $versions_file)
- eval "${i^^}_VERSION"="$version"
- done
-}
-
-get_source() {
- local buildfile="$1"
- local package_name=$(basename -s .xibuild $buildfile)
-
- echo "fetching $buildfile"
-
- if [ ! -d $package_name ]; then
- mkdir -p $package_name
- cd $package_name
- rm -rf *
- source $buildfile
-
- if git ls-remote -q $SOURCE $BRANCH &> /dev/null; then
- git clone $SOURCE .
- git checkout $BRANCH
-
- elif hg identify $SOURCE &> /dev/null; then
- hg clone $SOURCE package_name .
- else
- local downloaded=$(basename $SOURCE)
- curl -Ls $SOURCE > $downloaded
- extract $downloaded
- mv */* .
- fi
- fi
-}
-
-get_sources() {
- mkdir -p $SYSTEM_DIR/sources
- for pkg in $@; do
- local pkg_file="$WORKING_DIR/buildfiles/repo/*/$pkg.xibuild"
- cd $SYSTEM_DIR/sources
- get_source $pkg_file
- done
-}
-
-# builds binutils to toolchain
-#
-build_binutils1() {
- cd $SOURCES/binutils/
-
- mkdir -v build
- cd build
-
- ../configure --prefix="$SYSTEM_DIR/tools" \
- --with-sysroot="$SYSTEM_DIR" \
- --target=$TGT \
- --disable-nls \
- --disable-werror &&
- make &&
- make install -j1
-}
-
-
-# builds gcc to toolchain
-#
-build_gcc1() {
- cd $SOURCES/gcc/
-
- #rm -rf mpfr gmp mpc
-
- autoreconf -i
-
- [ -d mpfr ] || cp -r $SOURCES/mpfr mpfr
- [ -d gmp ] || cp -r $SOURCES/gmp gmp
- [ -d mpc ] || cp -r $SOURCES/mpc mpc
-
- sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
-
- mkdir -v build
- cd build
-
- ../configure \
- --target=$TGT \
- --prefix=$SYSTEM_DIR/tools \
- --with-glibc-version=$GLIBC_VERSION \
- --with-sysroot=$SYSTEM_DIR \
- --with-newlib \
- --without-headers \
- --without-zstd \
- --enable-initfini-array \
- --disable-nls \
- --disable-shared \
- --disable-multilib \
- --disable-decimal-float \
- --disable-threads \
- --disable-libatomic \
- --disable-libgomp \
- --disable-libquadmath \
- --disable-libssp \
- --disable-libvtv \
- --disable-libstdcxx \
- --enable-languages=c,c++
-
- make &&
- make install || exit 1
- cd ..
- cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
- `dirname $($TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h
-}
-
-build_linux_headers() {
- cd $SOURCES/linux/
-
- make mrproper
-
- make headers
- find usr/include -name '.*' -delete
- rm usr/include/Makefile
- cp -rv usr/include $SYSTEM_DIR/usr
-}
-
-build_glibc() {
- cd $SOURCES/glibc/
-
- case $(uname -m) in
- i?86) ln -sfv ld-linux.so.2 $SYSTEM_DIR/lib/ld-lsb.so.3
- ;;
- x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $SYSTEM_DIR/lib64
- ln -sfv ../lib/ld-linux-x86-64.so.2 $SYSTEM_DIR/lib64/ld-lsb-x86-64.so.3
- ;;
- esac
-
- mkdir -v build
- cd build
-
- echo "rootsbindir=/usr/sbin" > configparms
- ../configure \
- --prefix=/usr \
- --host=$TGT \
- --build=$(../scripts/config.guess) \
- --enable-kernel=3.2 \
- --with-headers=$SYSTEM_DIR/usr/include \
- libc_cv_slibdir=/usr/lib
-
- make &&
- make DESTDIR=$SYSTEM_DIR install
-
- sed '/RTLDLIST=/s@/usr@@g' -i $SYSTEM_DIR/usr/bin/ldd
-
- $SYSTEM_DIR/tools/libexec/gcc/$TGT/$GCC_VERSION/install-tools/mkheaders
-}
-
-build_libstdcxx() {
- cd $SOURCES/gcc/
-
- rm -rf build
- mkdir build
- cd build
-
- ../libstdc++-v3/configure \
- --host=$TGT \
- --build=$(../config.guess) \
- --prefix=/usr \
- --disable-multilib \
- --disable-nls \
- --disable-libstdcxx-pch \
- --with-gxx-include-dir=/tools/$SYSTEM_DIR/include/c++/$GCC_VERSION
-
- make &&
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_m4() {
- cd $SOURCES/m4/
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(build-aux/config.guess)
-
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_ncurses() {
- cd $SOURCES/ncurses/
-
- sed -i s/mawk// configure
- mkdir build
-
- pushd build
- ../configure
- make -C include
- make -C progs tic
- popd
-
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(./config.guess) \
- --mandir=/usr/share/man \
- --with-manpage-format=normal \
- --with-shared \
- --without-debug \
- --without-ada \
- --without-normal \
- --disable-stripping \
- --enable-widec
-
- make
- make DESTDIR=$SYSTEM_DIR TIC_PATH=$(pwd)/build/progs/tic install
- echo "INPUT(-lncursesw)" > $SYSTEM_DIR/usr/lib/libncurses.so
-}
-
-build_bash() {
- cd $SOURCES/bash/
-
- ./configure --prefix=/usr \
- --build=$(support/config.guess) \
- --host=$TGT \
- --without-bash-malloc
-
- make
- make DESTDIR=$SYSTEM_DIR install
- ln -sv bash $SYSTEM_DIR/bin/sh
-}
-
-build_coreutils() {
- cd $SOURCES/coreutils/
-
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(build-aux/config.guess) \
- --enable-install-program=hostname \
- --enable-no-install-program=kill,uptime
-
- make
- make DESTDIR=$SYSTEM_DIR install
-
- mv -v $SYSTEM_DIR/usr/bin/chroot $SYSTEM_DIR/usr/sbin
- mkdir -pv $SYSTEM_DIR/usr/share/man/man8
- mv -v $SYSTEM_DIR/usr/share/man/man1/chroot.1 $SYSTEM_DIR/usr/share/man/man8/chroot.8
- sed -i 's/"1"/"8"/' $SYSTEM_DIR/usr/share/man/man8/chroot.8
-}
-
-build_diffutils() {
- cd $SOURCES/diffutils/
-
- ./configure --prefix=/usr --host=$TGT
-
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_file() {
- cd $SOURCES/file/
-
- mkdir build
- pushd build
- ../configure --disable-bzlib \
- --disable-libseccomp \
- --disable-xzlib \
- --disable-zlib
- make
- popd
-
- ./configure --prefix=/usr --host=$TGT --build=$(./config.guess)
-
- make FILE_COMPILE=$(pwd)/build/src/file
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_findutils() {
- cd $SOURCES/findutils/
-
- ./configure --prefix=/usr \
- --localstatedir=/var/lib/locate \
- --host=$TGT \
- --build=$(build-aux/config.guess)
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_gawk() {
- cd $SOURCES/gawk/
- sed -i 's/extras//' Makefile.in
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(build-aux/config.guess)
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_grep() {
- cd $SOURCES/grep
-
-./configure --prefix=/usr \
- --host=$TGT
-make
-make DESTDIR=$SYSTEM_DIR install
-}
-
-build_gzip() {
- cd $SOURCES/gzip/
- ./configure --prefix=/usr --host=$TGT
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_make() {
- cd $SOURCES/make/
- ./configure --prefix=/usr \
- --without-guile \
- --host=$TGT \
- --build=$(build-aux/config.guess)
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_patch() {
- cd $SOURCES/patch/
-
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(build-aux/config.guess)
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_sed() {
- cd $SOURCES/sed/
-
- ./configure --prefix=/usr --host=$TGT
-
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_tar() {
- cd $SOURCES/tar/
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(build-aux/config.guess)
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_xz() {
- cd $SOURCES/xz/
-
- ./configure --prefix=/usr \
- --host=$TGT \
- --build=$(build-aux/config.guess) \
- --disable-static \
- --docdir=/usr/share/doc/xz-$XZ_VERSION
- make
- make DESTDIR=$SYSTEM_DIR install
-}
-
-build_binutils2() {
- cd $SOURCES/binutils/
- make clean
- rm -rf build
- mkdir -v build
- cd build
- ../configure \
- --prefix=/usr \
- --build=$(../config.guess) \
- --host=$TGT \
- --disable-nls \
- --enable-shared \
- --disable-werror \
- --enable-64-bit-bfd
- make
- make DESTDIR=$SYSTEM_DIR install -j1
- install -vm755 libctf/.libs/libctf.so.0.0.0 $SYSTEM_DIR/usr/lib
-}
-
-build_gcc2() {
- cd $SOURCES/gcc/
-
- rm -rf build
- rm -rf mpc gmp mpfr
- [ -d mpfr ] || cp -r $SOURCES/mpfr mpfr
- [ -d gmp ] || cp -r $SOURCES/gmp gmp
- [ -d mpc ] || cp -r $SOURCES/mpc mpc
- mkdir -v build
- cd build
-
- mkdir -pv $TGT/libgcc
- ln -s ../../../libgcc/gthr-posix.h $TGT/libgcc/gthr-default.h
- ../configure \
- --build=$(../config.guess) \
- --host=$TGT \
- --prefix=/usr \
- CC_FOR_TARGET=$TGT-gcc \
- --with-build-sysroot=$SYSTEM_DIR \
- --enable-initfini-array \
- --disable-nls \
- --disable-multilib \
- --disable-decimal-float \
- --disable-libatomic \
- --disable-libgomp \
- --disable-libquadmath \
- --disable-libssp \
- --disable-libvtv \
- --disable-libstdcxx \
- --enable-languages=c,c++
- make
- make DESTDIR=$SYSTEM_DIR install
- ln -sv gcc $SYSTEM_DIR/usr/bin/cc
-}
-
-if [ -e $SYSTEM_DIR ]; then
- printf "Remove existing system? [Y/n] "
- read response
-
- if [ "$response" != "n" ]; then
- rm -rf $SYSTEM_DIR
- echo "removed $SYSTEM_DIR"
- fi
-fi
-
-
-mkdir -p "$SYSTEM_DIR"
-get_build_files
-parse_package_versions > "$SYSTEM_DIR/versions"
-
-get_sources ${packages[@]}
-
-make_dir_struct $SYSTEM_DIR
-init_versions
-
-reset_before_build () {
- cd $SYSTEM_DIR; printf "\033[0;34mbuilding $1...\033[0m"
-}
-
-for package in ${packages[@]}; do
- cd $SYSTEM_DIR
- touch $package.build.log
-done
-
-reset_before_build "binutils1"
-build_binutils1 &> binutils.build.log && printf "passed\n" || exit 1
-
-reset_before_build "gcc1"
-build_gcc1 &> gcc1.build.log && printf "passed\n" || exit 1
-
-reset_before_build "linux_headers"
-build_linux_headers &> linux-headers.build.log && printf "\033[0;32mpassed\n" || exit 1
-
-reset_before_build "glibc"
-build_glibc &> glibc.build.log && printf "\033[0;32mpassed\n" || exit 1
-
-reset_before_build "libstdcxx"
-build_libstdcxx &> libstdcxx.build.log && printf "\033[0;32mpassed\n" || exit 1
-
-reset_before_build "m4"
-build_m4 &> m4.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "ncurses"
-build_ncurses &> ncurses.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "bash"
-build_bash &> bash.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "coreutils"
-build_coreutils &> coreutils.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "diffutils"
-build_diffutils &> diffutils.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "file"
-build_file &> file.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "findutils"
-build_findutils &> findutils.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "gawk"
-build_gawk &> gawk.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "grep"
-build_grep &> grep.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "gzip"
-build_gzip &> gzip.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "make"
-build_make &> make.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "patch"
-build_patch &> patch.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "sed"
-build_sed &> sed.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "tar"
-build_tar &> tar.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "xz"
-build_xz &> xz.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "binutils2"
-build_binutils2 &> bintuils2.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-reset_before_build "gcc2"
-build_gcc2 &> gcc2.build.log && printf "\033[0;32mpassed\n" || printf "\0330;34mFAIL\n"
-
-
-echo "DONE"
-
-printf "Clean sources and logs? [Y/n]"
-read response
-
-if [ "$response" != "n" ]; then
- rm -rf $SYSTEM_DIR/*.log
- rm -rf $SYSTEM_DIR/sources
- echo "removed $SYSTEM_DIR/sources"
-fi
-
-
diff --git a/xibuild/prepare.sh b/xibuild/prepare.sh
deleted file mode 100755
index 54e1d81..0000000
--- a/xibuild/prepare.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-mkdir -p $XIB_DIR $XIB_BUILDFILES $XIB_CHROOT $XIB_EXPORT
-
-if [ -d $DEVELOPMENT_BUILDFILES ]; then
- export XIB_BUILDFILES=$DEVELOPMENT_BUILDFILES
- echo $XIB_BUILDFILES
-else
- if [ -d $XIB_BUILDFILES/.git ]; then
- cd $XIB_BUILDFILES
- git pull
- cd $OLDPWD
- else
- git clone $BUILDFILES_GIT_REPO $XIB_BUILDFILES
- fi
-fi
-
-[ -f $XIB_CHROOT/etc/resolv.conf ] || cp /etc/resolv.conf $XIB_CHROOT/etc/resolv.conf
-
-cp build_profile $BUILD_PROFILE