vxOpenLibm - v1.0.0-dev1 : port Lephenixnoir sh3eb patches + custom build system
*add* > [project] | [README] first draft | [git] ignore default files > [scripts] | [install] first installation operation support > [patches] | [openlibm] port Lephenixnoir sh3eb support | [cmake] add custom build system for the openlibm | [cmake] add toolchain support
This commit is contained in:
commit
a765d9406b
|
@ -0,0 +1,2 @@
|
|||
openlibm
|
||||
commit.txt
|
|
@ -0,0 +1,23 @@
|
|||
# vxOpenLibM
|
||||
|
||||
This is a fork of OpenLibm with the support of the sh3eb architecture, intended
|
||||
for the Vhex kernel project.
|
||||
|
||||
This work will directly patch the current openlibm sources code and use a
|
||||
custom build system based on CMake instead of the Makefile mess used in the
|
||||
original project.
|
||||
|
||||
## Installing
|
||||
|
||||
You can use the `scripts/install.sh --help` to see manual installation of the
|
||||
project. But, since the compiler used for this repository is "sh-elf-vhex"
|
||||
which automatically install this project as a own dependency you theorically do
|
||||
not need to install this project.
|
||||
|
||||
## README and Licensing
|
||||
|
||||
See the original
|
||||
[REAME file](https://github.com/JuliaMath/openlibm/blob/master/README.md) of
|
||||
the openlibm project for futher information.
|
||||
Note that Openlibm contains code covered by various licenses, see
|
||||
[LICENSE.md](https://github.com/JuliaMath/openlibm/blob/master/LICENSE.md)
|
|
@ -0,0 +1,221 @@
|
|||
# This cmake file will be dropped at the root of the openlibm repository
|
||||
# folder and need to be the more generic as possible to support further update
|
||||
# of the original project
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
## fetch source files
|
||||
|
||||
file(
|
||||
GLOB
|
||||
VXOPENLIBM_SOURCES
|
||||
|
||||
# BDS-specific sources
|
||||
bsdsrc/b_exp.c
|
||||
bsdsrc/b_log.c
|
||||
bsdsrc/b_tgamma.c
|
||||
|
||||
# arch-specific sources
|
||||
sh3eb/fenv.c
|
||||
|
||||
# common sources
|
||||
src/common.c
|
||||
src/e_acos.c
|
||||
src/e_acosf.c
|
||||
src/e_acosh.c
|
||||
src/e_acoshf.c
|
||||
src/e_asin.c
|
||||
src/e_asinf.c
|
||||
src/e_atan2.c
|
||||
src/e_atan2f.c
|
||||
src/e_atanh.c
|
||||
src/e_atanhf.c
|
||||
src/e_cosh.c
|
||||
src/e_coshf.c
|
||||
src/e_exp.c
|
||||
src/e_expf.c
|
||||
src/e_fmod.c
|
||||
src/e_fmodf.c
|
||||
src/e_hypot.c
|
||||
src/e_hypotf.c
|
||||
src/e_j0.c
|
||||
src/e_j0f.c
|
||||
src/e_j1.c
|
||||
src/e_j1f.c
|
||||
src/e_jn.c
|
||||
src/e_jnf.c
|
||||
src/e_lgamma.c
|
||||
src/e_lgamma_r.c
|
||||
src/e_lgammaf.c
|
||||
src/e_lgammaf_r.c
|
||||
src/e_log.c
|
||||
src/e_log10.c
|
||||
src/e_log10f.c
|
||||
src/e_log2.c
|
||||
src/e_log2f.c
|
||||
src/e_logf.c
|
||||
src/e_pow.c
|
||||
src/e_powf.c
|
||||
src/e_remainder.c
|
||||
src/e_remainderf.c
|
||||
src/e_rem_pio2.c
|
||||
src/e_rem_pio2f.c
|
||||
src/e_sinh.c
|
||||
src/e_sinhf.c
|
||||
src/e_sqrt.c
|
||||
src/e_sqrtf.c
|
||||
src/k_cos.c
|
||||
src/k_exp.c
|
||||
src/k_expf.c
|
||||
src/k_rem_pio2.c
|
||||
src/k_sin.c
|
||||
src/k_tan.c
|
||||
src/k_cosf.c
|
||||
src/k_sinf.c
|
||||
src/k_tanf.c
|
||||
src/s_asinh.c
|
||||
src/s_asinhf.c
|
||||
src/s_atan.c
|
||||
src/s_atanf.c
|
||||
src/s_carg.c
|
||||
src/s_cargf.c
|
||||
src/s_cbrt.c
|
||||
src/s_cbrtf.c
|
||||
src/s_ceil.c
|
||||
src/s_ceilf.c
|
||||
src/s_copysign.c
|
||||
src/s_copysignf.c
|
||||
src/s_cos.c
|
||||
src/s_cosf.c
|
||||
src/s_csqrt.c
|
||||
src/s_csqrtf.c
|
||||
src/s_erf.c
|
||||
src/s_erff.c
|
||||
src/s_exp2.c
|
||||
src/s_exp2f.c
|
||||
src/s_expm1.c
|
||||
src/s_expm1f.c
|
||||
src/s_fabs.c
|
||||
src/s_fabsf.c
|
||||
src/s_fdim.c
|
||||
src/s_floor.c
|
||||
src/s_floorf.c
|
||||
src/s_fmax.c
|
||||
src/s_fmaxf.c
|
||||
src/s_fmin.c
|
||||
src/s_fminf.c
|
||||
src/s_fpclassify.c
|
||||
src/s_frexp.c
|
||||
src/s_frexpf.c
|
||||
src/s_ilogb.c
|
||||
src/s_ilogbf.c
|
||||
src/s_isinf.c
|
||||
src/s_isfinite.c
|
||||
src/s_isnormal.c
|
||||
src/s_isnan.c
|
||||
src/s_log1p.c
|
||||
src/s_log1pf.c
|
||||
src/s_logb.c
|
||||
src/s_logbf.c
|
||||
src/s_modf.c
|
||||
src/s_modff.c
|
||||
src/s_nextafter.c
|
||||
src/s_nextafterf.c
|
||||
src/s_nexttowardf.c
|
||||
src/s_remquo.c
|
||||
src/s_remquof.c
|
||||
src/s_rint.c
|
||||
src/s_rintf.c
|
||||
src/s_round.c
|
||||
src/s_roundf.c
|
||||
src/s_scalbln.c
|
||||
src/s_scalbn.c
|
||||
src/s_scalbnf.c
|
||||
src/s_signbit.c
|
||||
src/s_signgam.c
|
||||
src/s_sin.c
|
||||
src/s_sincos.c
|
||||
src/s_sinf.c
|
||||
src/s_sincosf.c
|
||||
src/s_tan.c
|
||||
src/s_tanf.c
|
||||
src/s_tanh.c
|
||||
src/s_tanhf.c
|
||||
src/s_tgammaf.c
|
||||
src/s_trunc.c
|
||||
src/s_truncf.c
|
||||
src/s_cpow.c
|
||||
src/s_cpowf.c
|
||||
src/w_cabs.c
|
||||
src/w_cabsf.c
|
||||
|
||||
# common non-WINNT specific
|
||||
src/s_nan.c
|
||||
|
||||
# common C99 long double functions
|
||||
src/s_copysignl.c
|
||||
src/s_fabsl.c
|
||||
src/s_llrintl.c
|
||||
src/s_lrintl.c
|
||||
src/s_modfl.c
|
||||
|
||||
# common C99 complex function
|
||||
src/s_ccosh.c
|
||||
src/s_ccoshf.c
|
||||
src/s_cexp.c
|
||||
src/s_cexpf.c
|
||||
src/s_cimag.c
|
||||
src/s_cimagf.c
|
||||
src/s_conj.c
|
||||
src/s_conjf.c
|
||||
src/s_cproj.c
|
||||
src/s_cprojf.c
|
||||
src/s_creal.c
|
||||
src/s_crealf.c
|
||||
src/s_csinh.c
|
||||
src/s_csinhf.c
|
||||
src/s_ctanh.c
|
||||
src/s_ctanhf.c
|
||||
src/s_cacos.c
|
||||
src/s_cacosf.c
|
||||
src/s_cacosh.c
|
||||
src/s_cacoshf.c
|
||||
src/s_casin.c
|
||||
src/s_casinf.c
|
||||
src/s_casinh.c
|
||||
src/s_casinhf.c
|
||||
src/s_catan.c
|
||||
src/s_catanf.c
|
||||
src/s_catanh.c
|
||||
src/s_catanhf.c
|
||||
src/s_clog.c
|
||||
src/s_clogf.c
|
||||
)
|
||||
|
||||
## generate the project
|
||||
|
||||
project(openlibm LANGUAGES C ASM)
|
||||
include_directories(include/ src/ sh3eb/ bsdsrc/)
|
||||
add_compile_options(
|
||||
-D__sh3__=1
|
||||
-DASSEMBLER
|
||||
-D__BSD_VISIBLE
|
||||
-Wno-implicit-function-declaration
|
||||
-Wall
|
||||
-Wextra
|
||||
-fPIC
|
||||
-ffreestanding
|
||||
-nostdlib
|
||||
-m3
|
||||
-mb
|
||||
-std=c99
|
||||
-fno-gnu89-inline
|
||||
-fno-builtin
|
||||
-O3
|
||||
)
|
||||
add_library(openlibm ${VXOPENLIBM_SOURCES})
|
||||
|
||||
## install configuration
|
||||
|
||||
set_target_properties(openlibm PROPERTIES OUTPUT_NAME "m")
|
||||
install(DIRECTORY include/ DESTINATION include)
|
||||
install(TARGETS openlibm DESTINATION lib)
|
|
@ -0,0 +1,25 @@
|
|||
#ifdef OPENLIBM_USE_HOST_FENV_H
|
||||
#include <fenv.h>
|
||||
#else /* !OPENLIBM_USE_HOST_FENV_H */
|
||||
|
||||
#if defined(__aarch64__) || defined(__arm__)
|
||||
#include <openlibm_fenv_arm.h>
|
||||
#elif defined(__x86_64__)
|
||||
#include <openlibm_fenv_amd64.h>
|
||||
#elif defined(__i386__)
|
||||
#include <openlibm_fenv_i387.h>
|
||||
#elif defined(__powerpc__) || defined(__ppc__)
|
||||
#include <openlibm_fenv_powerpc.h>
|
||||
#elif defined(__mips__)
|
||||
#include <openlibm_fenv_mips.h>
|
||||
#elif defined(__s390__)
|
||||
#include <openlibm_fenv_s390.h>
|
||||
#elif defined(__riscv)
|
||||
#include <openlibm_fenv_riscv.h>
|
||||
#elif defined(__sh3__)
|
||||
#include <openlibm_fenv_sh3eb.h>
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
|
||||
#endif /* OPENLIBM_USE_HOST_FENV_H */
|
|
@ -0,0 +1,95 @@
|
|||
/*-
|
||||
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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 AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _FENV_H_
|
||||
#define _FENV_H_
|
||||
|
||||
#include <stdint.h>
|
||||
//#include "cdefs-compat.h"
|
||||
|
||||
#ifndef __fenv_static
|
||||
#define __fenv_static static
|
||||
#endif
|
||||
|
||||
typedef uint32_t fenv_t;
|
||||
typedef uint32_t fexcept_t;
|
||||
|
||||
/* Exception flags */
|
||||
#define _FPUSW_SHIFT 16
|
||||
#define FE_INVALID 0x0001
|
||||
#define FE_DIVBYZERO 0x0002
|
||||
#define FE_OVERFLOW 0x0004
|
||||
#define FE_UNDERFLOW 0x0008
|
||||
#define FE_INEXACT 0x0010
|
||||
|
||||
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \
|
||||
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
|
||||
|
||||
/* Rounding modes */
|
||||
#define FE_TONEAREST 0x0000
|
||||
#define FE_TOWARDZERO 0x0001
|
||||
#define FE_UPWARD 0x0002
|
||||
#define FE_DOWNWARD 0x0003
|
||||
#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
|
||||
FE_UPWARD | FE_TOWARDZERO)
|
||||
|
||||
//__BEGIN_DECLS
|
||||
|
||||
/* Default floating-point environment */
|
||||
extern const fenv_t __fe_dfl_env;
|
||||
#define FE_DFL_ENV (&__fe_dfl_env)
|
||||
|
||||
/* We need to be able to map status flag positions to mask flag positions */
|
||||
#define _ENABLE_SHIFT 5
|
||||
#define _ENABLE_MASK (FE_ALL_EXCEPT << _ENABLE_SHIFT)
|
||||
|
||||
int feclearexcept(int __excepts);
|
||||
int fegetexceptflag(fexcept_t *__flagp, int __excepts);
|
||||
int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
|
||||
int feraiseexcept(int __excepts);
|
||||
int fetestexcept(int __excepts);
|
||||
int fegetround(void);
|
||||
int fesetround(int __round);
|
||||
int fegetenv(fenv_t *__envp);
|
||||
int feholdexcept(fenv_t *__envp);
|
||||
int fesetenv(const fenv_t *__envp);
|
||||
int feupdateenv(const fenv_t *__envp);
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
|
||||
/* We currently provide no external definitions of the functions below. */
|
||||
|
||||
int feenableexcept(int __mask);
|
||||
int fedisableexcept(int __mask);
|
||||
int fegetexcept(void);
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
//__END_DECLS
|
||||
|
||||
#endif /* !_FENV_H_ */
|
|
@ -0,0 +1 @@
|
|||
$(CUR_SRCS) = fenv.c
|
|
@ -0,0 +1,2 @@
|
|||
#pragma once
|
||||
#define assert(b)
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
static int isxdigit(int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') ||
|
||||
(c >= 'a' && c <= 'f');
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
/*-
|
||||
* Copyright (c) 2004-2011 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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 AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _FENV_H_
|
||||
#error "This file is meant to be included only by <fenv.h>."
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This file implements the functionality of <fenv.h> on platforms that
|
||||
* lack an FPU and use softfloat in libc for floating point. To use it,
|
||||
* you must write an <fenv.h> that provides the following:
|
||||
*
|
||||
* - a typedef for fenv_t, which may be an integer or struct type
|
||||
* - a typedef for fexcept_t (XXX This file assumes fexcept_t is a
|
||||
* simple integer type containing the exception mask.)
|
||||
* - definitions of FE_* constants for the five exceptions and four
|
||||
* rounding modes in IEEE 754, as described in fenv(3)
|
||||
* - a definition, and the corresponding external symbol, for FE_DFL_ENV
|
||||
* - a macro __set_env(env, flags, mask, rnd), which sets the given fenv_t
|
||||
* from the exception flags, mask, and rounding mode
|
||||
* - macros __env_flags(env), __env_mask(env), and __env_round(env), which
|
||||
* extract fields from an fenv_t
|
||||
* - a definition of __fenv_static
|
||||
*
|
||||
* If the architecture supports an optional FPU, it's recommended that you
|
||||
* define fenv_t and fexcept_t to match the hardware ABI. Otherwise, it
|
||||
* doesn't matter how you define them.
|
||||
*/
|
||||
|
||||
extern int __softfloat_float_exception_flags;
|
||||
extern int __softfloat_float_exception_mask;
|
||||
extern int __softfloat_float_rounding_mode;
|
||||
|
||||
__fenv_static inline int
|
||||
feclearexcept(int __excepts)
|
||||
{
|
||||
|
||||
__softfloat_float_exception_flags &= ~__excepts;
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fegetexceptflag(fexcept_t *__flagp, int __excepts)
|
||||
{
|
||||
|
||||
*__flagp = __softfloat_float_exception_flags & __excepts;
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fesetexceptflag(const fexcept_t *__flagp, int __excepts)
|
||||
{
|
||||
|
||||
__softfloat_float_exception_flags &= ~__excepts;
|
||||
__softfloat_float_exception_flags |= *__flagp & __excepts;
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
feraiseexcept(int __excepts)
|
||||
{
|
||||
|
||||
__softfloat_float_exception_flags |= __excepts;
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fetestexcept(int __excepts)
|
||||
{
|
||||
|
||||
return (__softfloat_float_exception_flags & __excepts);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fegetround(void)
|
||||
{
|
||||
|
||||
return (__softfloat_float_rounding_mode);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fesetround(int __round)
|
||||
{
|
||||
|
||||
__softfloat_float_rounding_mode = __round;
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fegetenv(fenv_t *__envp)
|
||||
{
|
||||
|
||||
__set_env(*__envp, __softfloat_float_exception_flags,
|
||||
__softfloat_float_exception_mask, __softfloat_float_rounding_mode);
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
feholdexcept(fenv_t *__envp)
|
||||
{
|
||||
fenv_t __env;
|
||||
|
||||
fegetenv(__envp);
|
||||
__softfloat_float_exception_flags = 0;
|
||||
__softfloat_float_exception_mask = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fesetenv(const fenv_t *__envp)
|
||||
{
|
||||
|
||||
__softfloat_float_exception_flags = __env_flags(*__envp);
|
||||
__softfloat_float_exception_mask = __env_mask(*__envp);
|
||||
__softfloat_float_rounding_mode = __env_round(*__envp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
feupdateenv(const fenv_t *__envp)
|
||||
{
|
||||
int __oflags = __softfloat_float_exception_flags;
|
||||
|
||||
fesetenv(__envp);
|
||||
feraiseexcept(__oflags);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if __BSD_VISIBLE
|
||||
|
||||
/* We currently provide no external definitions of the functions below. */
|
||||
|
||||
__fenv_static inline int
|
||||
feenableexcept(int __mask)
|
||||
{
|
||||
int __omask = __softfloat_float_exception_mask;
|
||||
|
||||
__softfloat_float_exception_mask |= __mask;
|
||||
return (__omask);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fedisableexcept(int __mask)
|
||||
{
|
||||
int __omask = __softfloat_float_exception_mask;
|
||||
|
||||
__softfloat_float_exception_mask &= ~__mask;
|
||||
return (__omask);
|
||||
}
|
||||
|
||||
__fenv_static inline int
|
||||
fegetexcept(void)
|
||||
{
|
||||
|
||||
return (__softfloat_float_exception_mask);
|
||||
}
|
||||
|
||||
#endif /* __BSD_VISIBLE */
|
|
@ -0,0 +1,71 @@
|
|||
/*-
|
||||
* Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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 AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define __fenv_static
|
||||
#include "openlibm_fenv.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
#ifdef __GNUC_GNU_INLINE__
|
||||
#error "This file must be compiled with C99 'inline' semantics"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Hopefully the system ID byte is immutable, so it's valid to use
|
||||
* this as a default environment.
|
||||
*/
|
||||
const fenv_t __fe_dfl_env = 0;
|
||||
|
||||
int __softfloat_float_exception_flags = 0;
|
||||
int __softfloat_float_exception_mask = 0;
|
||||
int __softfloat_float_rounding_mode = FLT_ROUNDS;
|
||||
|
||||
#define __set_env(env, flags, mask, rnd) env = ((flags) \
|
||||
| (mask)<<_FPUSW_SHIFT \
|
||||
| (rnd) << 24)
|
||||
#define __env_flags(env) ((env) & FE_ALL_EXCEPT)
|
||||
#define __env_mask(env) (((env) >> _FPUSW_SHIFT) \
|
||||
& FE_ALL_EXCEPT)
|
||||
#define __env_round(env) (((env) >> 24) & _ROUND_MASK)
|
||||
#include "fenv-softfloat.h"
|
||||
|
||||
extern inline int feclearexcept(int __excepts);
|
||||
extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);
|
||||
extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
|
||||
extern inline int feraiseexcept(int __excepts);
|
||||
extern inline int fetestexcept(int __excepts);
|
||||
extern inline int fegetround(void);
|
||||
extern inline int fesetround(int __round);
|
||||
extern inline int fegetenv(fenv_t *__envp);
|
||||
extern inline int feholdexcept(fenv_t *__envp);
|
||||
extern inline int fesetenv(const fenv_t *__envp);
|
||||
extern inline int feupdateenv(const fenv_t *__envp);
|
||||
extern inline int feenableexcept(int __mask);
|
||||
extern inline int fedisableexcept(int __mask);
|
||||
extern inline int fegetexcept(void);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#pragma once
|
||||
#include <stddef.h>
|
||||
|
||||
void *memset(void *mem, int fill, size_t size);
|
|
@ -0,0 +1,113 @@
|
|||
#ifndef _CDEFS_COMPAT_H_
|
||||
#define _CDEFS_COMPAT_H_
|
||||
|
||||
#if !defined(__BEGIN_DECLS)
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#else
|
||||
#define __BEGIN_DECLS
|
||||
#define __END_DECLS
|
||||
#endif
|
||||
#endif /* !defined(__BEGIN_DECLS) */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__strong_alias) && defined(__NetBSD__)
|
||||
#define openlibm_strong_reference(sym,alias) __strong_alias(alias,sym)
|
||||
#elif defined(__strong_reference)
|
||||
#define openlibm_strong_reference(sym,alias) __strong_reference(sym,alias)
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
#define openlibm_strong_reference(sym,aliassym) openlibm_weak_reference(sym,aliassym)
|
||||
#else
|
||||
#define openlibm_strong_reference(sym,aliassym) \
|
||||
OLM_DLLEXPORT extern __typeof (aliassym) aliassym __attribute__ ((__alias__ (#sym)));
|
||||
#endif /* __APPLE__ */
|
||||
#endif /* __strong_reference */
|
||||
|
||||
#ifdef __wasm__
|
||||
#define openlibm_weak_reference(sym,alias) openlibm_strong_reference(sym,alias)
|
||||
#elif defined(__weak_alias) && defined(__NetBSD__)
|
||||
#define openlibm_weak_reference(sym,alias) __weak_alias(alias,sym)
|
||||
#elif defined(__weak_reference)
|
||||
#define openlibm_weak_reference(sym,alias) __weak_reference(sym,alias)
|
||||
#else
|
||||
#ifdef __ELF__
|
||||
#ifdef __STDC__
|
||||
|
||||
#if defined(__sh3__)
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".weak _" #alias); \
|
||||
__asm__(".equ _" #alias ", _" #sym)
|
||||
#else
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".weak " #alias); \
|
||||
__asm__(".equ " #alias ", " #sym)
|
||||
#endif /* __sh3__ */
|
||||
|
||||
#ifdef __warn_references
|
||||
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
|
||||
#else
|
||||
#define openlibm_warn_references(sym,msg) \
|
||||
__asm__(".section .gnu.warning." #sym); \
|
||||
__asm__(".asciz \"" msg "\""); \
|
||||
__asm__(".previous")
|
||||
#endif /* __warn_references */
|
||||
#else
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".weak alias"); \
|
||||
__asm__(".equ alias, sym")
|
||||
#ifdef __warn_references
|
||||
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
|
||||
#else
|
||||
#define openlibm_warn_references(sym,msg) \
|
||||
__asm__(".section .gnu.warning.sym"); \
|
||||
__asm__(".asciz \"msg\""); \
|
||||
__asm__(".previous")
|
||||
#endif /* __warn_references */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined(__clang__) /* CLANG */
|
||||
#if defined(_WIN32) && defined(_X86_)
|
||||
#define openlibm_asm_symbol_prefix "_"
|
||||
#else
|
||||
#define openlibm_asm_symbol_prefix ""
|
||||
#endif
|
||||
#ifdef __STDC__
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".weak_reference " openlibm_asm_symbol_prefix #alias); \
|
||||
__asm__(".set " openlibm_asm_symbol_prefix #alias ", " openlibm_asm_symbol_prefix #sym)
|
||||
#else
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".weak_reference openlibm_asm_symbol_prefix/**/alias");\
|
||||
__asm__(".set openlibm_asm_symbol_prefix/**/alias, openlibm_asm_symbol_prefix/**/sym")
|
||||
#endif
|
||||
#else /* !__ELF__ */
|
||||
#ifdef __STDC__
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
|
||||
__asm__(".stabs \"_" #sym "\",1,0,0,0")
|
||||
#ifdef __warn_references
|
||||
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
|
||||
#else
|
||||
#define openlibm_warn_references(sym,msg) \
|
||||
__asm__(".stabs \"" msg "\",30,0,0,0"); \
|
||||
__asm__(".stabs \"_" #sym "\",1,0,0,0")
|
||||
#endif /* __warn_references */
|
||||
#else
|
||||
#define openlibm_weak_reference(sym,alias) \
|
||||
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
|
||||
__asm__(".stabs \"_/**/sym\",1,0,0,0")
|
||||
#ifdef __warn_references
|
||||
#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
|
||||
#else
|
||||
#define openlibm_warn_references(sym,msg) \
|
||||
__asm__(".stabs msg,30,0,0,0"); \
|
||||
__asm__(".stabs \"_/**/sym\",1,0,0,0")
|
||||
#endif /* __warn_references */
|
||||
#endif /* __STDC__ */
|
||||
#endif /* __ELF__ */
|
||||
#endif /* __weak_reference */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
||||
#endif /* _CDEFS_COMPAT_H_ */
|
|
@ -0,0 +1,124 @@
|
|||
/*-
|
||||
* Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
|
||||
* Copyright (c) 2002 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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 AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/fpmath.h,v 1.4 2008/12/23 22:20:59 marcel Exp $
|
||||
*/
|
||||
#ifndef _FPMATH_H_
|
||||
#define _FPMATH_H_
|
||||
|
||||
#if defined(__aarch64__)
|
||||
#include "aarch64_fpmath.h"
|
||||
#elif defined(__i386__) || defined(__x86_64__)
|
||||
#ifdef __LP64__
|
||||
#include "amd64_fpmath.h"
|
||||
#else
|
||||
#include "i386_fpmath.h"
|
||||
#endif
|
||||
#elif defined(__powerpc__) || defined(__ppc__)
|
||||
#include "powerpc_fpmath.h"
|
||||
#elif defined(__mips__)
|
||||
#include "mips_fpmath.h"
|
||||
#elif defined(__s390__)
|
||||
#include "s390_fpmath.h"
|
||||
#elif defined(__riscv)
|
||||
#include "riscv_fpmath.h"
|
||||
#elif defined(__sh3__)
|
||||
#include "sh3eb_fpmath.h"
|
||||
#endif
|
||||
|
||||
/* Definitions provided directly by GCC and Clang. */
|
||||
#if !(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__))
|
||||
|
||||
#if defined(__GLIBC__)
|
||||
|
||||
#include <features.h>
|
||||
#include <endian.h>
|
||||
#define __ORDER_LITTLE_ENDIAN__ __LITTLE_ENDIAN
|
||||
#define __ORDER_BIG_ENDIAN__ __BIG_ENDIAN
|
||||
#define __BYTE_ORDER__ __BYTE_ORDER
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
#include <machine/endian.h>
|
||||
#define __ORDER_LITTLE_ENDIAN__ LITTLE_ENDIAN
|
||||
#define __ORDER_BIG_ENDIAN__ BIG_ENDIAN
|
||||
#define __BYTE_ORDER__ BYTE_ORDER
|
||||
|
||||
#elif defined(_WIN32)
|
||||
|
||||
#define __ORDER_LITTLE_ENDIAN__ 1234
|
||||
#define __ORDER_BIG_ENDIAN__ 4321
|
||||
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__ and __ORDER_BIG_ENDIAN__ */
|
||||
|
||||
#ifndef __FLOAT_WORD_ORDER__
|
||||
#define __FLOAT_WORD_ORDER__ __BYTE_ORDER__
|
||||
#endif
|
||||
|
||||
union IEEEf2bits {
|
||||
float f;
|
||||
struct {
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
unsigned int man :23;
|
||||
unsigned int exp :8;
|
||||
unsigned int sign :1;
|
||||
#else /* _BIG_ENDIAN */
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :8;
|
||||
unsigned int man :23;
|
||||
#endif
|
||||
} bits;
|
||||
};
|
||||
|
||||
#define DBL_MANH_SIZE 20
|
||||
#define DBL_MANL_SIZE 32
|
||||
|
||||
union IEEEd2bits {
|
||||
double d;
|
||||
struct {
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
unsigned int manl :32;
|
||||
#endif
|
||||
unsigned int manh :20;
|
||||
unsigned int exp :11;
|
||||
unsigned int sign :1;
|
||||
#if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
unsigned int manl :32;
|
||||
#endif
|
||||
#else /* _BIG_ENDIAN */
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :11;
|
||||
unsigned int manh :20;
|
||||
unsigned int manl :32;
|
||||
#endif
|
||||
} bits;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
/*-
|
||||
* Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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 AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
union IEEEl2bits {
|
||||
long double e;
|
||||
struct {
|
||||
#ifndef __BIG_ENDIAN__
|
||||
unsigned int manl :32;
|
||||
unsigned int manh :20;
|
||||
unsigned int exp :11;
|
||||
unsigned int sign :1;
|
||||
#else
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :11;
|
||||
unsigned int manh :20;
|
||||
unsigned int manl :32;
|
||||
#endif
|
||||
} bits;
|
||||
};
|
||||
|
||||
#define LDBL_NBIT 0
|
||||
#define mask_nbit_l(u) ((void)0)
|
||||
#define LDBL_IMPLICIT_NBIT
|
||||
|
||||
#define LDBL_MANH_SIZE 20
|
||||
#define LDBL_MANL_SIZE 32
|
||||
|
||||
#define LDBL_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)(u).bits.manl; \
|
||||
(a)[1] = (uint32_t)(u).bits.manh; \
|
||||
} while(0)
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# vhex toolchain information
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
set(CMAKE_SYSTEM_PROCESSOR sh)
|
||||
|
||||
set(CMAKE_C_COMPILER sh-elf-vhex-gcc)
|
||||
set(CMAKE_CXX_COMPILER sh-elf-vhex-g++)
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "")
|
||||
set(CMAKE_CXX_FLAGS_INIT "")
|
||||
|
||||
add_compile_options(-nostdlib)
|
||||
add_link_options(-nostdlib)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
@ -0,0 +1,46 @@
|
|||
# module used to provide common variable / functions
|
||||
# this file must not be manually invoked
|
||||
|
||||
#---
|
||||
# Internals
|
||||
#---
|
||||
|
||||
# workaround used to self-kill the current process if an error is detected
|
||||
# in function
|
||||
trap 'exit 1' TERM
|
||||
export TOP_PID=$$
|
||||
|
||||
#---
|
||||
# Public
|
||||
#---
|
||||
|
||||
# abstract the verbose mode
|
||||
function callcmd() {
|
||||
if [[ -v 'VHEX_VERBOSE' ]]
|
||||
then
|
||||
echo "$@"
|
||||
if ! "$@"; then
|
||||
echo "$TAG error: command failed, abord"
|
||||
kill -s TERM $TOP_PID
|
||||
fi
|
||||
else
|
||||
out='vxopenlibm_crash.txt'
|
||||
if ! "$@" >"$out" 2>&1; then
|
||||
echo "$TAG error: command failed, please check $(pwd)/$out o(x_x)o" >&2
|
||||
echo "$@" >&2
|
||||
kill -s TERM $TOP_PID
|
||||
fi
|
||||
rm -f "$out"
|
||||
fi
|
||||
}
|
||||
|
||||
# check env information
|
||||
function utils_get_env() {
|
||||
if [ ! -v "$1" ]
|
||||
then
|
||||
echo 'error: are you sure to use the bootstrap script ?' >&2
|
||||
echo " Missing $2 information, abord" >&2
|
||||
kill -s TERM $TOP_PID
|
||||
fi
|
||||
echo "${!1/#\~/$HOME}"
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#---
|
||||
# Help screen
|
||||
#---
|
||||
|
||||
function help() {
|
||||
cat << EOF
|
||||
Installation script for vxOpenLibm project (fork of OpenLibm)
|
||||
|
||||
Usage: $0 [options...]
|
||||
|
||||
Options:
|
||||
-h, --help display this help
|
||||
-y, --yes do not display validation step
|
||||
--verbose display more information during operations
|
||||
--prefix-sysroot sysroot (install) prefix path
|
||||
|
||||
Notes:
|
||||
This project is mainly automatically installed as a dependency of the
|
||||
sh-elf-vhex (Vhex's compiler) project. So, the verbose option can also be
|
||||
trigger using the env var VHEX_VERBOSE.
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
#---
|
||||
# Parse arguments
|
||||
#---
|
||||
|
||||
verbose=true
|
||||
skip_input=false
|
||||
prefix='None'
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-h | --help) help;;
|
||||
-y | --yes) skip_input=true;;
|
||||
-v | --verbose) verbose=true;;
|
||||
--prefix-sysroot=*) prefix=${arg#*=};;
|
||||
*)
|
||||
echo "error: unreconized argument '$arg', giving up." >&2
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
#---
|
||||
# Preliminary check
|
||||
#---
|
||||
|
||||
_src=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
cd "$_src" || exit 1
|
||||
source ./_utils.sh
|
||||
|
||||
if [[ ! $(sh-elf-vhex-gcc --version) ]]
|
||||
then
|
||||
echo -e \
|
||||
'You need to install the sh-elf-vhex compiler to install this ' \
|
||||
'project.\n' \
|
||||
'Also note that the installation if the compiler will automatically ' \
|
||||
'install this project'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d '../openlibm' ]]
|
||||
then
|
||||
echo 'OpenLibm already exists, abord' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
[[ "$verbose" == 'true' ]] && VHEX_VERBOSE='true'
|
||||
[[ "$prefix" != 'None' ]] && VHEX_PREFIX_SYSROOT="$prefix"
|
||||
export VHEX_VERBOSE
|
||||
export VHEX_PREFIX_SYSROOT
|
||||
|
||||
SYSROOT=$(utils_get_env 'VHEX_PREFIX_SYSROOT' 'sysroot')
|
||||
VERBOSE=$(utils_get_env 'VHEX_VERBOSE' 'verbose')
|
||||
|
||||
if [[ "$skip_input" != 'true' ]]
|
||||
then
|
||||
echo 'This script will compile and install the vxOpenLibm project'
|
||||
echo " - prefix = $SYSROOT"
|
||||
echo " - verbose = $VERBOSE"
|
||||
read -p 'Perform operations [Yn] ? ' -r valid
|
||||
if [[ "$valid" == 'n' ]]; then
|
||||
echo 'Operation aborted' >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#---
|
||||
# Build / install operations
|
||||
#---
|
||||
|
||||
source ./_utils.sh
|
||||
|
||||
TAG='<vxOpenLibm>'
|
||||
|
||||
echo "$TAG clone openlibm..."
|
||||
callcmd \
|
||||
git clone https://github.com/JuliaMath/openlibm.git --depth 1 ../openlibm
|
||||
|
||||
echo "$TAG patch openlibm sources..."
|
||||
cp -r ../patches/* ../openlibm
|
||||
|
||||
echo "$TAG building..."
|
||||
callcmd cmake \
|
||||
-DCMAKE_INSTALL_PREFIX="$SYSROOT" \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../patches/toolchain.cmake \
|
||||
-B ../openlibm/_build-vhex/ \
|
||||
-S ../openlibm/
|
||||
|
||||
callcmd cmake --build ../openlibm/_build-vhex/
|
||||
|
||||
callcmd cmake --install ../openlibm/_build-vhex/
|
Loading…
Reference in New Issue