Sources + Header Build
Added Source pulling via curl.
This commit is contained in:
parent
6110995cfb
commit
bf93e7d6c5
7 changed files with 94 additions and 3 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
./sources
|
||||||
|
./build
|
||||||
30
Makefile
30
Makefile
|
|
@ -1,5 +1,33 @@
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
|
SOURCES_FILE=./sources.list
|
||||||
|
ARCH=$(shell uname -m)
|
||||||
|
FROOT="${ARCH}-musllvm"
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
.PHONY:
|
pull:
|
||||||
|
@if [ ! -d ./sources ]; then \
|
||||||
|
echo "Sources Directory Not Found!"; \
|
||||||
|
mkdir -p ./sources; \
|
||||||
|
echo "Pulling Sources..."; \
|
||||||
|
xargs -a ${SOURCES_FILE} -n1 -P4 -- curl -L -S -O --output-dir ./sources || { echo "curl failed"; exit 1; }; \
|
||||||
|
echo "done"; \
|
||||||
|
else \
|
||||||
|
./scripts/check.sh; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
build: init
|
||||||
|
./scripts/headers.sh
|
||||||
|
|
||||||
|
init:
|
||||||
|
@if [ ! -d ./build/${FROOT} ]; then \
|
||||||
|
echo "Making toolchain directory..."; \
|
||||||
|
mkdir -p ./build/${FROOT}; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf ./sources
|
||||||
|
rm -rf ./build
|
||||||
|
|
||||||
|
.PHONY: all pull build clean init
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,12 @@
|
||||||
A simple make build system to make a pure musl clang/llvm toolchain.
|
A simple make build system to make a pure musl clang/llvm toolchain.
|
||||||
Targeting x86_64.
|
Targeting x86_64.
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
Here are some dependencies required to build this toolchain:
|
||||||
|
- a C compiler (preferably clang)
|
||||||
|
- curl
|
||||||
|
- make
|
||||||
|
- POSIX Unix utilities (GNU utilities are acceptable)
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
* [Chimera linux](https://chimera-linux.org) - Majority of patches are sourced from chimera linux.
|
* [Chimera linux](https://chimera-linux.org) - Majority of patches are sourced from chimera linux.
|
||||||
|
|
|
||||||
6
config.mk
Normal file
6
config.mk
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# musllvm default flags
|
||||||
|
|
||||||
|
CC = cc
|
||||||
|
CFLAGS = -O2 -pipe
|
||||||
|
|
||||||
|
|
||||||
12
scripts/check.sh
Executable file
12
scripts/check.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
while IFS= read -r url; do \
|
||||||
|
[ -z "$url" ] && continue; \
|
||||||
|
fname="$(printf '%s' "$url" | sed -E 's/[?#].*$//' | sed -E 's!.*/!!')"; \
|
||||||
|
if [ -e "$(OUTDIR)/$fname" ]; then \
|
||||||
|
printf "SKIP: %s (already exists)\n" "$fname"; \
|
||||||
|
else \
|
||||||
|
printf "GET: %s -> %s\n" "$url" "$fname"; \
|
||||||
|
curl -o "./sources/$fname" "$url" || { printf "ERROR: failed to download %s\n" "$url"; exit 1; }; \
|
||||||
|
fi; \
|
||||||
|
done < ${SOURCES_FILE}; \
|
||||||
27
scripts/headers.sh
Executable file
27
scripts/headers.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
FROOT="${ARCH}-musllvm"
|
||||||
|
LINUX_TAR=$(printf '%s' "$url" | sed -E 's/[?#].*$//' | sed -E 's!.*/!!' | grep -i linux)
|
||||||
|
LINUX_SOURCE="${LINUX_TAR%%.tar*}"
|
||||||
|
|
||||||
|
if command -v "clang" >/dev/null 2>&1 && command -v "lld" >/dev/null 2>&1; then
|
||||||
|
export LLVM=1
|
||||||
|
export LLVM=IAS
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar -xpf ./sources/${LINUX_TAR} ./build
|
||||||
|
|
||||||
|
mkdir -pv ./build/${FROOT}/include
|
||||||
|
|
||||||
|
echo "Building Headers"
|
||||||
|
pushd ./build/${LINUX_SOURCE}
|
||||||
|
|
||||||
|
make mrproper
|
||||||
|
make headers
|
||||||
|
find usr/include \( -name .install -o -name ..install.cmd \) -exec rm -vf {} \;
|
||||||
|
cp -rv usr/include/* ../${FROOT}/include/
|
||||||
|
rm -v ../${FROOT}/include/Makefile
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
13
sources.list
13
sources.list
|
|
@ -1,2 +1,11 @@
|
||||||
https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/llvm-project-20.1.8.src.tar.xz
|
https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.17.7.tar.xz
|
||||||
|
https://musl.libc.org/releases/musl-1.2.5.tar.gz
|
||||||
|
https://pub.sortix.org/libz/libz-1.2.8.2025.03.07.tar.gz
|
||||||
|
https://github.com/chimera-linux/libatomic-chimera/archive/refs/tags/v0.90.0.tar.gz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/llvm-21.1.2.src.tar.xz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/cmake-21.1.2.src.tar.xz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/third-party-21.1.2.src.tar.xz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/clang-21.1.2.src.tar.xz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/compiler-rt-21.1.2.src.tar.xz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.5/lld-21.1.5.src.tar.xz
|
||||||
|
https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.5/libunwind-21.1.5.src.tar.xz
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue