Commit 8fbfe50a authored by Keith Packard's avatar Keith Packard

Install .specs file to make building easier

This lets the user pass gcc -specs=picolib.specs to select the correct
include file and libc paths including multilib bits.
Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
parent e7a11f1a
#!/bin/sh
ARCH=riscv64-unknown-elf
DIR=`dirname $0`
meson $DIR \
case "$#" in
1)
arg="$1"
;;
*)
arg=`dirname $0`
;;
esac
meson "$arg" \
-Dprefix=/opt/ \
-Dtarget-optspace=true \
-Dnewlib-tinystdio=true \
-Dnewlib-supplied-syscalls=false \
-Dnewlib-reentrant-small=true\
-Dnewlib-reent-small=true\
-Dnewlib-wide-orient=false\
-Dnewlib-nano-malloc=true\
-Dnewlib-reent-small=true\
-Dlite-exit=true\
-Dnewlib-global-atexit=true\
-Dnewlib-global-errno=true\
-Dincludedir=lib/newlib-nano/$ARCH/include \
-Dlibdir=lib/newlib-nano/$ARCH/lib \
--cross-file $DIR/cross-$ARCH.txt \
--buildtype plain
-Dincludedir=picolibc/$ARCH/include \
-Dlibdir=picolibc/$ARCH/lib \
--buildtype plain \
--cross-file "$arg"/cross-$ARCH.txt
......@@ -55,12 +55,36 @@ if host_cpu == ''
message('Computed host_cpu as ' + host_cpu)
endif
specs_dir = get_option('specsdir')
if specs_dir == ''
specs_dir=run_command(meson.get_compiler('c'), '-print-search-dirs').stdout().split('\n')[0].split(':')[1].strip()
endif
message('specs dir is ' + specs_dir)
if have_alias_attribute_option == 'auto'
have_alias_attribute = meson.get_compiler('c').has_function_attribute('alias')
else
have_alias_attribute = have_alias_attribute_option == 'true'
endif
specs_data = configuration_data()
specs_data.set(
'INCLUDEDIR',
join_paths(get_option('prefix'), get_option('includedir'))
)
specs_data.set(
'LIBDIR',
join_paths(get_option('prefix'), get_option('libdir'))
)
configure_file(input: 'picolibc.specs.in',
output: '@BASENAME@',
configuration: specs_data,
install_dir: specs_dir,
install: true)
long_double_code = '''
#include <float.h>
#ifndef LDBL_MANT_DIG
......
......@@ -16,6 +16,9 @@ option('tests', type: 'boolean', value: false,
option('newlib-tinystdio', type: 'boolean', value: false,
description: 'Use tiny stdio from avr libc')
option('specsdir', type: 'string',
description: 'Installation directory for .specs file')
option('newlib-io-pos-args', type: 'boolean', value: false,
description: 'enable printf-family positional arg support')
option('newlib-io-c99-formats', type: 'boolean', value: false,
......
%rename link picolibc_link
%rename cpp picolibc_cpp
*cpp:
-isystem @INCLUDEDIR@ %(picolibc_cpp)
*link:
-L@LIBDIR@/%M %(picolibc_link)
*lib:
--start-group -lc --end-group
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment