Skip to content

Commit

Permalink
port: Backports from Lyre
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Feb 20, 2024
1 parent bdc87e3 commit 4bbc98e
Show file tree
Hide file tree
Showing 57 changed files with 467 additions and 420 deletions.
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ debug:
JINX_CONFIG_FILE=jinx-config-debug $(MAKE) all

jinx:
curl -Lo jinx https://github.com/mintsuki/jinx/raw/28efd9f86ffbaeccb0f4552a4f1ad85f42fccad0/jinx
curl -Lo jinx https://github.com/mintsuki/jinx/raw/ae57b8322c949c41a9582c8f5ed47187587c0f7b/jinx
chmod +x jinx

.PHONY: distro-full
Expand Down
2 changes: 1 addition & 1 deletion build-support/CMakeToolchain.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(CMAKE_SYSTEM_NAME UnixPaths)
set(CMAKE_SYSTEM_NAME Vinix)

set(CMAKE_FIND_ROOT_PATH /sysroot)

Expand Down
87 changes: 55 additions & 32 deletions build-support/cross-llvm-config
Original file line number Diff line number Diff line change
@@ -1,70 +1,93 @@
#!/usr/bin/env python3

# This file was taken from Managarm and I have no clue what it does.

import argparse
import sys
import os

our_version = 14
our_version = 17


def do_version():
return '{}.0.6'.format(our_version)
return '{}.0.6'.format(our_version)


def do_components():
return 'all all-targets analysis asmparser asmprinter binaryformat bitreader bitwriter codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel gtest gtest_main instcombine instrumentation interpreter ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mirparser native nativecodegen objcarcopts object objectyaml option orcjit passes profiledata runtimedyld scalaropts selectiondag support symbolize tablegen target testingsupport transformutils vectorize windowsmanifest x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils'
return 'aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen codegentypes core coroutines coverage debuginfobtf debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerparallel dwp engine executionengine extensions filecheck frontendhlsl frontendopenacc frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub interpreter ipo irprinter irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker loongarch loongarchasmparser loongarchcodegen loongarchdesc loongarchdisassembler loongarchinfo lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object objectyaml option orcjit orcshared orctargetprocess passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target targetparser textapi transformutils ve veasmparser vecodegen vectorize vedesc vedisassembler veinfo webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray'


def do_targets_built():
return 'X86'
return 'AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips MSP430 NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore'


def get_includedir():
return '/sysroot/usr/include'
return '/sysroot/usr/include'


def get_libdir():
return '/sysroot/usr/lib'
return '/sysroot/usr/lib'


def do_has_rtti():
return 'YES'
return 'YES'


def do_shared_mode():
return 'shared'
return 'shared'


def do_libs():
return '-lLLVMAggressiveInstCombine -lLLVMLTO -lLLVMAnalysis -lLLVMLibDriver -lLLVMAsmParser -lLLVMLineEditor -lLLVMAsmPrinter -lLLVMLinker -lLLVMBinaryFormat -lLLVMMC -lLLVMBitReader -lLLVMMCA -lLLVMBitWriter -lLLVMMCDisassembler -lLLVMBitstreamReader -lLLVMMCJIT -lLLVMCFGuard -lLLVMMCParser -lLLVMCFIVerify -lLLVMMIRParser -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMCore -lLLVMObject -lLLVMCoroutines -lLLVMObjectYAML -lLLVMCoverage -lLLVMOption -lLLVMDWARFLinker -lLLVMOrcJIT -lLLVMDWP -lLLVMOrcShared -lLLVMDebugInfoCodeView -lLLVMOrcTargetProcess -lLLVMDebugInfoDWARF -lLLVMPasses -lLLVMDebugInfoGSYM -lLLVMProfileData -lLLVMDebugInfoMSF -lLLVMRemarks -lLLVMDebugInfoPDB -lLLVMRuntimeDyld -lLLVMDebuginfod -lLLVMScalarOpts -lLLVMDemangle -lLLVMSelectionDAG -lLLVMDiff -lLLVMSupport -lLLVMDlltoolDriver -lLLVMSymbolize -lLLVMExecutionEngine -lLLVMTableGen -lLLVMExegesis -lLLVMTableGenGlobalISel -lLLVMExegesisX86 -lLLVMTarget -lLLVMExtensions -lLLVMTextAPI -lLLVMFileCheck -lLLVMTransformUtils -lLLVMFrontendOpenACC -lLLVMVectorize -lLLVMFrontendOpenMP -lLLVMWindowsManifest -lLLVMFuzzMutate -lLLVMX86AsmParser -lLLVMGlobalISel -lLLVMX86CodeGen -lLLVMIRReader -lLLVMX86Desc -lLLVMInstCombine -lLLVMX86Disassembler -lLLVMInstrumentation -lLLVMX86Info -lLLVMInterfaceStub -lLLVMX86TargetMCA -lLLVMInterpreter -lLLVMXRay -lLLVMJITLink -lLLVMipo'
return f'-lLLVM-{our_version}'


def do_system_libs():
return '-lLLVMAggressiveInstCombine -lLLVMLTO -lLLVMAnalysis -lLLVMLibDriver -lLLVMAsmParser -lLLVMLineEditor -lLLVMAsmPrinter -lLLVMLinker -lLLVMBinaryFormat -lLLVMMC -lLLVMBitReader -lLLVMMCA -lLLVMBitWriter -lLLVMMCDisassembler -lLLVMBitstreamReader -lLLVMMCJIT -lLLVMCFGuard -lLLVMMCParser -lLLVMCFIVerify -lLLVMMIRParser -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMCore -lLLVMObject -lLLVMCoroutines -lLLVMObjectYAML -lLLVMCoverage -lLLVMOption -lLLVMDWARFLinker -lLLVMOrcJIT -lLLVMDWP -lLLVMOrcShared -lLLVMDebugInfoCodeView -lLLVMOrcTargetProcess -lLLVMDebugInfoDWARF -lLLVMPasses -lLLVMDebugInfoGSYM -lLLVMProfileData -lLLVMDebugInfoMSF -lLLVMRemarks -lLLVMDebugInfoPDB -lLLVMRuntimeDyld -lLLVMDebuginfod -lLLVMScalarOpts -lLLVMDemangle -lLLVMSelectionDAG -lLLVMDiff -lLLVMSupport -lLLVMDlltoolDriver -lLLVMSymbolize -lLLVMExecutionEngine -lLLVMTableGen -lLLVMExegesis -lLLVMTableGenGlobalISel -lLLVMExegesisX86 -lLLVMTarget -lLLVMExtensions -lLLVMTextAPI -lLLVMFileCheck -lLLVMTransformUtils -lLLVMFrontendOpenACC -lLLVMVectorize -lLLVMFrontendOpenMP -lLLVMWindowsManifest -lLLVMFuzzMutate -lLLVMX86AsmParser -lLLVMGlobalISel -lLLVMX86CodeGen -lLLVMIRReader -lLLVMX86Desc -lLLVMInstCombine -lLLVMX86Disassembler -lLLVMInstrumentation -lLLVMX86Info -lLLVMInterfaceStub -lLLVMX86TargetMCA -lLLVMInterpreter -lLLVMXRay -lLLVMJITLink -lLLVMipo'
return f'-lLLVM-{our_version}'


def do_cppflags():
return ''
return ''


def do_cxxflags():
return ''
return ''


def do_ldflags():
return '-L' + get_libdir()
return '-L' + get_libdir()


parser = argparse.ArgumentParser()
parser.add_argument('--version', action='append_const', dest='command', const=do_version)
parser.add_argument('--targets-built', action='append_const', dest='command', const=do_targets_built)
parser.add_argument('--components', action='append_const', dest='command', const=do_components)
parser.add_argument('--includedir', action='append_const', dest='command', const=get_includedir)
parser.add_argument('--libdir', action='append_const', dest='command', const=get_libdir)
parser.add_argument('--has-rtti', action='append_const', dest='command', const=do_has_rtti)
parser.add_argument('--shared-mode', action='append_const', dest='command', const=do_shared_mode)
parser.add_argument('--link-shared', action='store_const', dest='link', const='shared')
parser.add_argument('--cppflags', action='append_const', dest='command', const=do_cppflags)
parser.add_argument('--cxxflags', action='append_const', dest='command', const=do_cxxflags)
parser.add_argument('--ldflags', action='append_const', dest='command', const=do_ldflags)
parser.add_argument('--libs', action='append_const', dest='command', const=do_libs)
parser.add_argument('--system-libs', action='append_const', dest='command', const=do_system_libs)
parser.add_argument('--version', action='append_const',
dest='command', const=do_version)
parser.add_argument('--targets-built', action='append_const',
dest='command', const=do_targets_built)
parser.add_argument('--components', action='append_const',
dest='command', const=do_components)
parser.add_argument('--includedir', action='append_const',
dest='command', const=get_includedir)
parser.add_argument('--libdir', action='append_const',
dest='command', const=get_libdir)
parser.add_argument('--has-rtti', action='append_const',
dest='command', const=do_has_rtti)
parser.add_argument('--shared-mode', action='append_const',
dest='command', const=do_shared_mode)
parser.add_argument('--link-shared', action='store_const',
dest='link', const='shared')
parser.add_argument('--cppflags', action='append_const',
dest='command', const=do_cppflags)
parser.add_argument('--cxxflags', action='append_const',
dest='command', const=do_cxxflags)
parser.add_argument('--ldflags', action='append_const',
dest='command', const=do_ldflags)
parser.add_argument('--libs', action='append_const',
dest='command', const=do_libs)
parser.add_argument('--system-libs', action='append_const',
dest='command', const=do_system_libs)
parser.add_argument('components', type=str, nargs='*')

print("cross-llvm-config:", sys.argv, file=sys.stderr)

