Skip to content
3 changes: 2 additions & 1 deletion pkg/dav1d/gen.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local arch = config.target.platform:match('[^-]*')
cflags{
'-Wall', '-Wno-maybe-uninitialized',
'-D _XOPEN_SOURCE=700',
Expand All @@ -6,7 +7,7 @@ cflags{
'-I $srcdir/tools',
'-I $outdir',
'-I $outdir/include/dav1d',
'-I $dir',
arch == 'riscv64' and '-I $dir/riscv' or '-I $dir',
}
nasmflags{
'-i $srcdir/src/',
Expand Down
17 changes: 17 additions & 0 deletions pkg/dav1d/riscv/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#define ARCH_AARCH64 0
#define ARCH_ARM 0
#define ARCH_PPC64LE 0
#define ARCH_X86 0
#define ARCH_X86_32 0
#define ARCH_X86_64 0
#define CONFIG_16BPC 1
#define CONFIG_8BPC 1
#define CONFIG_LOG 1
#define ENDIANNESS_BIG 0
#define HAVE_ASM 1
Comment thread
michaelforney marked this conversation as resolved.
Outdated
#define HAVE_AVX512ICL 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_DLSYM 1
#define HAVE_POSIX_MEMALIGN 1
#define HAVE_UNISTD_H 1
#define STACK_ALIGNMENT 32
3 changes: 2 additions & 1 deletion pkg/libffi/gen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build('sed', '$outdir/include/ffi.h', '$srcdir/include/ffi.h.in', {
})

pkg.hdrs = {
copy('$outdir/include', '$srcdir/src/'..({x86_64='x86', aarch64='aarch64'})[arch], {'ffitarget.h'}),
copy('$outdir/include', '$srcdir/src/'..({x86_64='x86', aarch64='aarch64', riscv64='riscv'})[arch], {'ffitarget.h'}),
'$outdir/include/ffi.h',
install=true,
}
Expand All @@ -31,6 +31,7 @@ lib('libffi.a', [[
prep_cif.c types.c raw_api.c java_raw_api.c closures.c
@aarch64 aarch64/(ffi.c sysv.S)
@x86_64 x86/(ffi64.c unix64.S ffiw64.c win64.S)
@riscv64 riscv/(ffi.c sysv.S)
)
]])
file('lib/libffi.a', '644', '$outdir/libffi.a')
Expand Down
1 change: 1 addition & 0 deletions pkg/linux-headers/gen.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local arch = ({
aarch64='arm64',
x86_64='x86',
riscv64='riscv',
})[config.target.platform:match('[^-]*')]
sub('tools.ninja', function()
toolchain(config.host)
Expand Down
25 changes: 25 additions & 0 deletions pkg/linux-headers/riscv.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
return {
-- <cd src/arch/riscv/include/uapi && find * -name '*.h' -exec printf "\t'%s',\n" {} + | LC_COLLATE=C sort
'asm/auxvec.h',
'asm/bitsperlong.h',
'asm/bpf_perf_event.h',
'asm/byteorder.h',
'asm/elf.h',
'asm/hwcap.h',
'asm/hwprobe.h',
'asm/kvm.h',
'asm/perf_regs.h',
'asm/ptrace.h',
'asm/setup.h',
'asm/sigcontext.h',
'asm/ucontext.h',
'asm/unistd.h',
'asm/vendor/mips.h',
'asm/vendor/sifive.h',
'asm/vendor/thead.h',
unistd = {},
Comment thread
michaelforney marked this conversation as resolved.
Outdated
generic={
-- <awk '$1 == "generic-y" {printf "\\t\\t'\'%s\'',\\n", $3}' src/arch/riscv/include/uapi/asm/Kbuild
'kvm_para.h',
Comment thread
michaelforney marked this conversation as resolved.
Outdated
},
}
17 changes: 16 additions & 1 deletion pkg/musl/gen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,22 @@ for _, lib in ipairs{'libm.a', 'librt.a', 'libpthread.a', 'libcrypt.a', 'libutil
end

local startfiles = {'$outdir/libc.a'}
for _, src in ipairs{'crt1.c', 'rcrt1.c', 'Scrt1.c', arch..'/crti.s', arch..'/crtn.s'} do

local crts = (arch == 'riscv64') and {
'crt1.c',
'rcrt1.c',
'Scrt1.c',
'crti.c',
'crtn.c',
} or {
'crt1.c',
'rcrt1.c',
'Scrt1.c',
arch..'/crti.s',
arch..'/crtn.s',
}

for _, src in ipairs(crts) do
Comment thread
michaelforney marked this conversation as resolved.
Outdated
local obj = src:gsub('.-(%w*)%.[cs]$', '%1.o')
local out = '$outdir/'..obj
build('cc', out, {'$srcdir/crt/'..src, '|', '$gendir/deps'}, {cflags='$cflags $cflags_nossp'})
Expand Down
39 changes: 39 additions & 0 deletions pkg/musl/riscv64.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
return {
srcs={
-- <cd src && printf "\t\t'%s',\n" src/*/riscv64/*.[csS]
'src/fenv/riscv64/fenv-sf.c',
'src/fenv/riscv64/fenv.S',
'src/ldso/riscv64/dlsym.s',
'src/ldso/riscv64/tlsdesc.s',
'src/math/riscv64/copysign.c',
'src/math/riscv64/copysignf.c',
'src/math/riscv64/fabs.c',
'src/math/riscv64/fabsf.c',
'src/math/riscv64/fma.c',
'src/math/riscv64/fmaf.c',
'src/math/riscv64/fmax.c',
'src/math/riscv64/fmaxf.c',
'src/math/riscv64/fmin.c',
'src/math/riscv64/fminf.c',
'src/math/riscv64/sqrt.c',
'src/math/riscv64/sqrtf.c',
'src/process/riscv64/vfork.s',
'src/setjmp/riscv64/longjmp.S',
'src/setjmp/riscv64/setjmp.S',
'src/signal/riscv64/restore.s',
'src/signal/riscv64/sigsetjmp.s',
'src/thread/riscv64/__set_thread_area.s',
'src/thread/riscv64/__unmapself.s',
'src/thread/riscv64/clone.s',
'src/thread/riscv64/syscall_cp.s',
},
bits={
-- <cd src/arch/riscv/bits && printf "\t\t'%s',\n" *.h
Comment thread
michaelforney marked this conversation as resolved.
Outdated
'fenv.h',
'float.h',
'setjmp.h',
'signal.h',
'user.h',
},
}

3 changes: 2 additions & 1 deletion pkg/pcre/gen.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local arch = config.target.platform:match('[^-]*')
cflags{
'-D HAVE_CONFIG_H',
'-I $dir',
arch == 'riscv64' and '-I $dir/riscv' or '-I $dir',
'-I $srcdir',
'-I $outdir/include',
}
Expand Down
83 changes: 83 additions & 0 deletions pkg/pcre/riscv/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* #undef BSR_ANYCRLF */
/* #undef EBCDIC */
/* #undef EBCDIC_NL25 */
#define HAVE_BCOPY 1
/* #undef HAVE_BITS_TYPE_TRAITS_H */
/* #undef HAVE_BZLIB_H */
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
/* #undef HAVE_EDITLINE_READLINE_H */
/* #undef HAVE_EDIT_READLINE_READLINE_H */
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
/* #undef HAVE_LONG_LONG */
#define HAVE_MEMMOVE 1
#define HAVE_PTHREAD 1
#define HAVE_PTHREAD_PRIO_INHERIT 1
/* #undef HAVE_READLINE_HISTORY_H */
/* #undef HAVE_READLINE_READLINE_H */
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRERROR 1
/* #undef HAVE_STRING */
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
/* #undef HAVE_STRTOIMAX */
/* #undef HAVE_STRTOLL */
/* #undef HAVE_STRTOQ */
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
/* #undef HAVE_TYPE_TRAITS_H */
#define HAVE_UNISTD_H 1
/* #undef HAVE_UNSIGNED_LONG_LONG */
#define HAVE_VISIBILITY 1
/* #undef HAVE_WINDOWS_H */
/* #undef HAVE_ZLIB_H */
/* #undef HAVE__STRTOI64 */
#define LINK_SIZE 2
#define LT_OBJDIR ".libs/"
#define MATCH_LIMIT 10000000
#define MATCH_LIMIT_RECURSION MATCH_LIMIT
#define MAX_NAME_COUNT 10000
#define MAX_NAME_SIZE 32
#define NEWLINE 10
/* #undef NO_RECURSE */
#define PACKAGE "pcre"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "PCRE"
#define PACKAGE_STRING "PCRE 8.45"
#define PACKAGE_TARNAME "pcre"
#define PACKAGE_URL ""
#define PACKAGE_VERSION "8.45"
#define PARENS_NEST_LIMIT 250
#define PCRECPP_EXP_DECL extern __attribute__ ((visibility ("default")))
#define PCRECPP_EXP_DEFN __attribute__ ((visibility ("default")))
#define PCREGREP_BUFSIZE 20480
#define PCREPOSIX_EXP_DECL extern __attribute__ ((visibility ("default")))
#define PCREPOSIX_EXP_DEFN extern __attribute__ ((visibility ("default")))
#define PCRE_EXP_DATA_DEFN __attribute__ ((visibility ("default")))
#define PCRE_EXP_DECL extern __attribute__ ((visibility ("default")))
#define PCRE_EXP_DEFN __attribute__ ((visibility ("default")))
#define PCRE_STATIC 1
#define POSIX_MALLOC_THRESHOLD 10
/* #undef PTHREAD_CREATE_JOINABLE */
#define STDC_HEADERS 1
#ifdef __GNUC__
// #define SUPPORT_JIT /**/ unsupported on riscv
#endif
/* #undef SUPPORT_LIBBZ2 */
/* #undef SUPPORT_LIBEDIT */
/* #undef SUPPORT_LIBREADLINE */
/* #undef SUPPORT_LIBZ */
/* #undef SUPPORT_PCRE16 */
/* #undef SUPPORT_PCRE32 */
#define SUPPORT_PCRE8 /**/
// #define SUPPORT_PCREGREP_JIT /**/ unsupported on riscv
Comment thread
michaelforney marked this conversation as resolved.
Outdated
#define SUPPORT_UCP /**/
#define SUPPORT_UTF /**/
/* #undef SUPPORT_VALGRIND */
#define VERSION "8.45"
/* #undef const */
/* #undef int64_t */
/* #undef size_t */