updated build-script format

This commit is contained in:
2025-08-23 07:04:59 +03:00
parent 43a8696619
commit eeb4377bb3
7 changed files with 306 additions and 113 deletions

188
assets/var/gnu/all.sh Normal file
View File

@ -0,0 +1,188 @@
cd /mnt/sexlinux/source/linux-6.14.11 && make ARCH=x86 INSTALL_HDR_PATH=/mnt/sexlinux/pkg/gnu/linux headers_install #LINUX#################
cd /mnt/sexlinux/source/binutils-2.44 && ./configure --disable-nls --prefix=/pkg/gnu/binutils && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #BINUTILS##############
cd /mnt/sexlinux/source/glibc-2.41 && mkdir build; cd build && ../configure --with-headers=/mnt/sexlinux/pkg/gnu/linux/include --disable-multilib --enable-install-ldconfig --prefix=/pkg/gnu/glibc && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install && mkdir -p /mnt/sexlinux/pkg/gnu/glibc/{share/i18n/charmaps,lib/locale,etc/ld.so.conf.d} && echo "include /pkg/gnu/glibc/etc/ld.so.conf.d/*.conf" > /mnt/sexlinux/pkg/gnu/glibc/etc/ld.so.conf && echo "/pkg/gnu/lib" > /mnt/sexlinux/pkg/gnu/glibc/etc/ld.so.conf.d/lib.conf && cp /mnt/sexlinux/source/glibc-2.41/localedata/charmaps/* /mnt/sexlinux/pkg/gnu/glibc/share/i18n/charmaps/ && chroot /mnt/sexlinux /pkg/gnu/glibc/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 && sed -i 's|/pkg/gnu/glibc/lib64/ld-linux-x86-64.so.2|/pkg/gnu/glibc/lib/ld-linux-x86-64.so.2|g' /mnt/sexlinux/pkg/gnu/glibc/bin/ldd #GLIBC#################
cd /mnt/sexlinux/source/gmp-6.3.0 && ./configure --enable-cxx --prefix=/pkg/gnu/gmp && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #GMP###################
cd /mnt/sexlinux/source/mpfr-4.2.2 && ./configure --with-gmp=/mnt/sexlinux/pkg/gnu/gmp --prefix=/pkg/gnu/mpfr && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #MPFR##################
cd /mnt/sexlinux/source/mpc-1.3.1 && ./configure --with-gmp=/mnt/sexlinux/pkg/gnu/gmp --with-mpfr=/mnt/sexlinux/pkg/gnu/mpfr --prefix=/pkg/gnu/mpc && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #MPC###################
cd /mnt/sexlinux/source/zlib-1.3.1 && ./configure --prefix=/pkg/gnu/zlib && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #ZLIB##################
cd /mnt/sexlinux/source/zstd-1.5.7 && make -j$(nproc) && make DESTDIR=/mnt/sexlinux prefix=/pkg/gnu/zstd install #ZSTD##################
cd /mnt/sexlinux/source/isl-0.27 && ./configure --prefix=/pkg/gnu/isl && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #ISL###################
cd /mnt/sexlinux/source/gcc-15.1.0 && rg -l "/lib64/ld-linux-x86-64.so.2" ./ | xargs sed -i 's|/lib64/ld-linux-x86-64.so.2|/pkg/gnu/lib/ld-linux-x86-64.so.2|g'; mkdir build; cd build && ../configure --prefix=/pkg/gnu/gcc --disable-multilib --enable-languages=c,c++ --disable-werror --with-sysroot=/mnt/sexlinux && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #GCC###################
cd /mnt/sexlinux/source/libtool-2.5.4 && ./configure --prefix=/pkg/gnu/libtool && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #LIBTOOL###############
cd /mnt/sexlinux/source/dash-0.5.12 && ./configure --disable-static --enable-shared --prefix=/pkg/gnu/dash && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install && ln /mnt/sexlinux/pkg/gnu/dash/bin/dash /mnt/sexlinux/pkg/gnu/dash/bin/sh
cd /mnt/sexlinux/source/sed-4.9 && ./configure --prefix=/pkg/gnu/sed && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #SED###################
cd /mnt/sexlinux/source/glib-2.85.0 && mkdir build; cd build && meson setup --prefix=/pkg/gnu/glib .. && ninja -C . && DESTDIR=/mnt/sexlinux ninja install #GLIB##################
cd /mnt/sexlinux/source/pkg-config-0.29.2 && ./configure --prefix=/pkg/gnu/pkg-config --with-pc-path=/pkg/gnu/lib/pkgconfig && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install && echo "/pkg/gnu/pkg-config/share/aclocal" >> /pkg/gnu/automake/share/aclocal/dirlist
cd /mnt/sexlinux/source/coreutils-9.6 && FORCE_UNSAFE_CONFIGURE=1 ./configure --enable-install-program=hostname --prefix=/pkg/gnu/coreutils && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #COREUTILS#############
cd /mnt/sexlinux/source/make-4.4.1 && ./configure --prefix=/pkg/gnu/make CFLAGS="-O2 -g" && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #MAKE##################
cd /mnt/sexlinux/source/automake-1.17 && ./configure --prefix=/pkg/gnu/automake && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #AUTOMAKE##############
cd /mnt/sexlinux/source/m4-1.4.20 && ./configure --prefix=/pkg/gnu/m4 && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #M4####################
cd /mnt/sexlinux/source/autoconf-2.72 && ./configure --prefix=/pkg/gnu/autoconf && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install && find /mnt/sexlinux/pkg/gnu/autoconf/bin -type f -executable -exec file {} \; | grep -i "text" | cut -d: -f1 | xargs sed -i 's|/usr/sbin/|/pkg/gnu/bin/|g' #AUTOCONF##############
cd /mnt/sexlinux/source/pcre2-10.45 && ./configure --prefix=/pkg/gnu/pcre2 && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #PCRE2#################
cd /mnt/sexlinux/source/grep-3.11 && ./configure --prefix=/pkg/gnu/grep && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #GREP##################
cd /mnt/sexlinux/source/gawk-5.3.2 && ./configure --prefix=/pkg/gnu/gawk && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #GAWK##################
cd /source/sqlite-autoconf-3500000 && ./configure --prefix=/pkg/gnu/sqlite3 && make -j$(nproc) && make install #SQLITE3###############
cd /mnt/sexlinux/source/findutils-4.10.0 && ./configure --prefix=/pkg/gnu/findutils && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #FINDUTILS#############
cd /mnt/sexlinux/source/flex-2.6.4 && ./autogen.sh && ./configure --prefix=/pkg/gnu/flex && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install
cd /source/ncurses-6.5 && ./configure --prefix=/pkg/gnu/ncurses --without-debug --enable-pc-files --with-shared && make -j$(nproc) && make install && make distclean && ./configure --prefix=/pkg/gnu/ncurses --without-debug --enable-pc-files --with-shared --disable-widec && make -j$(nproc) && make install #NCURSES###############
cd /source/bash-5.2.37 && grep -q '#include <unistd.h>' lib/termcap/tparam.c || sed -i '/# include <stdlib.h>/a #include <unistd.h>' lib/termcap/tparam.c && ./configure --prefix=/pkg/gnu/bash && make -j$(nproc) && make install && ln /pkg/gnu/bash/bin/bash /pkg/gnu/bash/bin/sh #BASH##################
cd /source/util-linux-2.41 && ./configure --prefix=/pkg/gnu/util-linux --with-systemd && make -j$(nproc) LDFLAGS="-Wl,-rpath-link,/pkg/gnu/lib" && make install #UTIL-LINUX############
cd /source/file-5.46 && ./configure --prefix=/pkg/gnu/file && make -j$(nproc) && make install #FILE##################
cd /source/diffutils-3.12 && ./configure --prefix=/pkg/gnu/diffutils && make -j$(nproc) && make install #DIFFUTILS#############
cd /source/libunwind-1.8.2 && ./configure --prefix=/pkg/gnu/libunwind && make -j$(nproc) && make install #LIBUNWIND#############
cd /source/strace-6.15 && ./configure --prefix=/pkg/gnu/strace --enable-mpers=no && make -j$(nproc) && make install #STRACE################
cd /source/perl5-5.40.2 && mkdir -p /pkg/gnu/perl5 && ./Configure -desA -Dprefix=/pkg/gnu/perl5 && make -j$(nproc) && make install #PERL5#################
cd /source/openssl-3.5.0 && find . -type f -executable -exec file {} \; | grep -i "text" | cut -d: -f1 | xargs sed -i '1s|^\([^/]*\)\(/usr/bin\>\)|\1/pkg/gnu/bin|; 1s|^\([^/]*\)\(/bin\>\)|\1/pkg/gnu/bin|' && ./Configure --prefix=/pkg/gnu/openssl --libdir=lib linux-x86_64 shared zlib-dynamic && make -j$(nproc) && make install #OPENSSL###############
cd /source/libunistring-1.3 && ./configure --prefix=/pkg/gnu/libunistring && make -j$(nproc) && make install #LIBUNISTRING##########
cd /source/libxcrypt-4.4.38 && ./configure --prefix=/pkg/gnu/libxcrypt && make -j$(nproc) && make install #LIBXCRYPT#############
cd /source/texinfo-7.2 && ./configure --prefix=/pkg/gnu/texinfo && make -j$(nproc) && make install #TEXINFO###############
cd /source/libpsl-0.21.5 && ./configure --prefix=/pkg/gnu/libpsl && make -j$(nproc) && make install
cd /source/curl-8.14.1 && ./configure --prefix=/pkg/gnu/curl --disable-docs --with-openssl --with-ca-path=/pkg/gnu/openssl/ssl/certs/ && make -j$(nproc) && make install
cd /source/wget-1.25.0 && find . -type f -executable -exec file {} \; | grep -i "text" | cut -d: -f1 | xargs sed -i '1s|^\([^/]*\)\(/usr/bin\>\)|\1/pkg/gnu/bin|; 1s|^\([^/]*\)\(/bin\>\)|\1/pkg/gnu/bin|' && ./configure --prefix=/pkg/gnu/wget --with-ssl=openssl && make -j$(nproc) && make install && wget https://curl.se/ca/cacert.pem -O /pkg/gnu/openssl/ssl/cacert.pem --no-check-certificate && csplit -f "/pkg/gnu/openssl/ssl/certs/cert-" -b "%03d.pem" "/pkg/gnu/openssl/ssl/cacert.pem" '/-----BEGIN CERTIFICATE-----/' '{*}' &>/dev/null && for cert in "/pkg/gnu/openssl/ssl/certs/"cert-*.pem; do hash=$(openssl x509 -hash -noout -in "$cert"); mv "$cert" "/pkg/gnu/openssl/ssl/certs/$hash.$(find "/pkg/gnu/openssl/ssl/certs/" -maxdepth 1 -type f -name "$hash.*" | wc -l)"; done #WGET##################
cd /source/tar-1.35 && FORCE_UNSAFE_CONFIGURE=1 ./configure --prefix=/pkg/gnu/tar && make -j$(nproc) && make install
cd /source/xz-5.6.4 && ./configure --prefix=/pkg/gnu/xz && make -j$(nproc) && make install
cd /source/gzip-1.13 && ./configure --prefix=/pkg/gnu/gzip && make -j$(nproc) && make install
cd /source/lzip-1.25 && ./configure --prefix=/pkg/gnu/lzip && make -j$(nproc) && make install
cd /source/dhcp-4.4.3-P1 && ./configure --prefix=/pkg/gnu/dhcp && make -j$(nproc) && make install
cd /source/inetutils-2.6 && ./configure --prefix=/pkg/gnu/inetutils --enable-ipv4 --enable-ipv6 --with-libcap && make -j$(nproc) && make install
cd /source/gettext-0.25 && ./configure --prefix=/pkg/gnu/gettext && make -j$(nproc) && make install
cd /source/git-2.49.0 && make configure && ./configure --prefix=/pkg/gnu/git --without-tcltk && make -j$(nproc) && make install && mkdir /pkg/gnu/git/etc && git config --system http.sslCAInfo /pkg/gnu/openssl/ssl/cacert.pem
cd /source/libcap-2.76 && make prefix=/pkg/gnu/libcap libdir=/pkg/gnu/libcap/lib -j$(nproc) && make install prefix=/pkg/gnu/libcap libdir=/pkg/gnu/libcap/lib
cd /source/zsh-zsh-5.9.0.2-test && autoreconf --install && ./configure --prefix=/pkg/gnu/zsh --enable-etcdir=/pkg/gnu/zsh/etc --enable-multibyte --enable-pcre --enable-cap && make -j$(nproc) && make install.bin install.modules install.fns && mkdir /pkg/gnu/zsh/etc && echo "PROMPT='[%n@%m %~]$ '\nalias ls='ls --color=auto'\nsetopt no_hup\nsetopt no_checkjobs\nsetopt RM_STAR_SILENT" > /pkg/gnu/zsh/etc/zshrc # libcap
cd /source/Python-3.13.4 && CFLAGS="-I/pkg/gnu/include/ncurses" ./configure --prefix=/pkg/gnu/python3 --enable-optimizations && make -j$(nproc) && make install
cd /source/meson-1.8.1 && pip3 install setuptools && pkg hardcopy /pkg/gnu/python3/lib /pkg/gnu/lib && ./configure --prefix=/pkg/gnu/meson && make -j$(nproc) && make install
cd /source/bison-3.8.2 && ./configure --prefix=/pkg/gnu/bison && make -j$(nproc) && make install
cd /source/cmake-4.0.2 && ./configure --prefix=/pkg/gnu/cmake && make -j$(nproc) && make install
cd /source/re2c-4.2 && ./configure --prefix=/pkg/gnu/re2c && make -j$(nproc) && make install
cd /source/ninja-1.12.1 && ./configure.py --bootstrap && mkdir -p /pkg/gnu/ninja/bin && cp ninja /pkg/gnu/ninja/bin
# GCC
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.14.11.tar.xz
tar -xf linux-6.14.11.tar.xz
wget https://ftp.gnu.org/gnu/binutils/binutils-2.44.tar.xz
tar -xf binutils-2.44.tar.xz
wget https://ftp.gnu.org/gnu/libc/glibc-2.41.tar.xz
tar -xf glibc-2.41.tar.xz
wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz
tar -xf gmp-6.3.0.tar.xz
wget https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.2.tar.xz
tar -xf mpfr-4.2.2.tar.xz
wget https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz
tar -xf mpc-1.3.1.tar.gz
wget https://zlib.net/zlib-1.3.1.tar.gz
tar -xf zlib-1.3.1.tar.gz
wget https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-1.5.7.tar.gz
tar -xf zstd-1.5.7.tar.gz
wget https://libisl.sourceforge.io/isl-0.27.tar.xz
tar -xf isl-0.27.tar.xz
wget https://ftp.gnu.org/gnu/gcc/gcc-15.1.0/gcc-15.1.0.tar.xz
tar -xf gcc-15.1.0.tar.xz
# Build tools
wget https://mirror.ihost.md/gnu/libtool/libtool-2.5.4.tar.xz
tar -xf libtool-2.5.4.tar.xz
wget http://deb.debian.org/debian/pool/main/d/dash/dash_0.5.12.orig.tar.gz
tar -xf dash_0.5.12.orig.tar.gz
wget https://mirror.ihost.md/gnu/sed/sed-4.9.tar.xz
tar -xf sed-4.9.tar.xz
wget https://download.gnome.org/sources/glib/2.85/glib-2.85.0.tar.xz
tar -xf glib-2.85.0.tar.xz
wget https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar -xf pkg-config-0.29.2.tar.gz
wget https://ftp.gnu.org/gnu/coreutils/coreutils-9.6.tar.xz
tar -xf coreutils-9.6.tar.xz
wget https://ftp.gnu.org/gnu/make/make-4.4.1.tar.gz
tar -xf make-4.4.1.tar.gz
wget https://ftp.gnu.org/gnu/automake/automake-1.17.tar.xz
tar -xf automake-1.17.tar.xz
wget https://ftp.gnu.org/gnu/m4/m4-1.4.20.tar.xz
tar -xf m4-1.4.20.tar.xz
wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.xz
tar -xf autoconf-2.72.tar.xz
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.tar.gz
tar -xf pcre2-10.45.tar.gz
wget https://mirror.truenetwork.ru/gnu/grep/grep-3.11.tar.xz
tar -xf grep-3.11.tar.xz
wget https://ftp.gnu.org/gnu/gawk/gawk-5.3.2.tar.xz
tar -xf gawk-5.3.2.tar.xz
wget https://www.sqlite.org/2025/sqlite-autoconf-3500000.tar.gz
tar -xf sqlite-autoconf-3500000.tar.gz
wget https://ftp.gnu.org/gnu/findutils/findutils-4.10.0.tar.xz
tar -xf findutils-4.10.0.tar.xz
wget https://github.com/westes/flex/archive/refs/tags/v2.6.4.tar.gz
tar -xf v2.6.4.tar.gz
wget https://ftp.gnu.org/gnu/ncurses/ncurses-6.5.tar.gz
tar -xf ncurses-6.5.tar.gz
wget https://ftp.gnu.org/gnu/bash/bash-5.2.37.tar.gz
tar -xf bash-5.2.37.tar.gz
wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.41/util-linux-2.41.tar.xz
tar -xf util-linux-2.41.tar.xz
wget http://ftp.astron.com/pub/file/file-5.46.tar.gz
tar -xf file-5.46.tar.gz
wget https://ftp.gnu.org/gnu/diffutils/diffutils-3.12.tar.xz
tar -xf diffutils-3.12.tar.xz
wget https://github.com/libunwind/libunwind/releases/download/v1.8.2/libunwind-1.8.2.tar.gz
tar -xf libunwind-1.8.2.tar.gz
wget https://github.com/strace/strace/releases/download/v6.15/strace-6.15.tar.xz
tar -xf strace-6.15.tar.xz
wget https://github.com/Perl/perl5/archive/refs/tags/v5.40.2.tar.gz
tar -xf v5.40.2.tar.gz
wget https://github.com/openssl/openssl/releases/download/openssl-3.5.0/openssl-3.5.0.tar.gz
tar -xf openssl-3.5.0.tar.gz
wget https://ftp.gnu.org/gnu/libunistring/libunistring-1.3.tar.xz
tar -xf libunistring-1.3.tar.xz
wget https://github.com/besser82/libxcrypt/releases/download/v4.4.38/libxcrypt-4.4.38.tar.xz
tar -xf libxcrypt-4.4.38.tar.xz
wget https://ftp.gnu.org/gnu/texinfo/texinfo-7.2.tar.xz
tar -xf texinfo-7.2.tar.xz
wget https://github.com/rockdaboot/libpsl/releases/download/0.21.5/libpsl-0.21.5.tar.gz
tar -xf libpsl-0.21.5.tar.gz
wget https://github.com/curl/curl/releases/download/curl-8_14_1/curl-8.14.1.tar.gz
tar -xf curl-8.14.1.tar.gz
wget https://ftp.gnu.org/gnu/wget/wget-1.25.0.tar.gz
tar -xf wget-1.25.0.tar.gz
wget https://ftp.gnu.org/gnu/tar/tar-1.35.tar.xz
tar -xf tar-1.35.tar.xz
wget https://ftp.isc.org/isc/dhcp/4.4.3-P1/dhcp-4.4.3-P1.tar.gz
tar -xf dhcp-4.4.3-P1.tar.gz
wget https://ftp.gnu.org/gnu/inetutils/inetutils-2.6.tar.xz
tar -xf inetutils-2.6.tar.xz
wget https://github.com/tukaani-project/xz/releases/download/v5.6.4/xz-5.6.4.tar.xz
tar -xf xz-5.6.4.tar.xz
wget https://mirror.truenetwork.ru/gnu/gzip/gzip-1.13.tar.xz
tar -xf gzip-1.13.tar.xz
wget https://download.savannah.gnu.org/releases/lzip/lzip-1.25.tar.gz
tar -xf lzip-1.25.tar.gz
wget https://ftp.gnu.org/gnu/gettext/gettext-0.25.tar.xz
tar -xf gettext-0.25.tar.xz
wget https://github.com/git/git/archive/refs/tags/v2.49.0.tar.gz
tar -xf v2.49.0.tar.gz
wget https://git.kernel.org/pub/scm/libs/libcap/libcap.git/snapshot/libcap-2.76.tar.gz
tar -xf libcap-2.76.tar.gz
wget https://github.com/zsh-users/zsh/archive/refs/tags/zsh-5.9.0.2-test.tar.gz
tar -xf zsh-5.9.0.2-test.tar.gz
wget https://github.com/python/cpython/archive/refs/tags/v3.13.4.tar.gz
tar -xf v3.13.4.tar.gz
wget https://github.com/mesonbuild/meson/releases/download/1.8.1/meson-1.8.1.tar.gz
tar -xf meson-1.8.1.tar.gz
wget https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.xz
tar -xf bison-3.8.2.tar.xz
wget https://github.com/Kitware/CMake/releases/download/v4.0.2/cmake-4.0.2.tar.gz
tar -xf cmake-4.0.2.tar.gz
wget https://github.com/skvadrik/re2c/releases/download/4.2/re2c-4.2.tar.xz
tar -xf re2c-4.2.tar.xz
wget https://github.com/ninja-build/ninja/archive/refs/tags/v1.12.1.tar.gz
tar -xf v1.12.1.tar.gz

View File

@ -0,0 +1,4 @@
wget https://ftp.gnu.org/gnu/binutils/binutils-2.44.tar.xz
tar -xf binutils-2.44.tar.xz
cd /mnt/sexlinux/source/binutils-2.44 && ./configure --disable-nls --prefix=/pkg/gnu/binutils && make -j$(nproc) && make DESTDIR=/mnt/sexlinux install #BINUTILS##############

View File

@ -1,18 +1,30 @@
glibc 2.41
=
https://ftp.gnu.org/gnu/libc/{name}-{version}.tar.xz
https://ftp.gnu.org/gnu/libc/glibc-2.41.tar.xz
``` sh *** build.sctipt ***
mkdir build; cd build &&
../configure \
--prefix=/pkg/gnu/glibc \
--with-headers=/pkg/gnu/linux/include \
--disable-multilib \
--enable-install-ldconfig &&
--with-headers=/pkg/gnu/linux/include \
--disable-multilib \
--enable-install-ldconfig \
--prefix=/pkg/gnu/glibc &&
make -j$(nproc) && make install
```
``` cfg *** dependencies ***
binutils
``` sh *** build.config ***
mkdir -p /pkg/gnu/glibc/{share/i18n/charmaps,lib/locale,etc/ld.so.conf.d} &&
echo "include /pkg/gnu/glibc/etc/ld.so.conf.d/*.conf" > /pkg/gnu/glibc/etc/ld.so.conf &&
echo "/pkg/gnu/lib" > /pkg/gnu/glibc/etc/ld.so.conf.d/lib.conf &&
cp localedata/charmaps/* /pkg/gnu/glibc/share/i18n/charmaps/ &&
/pkg/gnu/glibc/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 &&
sed -i 's|/pkg/gnu/glibc/lib64/ld-linux-x86-64.so.2|/pkg/gnu/glibc/lib/ld-linux-x86-64.so.2|g' /pkg/gnu/glibc/bin/ldd
```
``` cfg *** build dependencies ***
linux
```
``` cfg *** run dependencies ***
binutils
```

4
assets/var/gnu/linux.md Normal file
View File

@ -0,0 +1,4 @@
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.14.11.tar.xz
tar -xf linux-6.14.11.tar.xz
cd /mnt/sexlinux/source/linux-6.14.11 && make ARCH=x86 INSTALL_HDR_PATH=/mnt/sexlinux/pkg/gnu/linux headers_install #LINUX#################

View File

@ -1,48 +1,21 @@
use std::fs;
use std::io;
use std::path::Path;
use rayon::prelude::*;
use std::os::unix::fs::MetadataExt;
use super::get_var_path;
use std::path::{Path,PathBuf};
use crate::utils::parser;
pub fn delete(repo: &str, pkgname: &str) {
let base_dir = Path::new("/pkg").join(repo);
let pkg_dir = base_dir.join(pkgname);
if pkg_dir.exists() {
match fs::remove_dir_all(&pkg_dir) {
Ok(()) => { println!("removed: {}", pkg_dir.display()) }
Err(e) => { eprintln!("Can't remove {}: {}", pkg_dir.display(), e)}
}
} else {
eprintln!("{} not installed in {}", pkgname, repo)
}
let subdirs = ["bin", "lib", "libexec", "include", "share"];
for subdir in &subdirs {
let dir_path = base_dir.join(subdir);
if dir_path.exists() {
match remove_unused_files(&dir_path) {
Ok(()) => {}
Err(_) => {}
}
}
}
pub fn delete(repo: &String, pkgname: &String) {
super::disable::disable(&repo, &pkgname).unwrap();
fs::remove_dir_all(PathBuf::from("/pkg").join(&repo).join(&pkgname)).unwrap();
}
pub fn delete_recursive(repo: &str, pkgname: &str) {
let base_dir = Path::new("/pkg").join(repo);
let pkg_dir = base_dir.join(pkgname);
pub fn delete_recursive(repo: &String, pkgname: &String) {
let pkg_dir = Path::new("/pkg").join(repo).join(pkgname);
if pkg_dir.exists() {
let var_path = get_var_path();
let var_path = super::get_var_path();
let pkg_md_path = var_path.join(format!("{}/{}.md", repo, pkgname));
match parser::get_deps(&pkg_md_path) {
match parser::get_build_deps(&pkg_md_path) {
Ok(deps) => {
for dependency in deps.lines() {
let dependency = dependency.trim();
@ -61,72 +34,9 @@ pub fn delete_recursive(repo: &str, pkgname: &str) {
}
}
match fs::remove_dir_all(&pkg_dir) {
Ok(()) => { println!("removed: {}", pkg_dir.display()) }
Err(e) => { eprintln!("Can't remove {}: {}", pkg_dir.display(), e)}
}
fs::remove_dir_all(&pkg_dir).unwrap();
} else {
eprintln!("{} not installed in {}", pkgname, repo)
}
let subdirs = ["lib", "include", "bin"];
for subdir in &subdirs {
let dir_path = base_dir.join(subdir);
if dir_path.exists() {
match remove_unused_files(&dir_path) {
Ok(()) => {}
Err(_) => {}
}
match remove_unused_dirs_and_symlink(&dir_path) {
Ok(()) => {}
Err(_) => {}
}
}
}
}
fn remove_unused_files(path: &Path) -> io::Result<()> {
let metadata = fs::symlink_metadata(path)?;
if metadata.file_type().is_file() {
if get_nlink(path)? == 1 {
fs::remove_file(path)?
}
} else if metadata.file_type().is_dir() {
let entries: Vec<_> = fs::read_dir(path)?.collect::<io::Result<Vec<_>>>()?;
entries.par_iter().try_for_each(|entry| {
remove_unused_files(&entry.path())
})?;
}
Ok(())
}
fn remove_unused_dirs_and_symlink(path: &Path) -> io::Result<()> {
let metadata = fs::symlink_metadata(path)?;
if metadata.file_type().is_dir() {
let entries: Vec<_> = fs::read_dir(path)?.collect::<io::Result<Vec<_>>>()?;
entries.par_iter().try_for_each(|entry| {
remove_unused_dirs_and_symlink(&entry.path())
})?;
if fs::read_dir(path)?.next().is_none() {
fs::remove_dir(path)?
}
} else if metadata.file_type().is_symlink() {
if let Err(_) = fs::metadata(path) {
fs::remove_file(path)?
}
}
Ok(())
}
fn get_nlink(path: &Path) -> io::Result<u64> {
Ok(fs::metadata(path)?.nlink())
}

View File

@ -3,20 +3,20 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::process;
use super::*;
use crate::utils::parser;
use crate::commands::pkglink::pkglink;
pub fn install(repo: &String, pkgname: &String) -> Result<(), bool> {
let var_path = get_var_path();
let var_path = super::get_var_path();
let pkg_md_path = var_path.join(format!("{}/{}.md", repo, pkgname));
if !pkg_md_path.exists() {
upload_from_repo(&repo, &pkgname, &pkg_md_path)?;
}
check_dependency(&repo, &pkg_md_path)?;
check_build_dependency(&repo, &pkg_md_path)?;
check_run_dependency(&pkg_md_path)?;
download(&pkgname, &pkg_md_path)?;
let src_dir = PathBuf::from("/pkg/src").join(&pkgname);
@ -94,8 +94,8 @@ fn upload_from_repo(repo: &String, pkgname: &String, pkg_md_path: &Path) -> Resu
}
}
fn check_dependency(repo: &String, pkg_md_path: &Path) -> Result<(), bool> {
let deps = match parser::get_deps(&pkg_md_path) {
fn check_build_dependency(repo: &String, pkg_md_path: &Path) -> Result<(), bool> {
let deps = match parser::get_build_deps(&pkg_md_path) {
Ok(deps) => deps,
Err(e) => {
eprintln!("Failed to parse dependencies {}: {}", &pkg_md_path.to_str().unwrap(), e);
@ -117,6 +117,41 @@ fn check_dependency(repo: &String, pkg_md_path: &Path) -> Result<(), bool> {
Ok(())
}
fn check_run_dependency(pkg_md_path: &Path) -> Result<(), bool> {
let deps = match parser::get_run_deps(pkg_md_path) {
Ok(deps) => deps,
Err(e) => {
eprintln!("Failed to parse dependencies {}: {}", pkg_md_path.display(), e);
return Err(false);
}
};
let repo_list = match parser::get_repo_list() {
Ok(repos) => repos,
Err(e) => {
eprintln!("Failed to get repository list: {}", e);
return Err(false)
}
};
for dependency in deps.split_whitespace() {
let mut found = false;
for repo_name in &repo_list {
let path = format!("/pkg/{}/{}/", repo_name, dependency);
if Path::new(&path).exists() {
found = true;
break;
}
}
if !found {
install_all(&dependency.to_string());
}
}
Ok(())
}
fn download(pkgname: &String, pkg_md_path: &Path) -> Result<(), bool> {
let url = match parser::get_url(pkg_md_path) {
@ -259,6 +294,8 @@ fn build(
return Err(false);
}
config(&src_dir, &pkg_md_path)?;
if let Err(e) = fs::remove_dir_all(src_dir) {
eprintln!("Failed to remove source directory: {}", e);
return Err(false);
@ -266,3 +303,33 @@ fn build(
Ok(())
}
fn config(
src_dir: &Path,
pkg_md_path: &Path,
) -> Result<(), bool> {
let config_script = match parser::get_config_script(pkg_md_path) {
Ok(script) => script,
Err(_) => { return Ok(()) }
};
let output = Command::new("zsh")
.arg("-c")
.arg(&config_script)
.current_dir(src_dir)
.output();
if let Err(e) = output {
eprintln!("Failed to execute config script: {}", e);
return Err(false);
}
let output = output.unwrap();
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
eprintln!("Script failed with error: {}", stderr);
return Err(false);
}
Ok(())
}

View File

@ -38,8 +38,12 @@ pub fn get_url<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
}
pub fn get_deps<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` sh dependencies", "```")
pub fn get_build_deps<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` cfg build dependencies", "```")
}
pub fn get_run_deps<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` cfg build dependencies", "```")
}
@ -47,6 +51,10 @@ pub fn get_build_script<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` sh build.sctipt", "```")
}
pub fn get_config_script<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` sh build.config", "```")
}
pub fn get_repo_list() -> io::Result<Vec<String>> {
let exe_path = env::current_exe()?;