args = parser.parse_args()
for command in args.command:
result = command()
print("cross-llvm-config yields:", result, file=sys.stderr)
print(result)

result = command()
print("cross-llvm-config yields:", result, file=sys.stderr)
print(result)
3 changes: 1 addition & 2 deletions host-recipes/binutils
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ build() {
--with-sysroot="${sysroot_dir}" \
--enable-cet \
--disable-nls \
--disable-werror \
--disable-dependency-tracking
--disable-werror

make -j${parallelism} all
}
Expand Down
18 changes: 18 additions & 0 deletions host-recipes/cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name=cmake
from_source=cmake
revision=1
imagedeps="gcc"

build() {
"${source_dir}"/configure --prefix="${prefix}" --parallel="${parallelism}"

make -j${parallelism}
}

package() {
DESTDIR="${dest_dir}" make install
echo 'include(Platform/UnixPaths)' > "${dest_dir}${prefix}/share/cmake-3.28/Modules/Platform/Vinix.cmake"

strip_command=strip \
post_package_strip
}
6 changes: 5 additions & 1 deletion jinx-config
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ autotools_configure() {
configure_script_path="${source_dir}/configure"
fi

ac_cv_func_malloc_0_nonnull=yes \
ac_cv_func_calloc_0_nonnull=yes \
ac_cv_func_realloc_0_nonnull=yes \
${configure_script_path} \
--host=${OS_TRIPLET} \
--with-sysroot=${sysroot_dir} \
Expand All @@ -47,7 +50,7 @@ autotools_recursive_regen() {
ACLOCAL_INCLUDE="-I${sysroot_dir}/usr/share/aclocal"
fi

for f in $(find . -name configure.ac -type f); do
for f in $(find . -name configure.ac -o -name configure.in -type f); do
echo "* autotools regen in '$(dirname $f)'..."
( cd "$(dirname "$f")" && autoreconf -fvi "$@" $ACLOCAL_INCLUDE )
done
Expand All @@ -62,6 +65,7 @@ meson_configure() {
--cross-file "${base_dir}/build-support/cross_file.txt" \
--prefix=${prefix} \
--sysconfdir=/etc \
--localstatedir=/var \
--libdir=lib \
--sbindir=bin \
--buildtype=release \
Expand Down
57 changes: 3 additions & 54 deletions patches/binutils/jinx-working-patch.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index 5c5fdef..3c91651 100644

# This file holds an array associating configuration triplets and
diff --git binutils-clean/bfd/config.bfd binutils-workdir/bfd/config.bfd
index bdee539..48b2360 100644
index bdee539..f5d0cf0 100644
--- binutils-clean/bfd/config.bfd
+++ binutils-workdir/bfd/config.bfd
@@ -664,6 +664,11 @@ case "${targ}" in
Expand Down Expand Up @@ -40,7 +40,7 @@ index bdee539..48b2360 100644
i[3-7]86-*-lynxos*)
targ_defvec=i386_elf32_vec
diff --git binutils-clean/gas/configure.tgt binutils-workdir/gas/configure.tgt
index 3429f85..8fe03c1 100644
index 3429f85..c0a32cc 100644
--- binutils-clean/gas/configure.tgt
+++ binutils-workdir/gas/configure.tgt
@@ -227,6 +227,7 @@ case ${generic_target} in
Expand All @@ -65,7 +65,7 @@ index 7af9581..c55e424 100644
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
diff --git binutils-clean/ld/configure.tgt binutils-workdir/ld/configure.tgt
index c62b958..3873c96 100644
index c62b958..2d8c473 100644
--- binutils-clean/ld/configure.tgt
+++ binutils-workdir/ld/configure.tgt
@@ -378,6 +378,9 @@ i[3-7]86-*-linux-*) targ_emul=elf_i386
Expand Down Expand Up @@ -101,54 +101,3 @@ index 0748c59..954e014 100644

dnl Very limited version of automake's enable-maintainer-mode

diff --git binutils-workdir/multilib.am binutils-workdir/multilib.am
new file mode 100644
index 0000000..5c98b69
--- /dev/null
+++ binutils-workdir/multilib.am
@@ -0,0 +1,45 @@
+## automake - create Makefile.in from Makefile.am
+
+## Copyright (C) 1994-2017 Free Software Foundation, Inc.
+## This Makefile.in is free software; the Free Software Foundation
+## gives unlimited permission to copy and/or distribute it,
+## with or without modifications, as long as this notice is preserved.
+
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds. Hence the
+# comments below.
+all-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+ $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+mostlyclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+ $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+
+.MAKE .PHONY: all-multi clean-multi distclean-multi install-am \
+ install-multi maintainer-clean-multi mostlyclean-multi
+
+install-exec-local: install-multi
+
+all-local: all-multi
+mostlyclean-local: mostlyclean-multi
+clean-local: clean-multi
+distclean-local: distclean-multi
+maintainer-clean-local: maintainer-clean-multi
Loading

0 comments on commit 4bbc98e

Please sign in to comment.