Index: arch/posix.h ================================================================== --- arch/posix.h +++ arch/posix.h @@ -57,73 +57,73 @@ posix_signal_segfault = 11, posix_signal_pipe = 13, posix_signal_alarm = 14, posix_signal_terminate = 15, -#if KVarch == KA_arch_mips && KVos == KA_os_lin +# if KVarch == KA_arch_mips && KVos == KA_os_lin /* for some ungodly reason, some signal * numbers on MIPS differ from most other * architectures still in contemporary use */ - posix_signal_bus = 10, - posix_signal_user_a = 16, - posix_signal_user_b = 17, - posix_signal_child = 18, - posix_signal_continue = 25, - posix_signal_stop = 23, - posix_signal_terminal_stop = 24, - posix_signal_tty_input = 26, - posix_signal_tty_output = 27, - posix_signal_io_urgent = 21, - posix_signal_limit_cpu = 30, - posix_signal_limit_space = 31, - posix_signal_vt_alarm = 28, - posix_signal_profile = 29, - posix_signal_winch = 20, - posix_signal_poll = 22, - posix_signal_power = 19, -#elif KVos == KA_os_lin + posix_signal_bus = 10, + posix_signal_user_a = 16, + posix_signal_user_b = 17, + posix_signal_child = 18, + posix_signal_continue = 25, + posix_signal_stop = 23, + posix_signal_terminal_stop = 24, + posix_signal_tty_input = 26, + posix_signal_tty_output = 27, + posix_signal_io_urgent = 21, + posix_signal_limit_cpu = 30, + posix_signal_limit_space = 31, + posix_signal_vt_alarm = 28, + posix_signal_profile = 29, + posix_signal_winch = 20, + posix_signal_poll = 22, + posix_signal_power = 19, +# elif KVos == KA_os_lin /* x86, ARM, and most others use these * signal numbers */ - posix_signal_bus = 7, - posix_signal_user_a = 10, - posix_signal_user_b = 12, - posix_signal_child = 17, - posix_signal_continue = 18, - posix_signal_stack_fault = 16, - posix_signal_stop = 19, - posix_signal_terminal_stop = 20, - posix_signal_tty_input = 21, - posix_signal_tty_output = 22, - posix_signal_io_urgent = 23, - posix_signal_limit_cpu = 24, - posix_signal_limit_space = 25, - posix_signal_vt_alarm = 26, - posix_signal_profile = 27, - posix_signal_winch = 28, - posix_signal_poll = 29, - posix_signal_power = 30, -#elif KVos == KA_os_fbsd - posix_signal_bus = 10, - posix_signal_user_a = 30, - posix_signal_user_b = 31, - posix_signal_child = 17, - posix_signal_continue = 19, - posix_signal_stack_fault = 16, - posix_signal_stop = 17, - posix_signal_terminal_stop = 18, - posix_signal_tty_input = 21, - posix_signal_tty_output = 22, - posix_signal_io_urgent = 16, - posix_signal_limit_cpu = 24, - posix_signal_limit_space = 25, - posix_signal_vt_alarm = 26, - posix_signal_profile = 27, - posix_signal_winch = 28, - posix_signal_info = 29, - posix_signal_poll = 23, - posix_signal_power = 30, -#endif + posix_signal_bus = 7, + posix_signal_user_a = 10, + posix_signal_user_b = 12, + posix_signal_child = 17, + posix_signal_continue = 18, + posix_signal_stack_fault = 16, + posix_signal_stop = 19, + posix_signal_terminal_stop = 20, + posix_signal_tty_input = 21, + posix_signal_tty_output = 22, + posix_signal_io_urgent = 23, + posix_signal_limit_cpu = 24, + posix_signal_limit_space = 25, + posix_signal_vt_alarm = 26, + posix_signal_profile = 27, + posix_signal_winch = 28, + posix_signal_poll = 29, + posix_signal_power = 30, +# elif KVos == KA_os_fbsd + posix_signal_bus = 10, + posix_signal_user_a = 30, + posix_signal_user_b = 31, + posix_signal_child = 17, + posix_signal_continue = 19, + posix_signal_stack_fault = 16, + posix_signal_stop = 17, + posix_signal_terminal_stop = 18, + posix_signal_tty_input = 21, + posix_signal_tty_output = 22, + posix_signal_io_urgent = 16, + posix_signal_limit_cpu = 24, + posix_signal_limit_space = 25, + posix_signal_vt_alarm = 26, + posix_signal_profile = 27, + posix_signal_winch = 28, + posix_signal_info = 29, + posix_signal_poll = 23, + posix_signal_power = 30, +# endif }; #endif #ifdef KFplatform_define_types Index: dist/PKGBUILD ================================================================== --- dist/PKGBUILD +++ dist/PKGBUILD @@ -7,10 +7,20 @@ source=('https://c.comint.su/libk/tarball/trunk/libk.tar.gz') md5sums=(SKIP) arch=(i686 x86_64 aarch64 armv7l) depends=() makedepends=(binutils bash yasm) + +# the following fields should be uncommented in release tarballs and in +# libk build scripts submitted to the AUR or maybe eventually the Arch +# community repositories. + +validpgpkeys=( + BA8B6CB87AAF25B4F771C34CD8B3128C48456885 + 1AA9AC700870CC08C8561BF9C24B9CD04DC6AE7F +) + build() { export os=lin library=both case $(uname -m) in # i have no idea why, but the "arch" environment variable name ADDED global/cc-invoke.m4 Index: global/cc-invoke.m4 ================================================================== --- global/cc-invoke.m4 +++ global/cc-invoke.m4 @@ -0,0 +1,72 @@ +_libk_shebang_ +define(quot,"'"'$1'"'")dnl +# generated from /global/cc-invoke.m4 by install.sh + +if test "$(echo -n)" = "-n"; then + say() { echo $@' \c'; } +else + say() { echo -n $@' '; } +fi + +libk_libs() { + if test "$static" != 1; then + say quot(_libk_libdir_/kboot.o) quot(-L`'_libk_libdir_) -lk + else + say quot(_libk_libdir_/libk.a) + fi +} + +libk_cflags() { + say quot(-I`'_libk_incdir_) +} + +libk_static() { + say _libk_libdir_/libk.a +} + +libk_gcc() { + say -ffreestanding -nostdlib +} + +libk_clang() { + say -ffreestanding -nostdlibinc +} + +usage() { + echo "usage: $0 [flags]" + echo " $0 prints compiler flags necessary to compile libk programs." + echo " in general, you will need three kinds of flag sets:" + echo " linkage flags tell the compiler where to find libk binary libraries" + echo " for the final linking stage." + echo " --libs -l : emit linkage flags" + echo " --static -s: modify emitted flags for static linking" + echo " compilation flags tell the compiler where to find headers." + echo " --cflags -c: emit compilation flags" + echo " compatibility flags set various compiler-specific options needed to" + echo " compile programs without the traditional C standard library." + echo " --gcc -g : emit gcc-style compat flags" + echo " --clang -C: emit clang-style compat flags" + echo " $0 handles quoting automatically." + exit 64 +} + +for a in $@; do + case $a in + *help|-h) usage ;; + *newlines|-n) + say() { + for l in $@; do + echo $l + done + };; + *libs|-l) fns="$fns libk_libs" ;; + *cflags|-c) fns="$fns libk_cflags" ;; + *gcc|-g) fns="$fns libk_gcc" ;; + *clang|-C) fns="$fns libk_clang" ;; + *static|-s) static=1 ;; + esac +done + +for f in $fns; do + $f +done Index: install.sh ================================================================== --- install.sh +++ install.sh @@ -7,12 +7,13 @@ check prefix 'a directory to install to' build="${build:-out}" bindir="${bindir:-$prefix/bin}" libdir="${libdir:-$prefix/lib}" -incdir="${incdir:-$prefix/include}" +incdir="${incdir:-$prefix/include/k}" sharedir="${sharedir:-$prefix/share}" +shebang="${shebang:-#!/usr/bin/env bash}" say "commencing install" say " - prefix: $prefix" say " - destinations:" say " - binaries → $bindir" @@ -35,11 +36,11 @@ install -Dm755 -t "$bindir" "$build/kgraft.attach" # Includes say "installing headers" for inc in "$build"/k/*; do - install -Dm644 -t "$incdir/k" "$inc" + install -Dm644 -t "$incdir" "$inc" done # Documentation say "installing documentation" for man in "$build"/doc/man/*; do @@ -49,6 +50,16 @@ install -Dm644 -t "$sharedir/doc/libk/html" "$html" done for pdf in "$build"/doc/pdf/*; do install -Dm644 -t "$sharedir/doc/libk/pdf" "$pdf" done + +say "building libk-config utility" +m4 >"$bindir/libk-config" \ + -D"_libk_bindir_=$bindir" -D"_libk_libdir_=$libdir" \ + -D"_libk_incdir_=$incdir" -D"_libk_sharedir_=$sharedir" \ + -D"_libk_shebang_=$shebang" \ + global/cc-invoke.m4 + +chmod +x "$bindir/libk-config" + say "install complete"