Further refine sysroot.

* remove need for NASM from sysroot
* have peru sync libc separately
This commit is contained in:
Justin C. Miller
2019-07-07 09:52:06 -07:00
parent f57f38edbd
commit b3f88bbe02
5 changed files with 102 additions and 191 deletions

View File

@@ -1,7 +1,13 @@
imports: imports:
sysroot: ./sysroot sysroot: ./sysroot
j6libc: ./sysroot
curl module sysroot: curl module sysroot:
url: https://f000.backblazeb2.com/file/jsix-os/sysroot-llvm8-20190705.tar.bz2 url: https://f000.backblazeb2.com/file/jsix-os/sysroot-llvm8-20190706.tar.bz2
unpack: tar
export: sysroot/
curl module j6libc:
url: https://f000.backblazeb2.com/file/jsix-os/sysroot-j6libc-0377948.tar.bz2
unpack: tar unpack: tar
export: sysroot/ export: sysroot/

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
TARGET="x86_64-elf" TARGET="x86_64-elf"
NASM_VERSION="2.13.03"
LLVM_BRANCH="release_80" LLVM_BRANCH="release_80"
TOOLS="clang lld" # lld libunwind libcxxabi libcxx" TOOLS="clang lld" # lld libunwind libcxxabi libcxx"
@@ -19,42 +18,15 @@ mkdir -p "${WORK}"
export CC=clang export CC=clang
export CXX=clang++ export CXX=clang++
function build_nasm() { if [[ ! -d "${WORK}/llvm" ]]; then
if [[ ! -d "${WORK}/nasm-${NASM_VERSION}" ]]; then
echo "Downloading NASM..."
tarball="nasm-${NASM_VERSION}.tar.gz"
curl -sSOL "https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/${tarball}"
tar xzf "${tarball}" -C "${WORK}" && rm "${tarball}"
fi
mkdir -p "${WORK}/build/nasm"
pushd "${WORK}/build/nasm"
if [[ ! -f "${WORK}/build/nasm/config.cache" ]]; then
echo "Configuring NASM..."
"${WORK}/nasm-${NASM_VERSION}/configure" \
--quiet \
--config-cache \
--disable-werror \
--prefix="${SYSROOT}" \
--srcdir="${WORK}/nasm-${NASM_VERSION}"
fi
echo "Building NASM..."
(make -j && make install) > "${WORK}/build/nasm_build.log"
popd
}
function build_llvm() {
if [[ ! -d "${WORK}/llvm" ]]; then
echo "Downloading LLVM..." echo "Downloading LLVM..."
git clone -q \ git clone -q \
--branch "${LLVM_BRANCH}" \ --branch "${LLVM_BRANCH}" \
--depth 1 \ --depth 1 \
"https://git.llvm.org/git/llvm.git" "${WORK}/llvm" "https://git.llvm.org/git/llvm.git" "${WORK}/llvm"
fi fi
for tool in ${TOOLS}; do for tool in ${TOOLS}; do
if [[ ! -d "${WORK}/llvm/tools/${tool}" ]]; then if [[ ! -d "${WORK}/llvm/tools/${tool}" ]]; then
echo "Downloading ${tool}..." echo "Downloading ${tool}..."
git clone -q \ git clone -q \
@@ -62,17 +34,17 @@ function build_llvm() {
--depth 1 \ --depth 1 \
"https://git.llvm.org/git/${tool}.git" "${WORK}/llvm/tools/${tool}" "https://git.llvm.org/git/${tool}.git" "${WORK}/llvm/tools/${tool}"
fi fi
done done
if [[ ! -d "${WORK}/llvm/tools/clang/tools/extra" ]]; then if [[ ! -d "${WORK}/llvm/tools/clang/tools/extra" ]]; then
echo "Downloading clang-tools-extra..." echo "Downloading clang-tools-extra..."
git clone -q \ git clone -q \
--branch "${LLVM_BRANCH}" \ --branch "${LLVM_BRANCH}" \
--depth 1 \ --depth 1 \
"https://git.llvm.org/git/clang-tools-extra.git" "${WORK}/llvm/tools/clang/tools/extra" "https://git.llvm.org/git/clang-tools-extra.git" "${WORK}/llvm/tools/clang/tools/extra"
fi fi
for proj in ${PROJECTS}; do for proj in ${PROJECTS}; do
if [[ ! -d "${WORK}/llvm/projects/${proj}" ]]; then if [[ ! -d "${WORK}/llvm/projects/${proj}" ]]; then
echo "Downloading ${proj}..." echo "Downloading ${proj}..."
git clone -q \ git clone -q \
@@ -80,9 +52,9 @@ function build_llvm() {
--depth 1 \ --depth 1 \
"https://git.llvm.org/git/${proj}.git" "${WORK}/llvm/projects/${proj}" "https://git.llvm.org/git/${proj}.git" "${WORK}/llvm/projects/${proj}"
fi fi
done done
for proj in ${RUNTIMES}; do for proj in ${RUNTIMES}; do
if [[ ! -d "${WORK}/llvm/runtimes/${proj}" ]]; then if [[ ! -d "${WORK}/llvm/runtimes/${proj}" ]]; then
echo "Downloading ${proj}..." echo "Downloading ${proj}..."
git clone -q \ git clone -q \
@@ -90,14 +62,14 @@ function build_llvm() {
--depth 1 \ --depth 1 \
"https://git.llvm.org/git/${proj}.git" "${WORK}/llvm/runtime/${proj}" "https://git.llvm.org/git/${proj}.git" "${WORK}/llvm/runtime/${proj}"
fi fi
done done
mkdir -p "${WORK}/build/llvm" mkdir -p "${WORK}/build/llvm"
pushd "${WORK}/build/llvm" pushd "${WORK}/build/llvm"
echo "Configuring LLVM..." echo "Configuring LLVM..."
cmake -G Ninja \ cmake -G Ninja \
-DCLANG_DEFAULT_RTLIB=compiler-rt \ -DCLANG_DEFAULT_RTLIB=compiler-rt \
-DCLANG_DEFAULT_STD_C=c11 \ -DCLANG_DEFAULT_STD_C=c11 \
-DCLANG_DEFAULT_STD_CXX=cxx14 \ -DCLANG_DEFAULT_STD_CXX=cxx14 \
@@ -138,56 +110,22 @@ function build_llvm() {
-DLLVM_TARGETS_TO_BUILD="X86" \ -DLLVM_TARGETS_TO_BUILD="X86" \
${WORK}/llvm > cmake_configure.log ${WORK}/llvm > cmake_configure.log
# -DCMAKE_ASM_COMPILER=nasm \ # -DCMAKE_ASM_COMPILER=nasm \
# -DCMAKE_LINKER="${SYSROOT}/bin/ld.lld" \ # -DCMAKE_LINKER="${SYSROOT}/bin/ld.lld" \
# -DCOMPILER_RT_ENABLE_LLD=ON \ # -DCOMPILER_RT_ENABLE_LLD=ON \
# -DLIBCXX_ENABLE_LLD=ON \ # -DLIBCXX_ENABLE_LLD=ON \
# -DLIBCXX_ENABLE_STATIC_UNWINDER=ON \ # -DLIBCXX_ENABLE_STATIC_UNWINDER=ON \
# -DLIBCXXABI_ENABLE_LLD=ON \ # -DLIBCXXABI_ENABLE_LLD=ON \
# -DLIBUNWIND_ENABLE_LLD=ON \ # -DLIBUNWIND_ENABLE_LLD=ON \
# -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi;libunwind;compiler-rt" \ # -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi;libunwind;compiler-rt" \
# -DCOMPILER_RT_BAREMETAL_BUILD=ON \ # -DCOMPILER_RT_BAREMETAL_BUILD=ON \
# -DLIBCXXABI_BAREMETAL=ON \ # -DLIBCXXABI_BAREMETAL=ON \
echo "Building LLVM..." echo "Building LLVM..."
ninja && ninja install ninja && ninja install
ninja cxx cxxabi compiler-rt ninja cxx cxxabi compiler-rt
ninja install-compiler-rt install-cxx install-cxxabi ninja install-compiler-rt install-cxx install-cxxabi
popd popd
}
function build_libc() {
if [[ ! -d "${WORK}/poplibc" ]]; then
echo "Downloading poplibc..."
git clone \
"https://github.com/justinian/poplibc.git" \
"${WORK}/poplibc"
else
echo "Updating poplibc..."
git -C "${WORK}/poplibc" pull
fi
pushd "${WORK}/poplibc"
echo "Building poplibc..."
pb prefix="${SYSROOT}" && ninja -C build install
popd
}
function update_links() {
for exe in `ls "${SYSROOT}/bin/${TARGET}-"*`; do
base=$(echo "$exe" | sed -e "s/${TARGET}-//")
ln -fs "${exe}" "${base}"
done
}
build_nasm
build_libc
build_llvm
update_links
export CC="${SYSROOT}/bin/clang"
export CXX="${SYSROOT}/bin/clang++"
export LD="${SYSROOT}/bin/ld"
build_libc
cp "${README}" "${SYSROOT}/README.md" cp "${README}" "${SYSROOT}/README.md"

View File

@@ -4,39 +4,6 @@ This is a pre-built sysroot for building the jsix operating system kernel,
bootloader, and utilities. This package is provided as a convenience, and bootloader, and utilities. This package is provided as a convenience, and
contains software from the following repositories. contains software from the following repositories.
## NASM, the Netwide Assembler
As downloaded from [the NASM website][nasm] under the following license:
Copyright 1996-2010 the NASM Authors - All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[nasm]: https://www.nasm.us
## The LLVM toolchain ## The LLVM toolchain
The LLVM sources as downloaded via git from [llvm.org][llvm] under the terms of The LLVM sources as downloaded via git from [llvm.org][llvm] under the terms of

View File

@@ -5,8 +5,8 @@ cc = ${srcroot}/sysroot/bin/clang
cxx = ${srcroot}/sysroot/bin/clang++ cxx = ${srcroot}/sysroot/bin/clang++
ld = ${srcroot}/sysroot/bin/ld.lld ld = ${srcroot}/sysroot/bin/ld.lld
ar = ${srcroot}/sysroot/bin/ar ar = ${srcroot}/sysroot/bin/ar
nasm = ${srcroot}/sysroot/bin/nasm nasm = nasm
objcopy = ${srcroot}/sysroot/bin/x86_64-elf-objcopy objcopy = ${srcroot}/sysroot/bin/objcopy
{% endblock %} {% endblock %}
{% block variables %} {% block variables %}

View File

@@ -5,7 +5,7 @@ cc = ${srcroot}/sysroot/bin/clang
cxx = ${srcroot}/sysroot/bin/clang++ cxx = ${srcroot}/sysroot/bin/clang++
ld = ${srcroot}/sysroot/bin/ld.lld ld = ${srcroot}/sysroot/bin/ld.lld
ar = ${srcroot}/sysroot/bin/ar ar = ${srcroot}/sysroot/bin/ar
nasm = ${srcroot}/sysroot/bin/nasm nasm = nasm
objcopy = ${srcroot}/sysroot/bin/objcopy objcopy = ${srcroot}/sysroot/bin/objcopy
{% endblock %} {% endblock %}