mirror of
https://github.com/tailix/libclayer.git
synced 2024-11-20 11:06:24 -05:00
Move libc
This commit is contained in:
parent
ea359a1795
commit
05e449ee2c
27 changed files with 29 additions and 96 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -114,7 +114,7 @@ jobs:
|
||||||
- name: autogen
|
- name: autogen
|
||||||
run: ./autogen.sh
|
run: ./autogen.sh
|
||||||
- name: configure
|
- name: configure
|
||||||
run: ./configure --host='i386-elf' --enable-freestanding --with-libc CC="$(which i686-linux-gnu-gcc)"
|
run: ./configure --host='i386-elf' --enable-freestanding CC="$(which i686-linux-gnu-gcc)"
|
||||||
- name: make
|
- name: make
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -43,8 +43,6 @@
|
||||||
|
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
/include/Makefile.in
|
/include/Makefile.in
|
||||||
/libc/Makefile.in
|
|
||||||
/libc/include/Makefile.in
|
|
||||||
/tests/Makefile.in
|
/tests/Makefile.in
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
|
@ -71,8 +69,6 @@
|
||||||
|
|
||||||
/Makefile
|
/Makefile
|
||||||
/include/Makefile
|
/include/Makefile
|
||||||
/libc/Makefile
|
|
||||||
/libc/include/Makefile
|
|
||||||
/tests/Makefile
|
/tests/Makefile
|
||||||
|
|
||||||
/libkernaux.pc
|
/libkernaux.pc
|
||||||
|
|
|
@ -4,8 +4,8 @@ Common
|
||||||
* Add your name to [COPYING](/COPYING).
|
* Add your name to [COPYING](/COPYING).
|
||||||
* Don't add your name to `AUTHORS` - it's for maintainers.
|
* Don't add your name to `AUTHORS` - it's for maintainers.
|
||||||
* Add copyright notice in the beginning of changed files except the headers.
|
* Add copyright notice in the beginning of changed files except the headers.
|
||||||
* If you change the behavior (even just fix a bug) of **libkernaux** (stable) or
|
* If you change the behavior (even just fix a bug) of **libkernaux** (stable),
|
||||||
[libc](/libc), add a record to [ChangeLog](/ChangeLog).
|
add a record to [ChangeLog](/ChangeLog).
|
||||||
|
|
||||||
Prohibitions:
|
Prohibitions:
|
||||||
|
|
||||||
|
|
37
Makefile.am
37
Makefile.am
|
@ -4,22 +4,12 @@ include $(top_srcdir)/make/checks.am
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
EXTRA_DIST = autogen.sh CONTRIBUTING.md sha256sums.txt
|
EXTRA_DIST = autogen.sh CONTRIBUTING.md sha256sums.txt
|
||||||
|
|
||||||
SUBDIRS = include
|
SUBDIRS = include .
|
||||||
|
|
||||||
if WITH_LIBC
|
|
||||||
# FIXME: after "make clean" libc is not rebuiling
|
|
||||||
SUBDIRS += libc
|
|
||||||
endif
|
|
||||||
|
|
||||||
SUBDIRS += .
|
|
||||||
|
|
||||||
if ENABLE_CHECKS
|
if ENABLE_CHECKS
|
||||||
SUBDIRS += tests
|
SUBDIRS += tests
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libc/libc.la:
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/libc libc.la
|
|
||||||
|
|
||||||
AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE
|
AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE
|
||||||
|
|
||||||
lib_LTLIBRARIES = libkernaux.la
|
lib_LTLIBRARIES = libkernaux.la
|
||||||
|
@ -34,13 +24,24 @@ endif
|
||||||
##################
|
##################
|
||||||
|
|
||||||
libkernaux_la_LDFLAGS = -version-info @PACKAGE_VERSION_SO@
|
libkernaux_la_LDFLAGS = -version-info @PACKAGE_VERSION_SO@
|
||||||
libkernaux_la_LIBADD =
|
|
||||||
libkernaux_la_SOURCES = src/xxxxx.c
|
|
||||||
|
|
||||||
########
|
libkernaux_la_SOURCES = \
|
||||||
# libc #
|
src/ctype.c \
|
||||||
########
|
src/errno.c \
|
||||||
|
src/kernaux.c \
|
||||||
|
src/stdlib.c \
|
||||||
|
src/string.c
|
||||||
|
|
||||||
if WITH_LIBC
|
if ASM_I386
|
||||||
libkernaux_la_LIBADD += libc/libc.la
|
libkernaux_la_SOURCES += \
|
||||||
|
src/asm/i386/longjmp.S \
|
||||||
|
src/asm/i386/setjmp.S
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if ASM_X86_64
|
||||||
|
libkernaux_la_SOURCES += \
|
||||||
|
src/asm/x86_64/longjmp.S \
|
||||||
|
src/asm/x86_64/setjmp.S
|
||||||
|
endif
|
||||||
|
|
||||||
|
# TODO: implement setjmp/longjmp for riscv64
|
||||||
|
|
21
README.md
21
README.md
|
@ -38,14 +38,13 @@ We use [semantic versioning](https://semver.org) for stable APIs. Stable APIs
|
||||||
may only change when major version number is increased (or minor while major is
|
may only change when major version number is increased (or minor while major is
|
||||||
zero). Work-in-progress APIs can change at any time.
|
zero). Work-in-progress APIs can change at any time.
|
||||||
|
|
||||||
* libc replacement (*work in progress*)
|
* [ctype.h](/include/ctype.h)
|
||||||
* [ctype.h](/libc/include/ctype.h)
|
* [errno.h](/include/errno.h)
|
||||||
* [errno.h](/libc/include/errno.h)
|
* [inttypes.h](/include/inttypes.h)
|
||||||
* [inttypes.h](/libc/include/inttypes.h)
|
* [setjmp.h](/include/setjmp.h)
|
||||||
* [setjmp.h](/libc/include/setjmp.h)
|
* [stdlib.h](/include/stdlib.h)
|
||||||
* [stdlib.h](/libc/include/stdlib.h)
|
* [string.h](/include/string.h)
|
||||||
* [string.h](/libc/include/string.h)
|
* [sys/types.h](/include/sys/types.h)
|
||||||
* [sys/types.h](/libc/include/sys/types.h)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,11 +69,6 @@ stable options.
|
||||||
* `--enable-pkg-config[=PATH]` - install pkg-config files
|
* `--enable-pkg-config[=PATH]` - install pkg-config files
|
||||||
[PATH='${libdir}/pkgconfig']
|
[PATH='${libdir}/pkgconfig']
|
||||||
|
|
||||||
#### Packages
|
|
||||||
|
|
||||||
* `--with-libc` - provides the replacement for some standard C functions.
|
|
||||||
Useful in freestanding environment, where no libc is present.
|
|
||||||
|
|
||||||
### Default options
|
### Default options
|
||||||
|
|
||||||
#### Features
|
#### Features
|
||||||
|
@ -129,7 +123,6 @@ without it in `$PATH`:
|
||||||
--host='i386-elf' \
|
--host='i386-elf' \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--enable-freestanding \
|
--enable-freestanding \
|
||||||
--with-libc \
|
|
||||||
CC="$(which i386-elf-gcc)"
|
CC="$(which i386-elf-gcc)"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
19
configure.ac
19
configure.ac
|
@ -27,8 +27,6 @@ AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
libkernaux.pc
|
libkernaux.pc
|
||||||
include/Makefile
|
include/Makefile
|
||||||
libc/Makefile
|
|
||||||
libc/include/Makefile
|
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -52,14 +50,10 @@ AC_ARG_ENABLE([freestanding], AS_HELP_STRING([--enable-freestanding], [bui
|
||||||
AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks], [enable usual tests]))
|
AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks], [enable usual tests]))
|
||||||
AC_ARG_ENABLE([checks-all], AS_HELP_STRING([--enable-checks-all], [enable all checks]))
|
AC_ARG_ENABLE([checks-all], AS_HELP_STRING([--enable-checks-all], [enable all checks]))
|
||||||
AC_ARG_ENABLE([checks-cppcheck], AS_HELP_STRING([--enable-checks-cppcheck], [enable cppcheck]))
|
AC_ARG_ENABLE([checks-cppcheck], AS_HELP_STRING([--enable-checks-cppcheck], [enable cppcheck]))
|
||||||
AC_ARG_ENABLE([split-libc], AS_HELP_STRING([--enable-split-libc], [split off libc]))
|
|
||||||
|
|
||||||
dnl Features (with parameter)
|
dnl Features (with parameter)
|
||||||
AC_ARG_ENABLE([pkg-config], AS_HELP_STRING([--enable-pkg-config@<:@=PATH@:>@], [install pkg-config files @<:@PATH='${libdir}/pkgconfig'@:>@]))
|
AC_ARG_ENABLE([pkg-config], AS_HELP_STRING([--enable-pkg-config@<:@=PATH@:>@], [install pkg-config files @<:@PATH='${libdir}/pkgconfig'@:>@]))
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
|
||||||
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################
|
################
|
||||||
|
@ -88,15 +82,11 @@ AS_IF([test "$enable_freestanding" = yes], [enable_freestanding=yes], [ena
|
||||||
AS_IF([test "$enable_checks" = yes], [enable_checks=yes], [enable_checks=no])
|
AS_IF([test "$enable_checks" = yes], [enable_checks=yes], [enable_checks=no])
|
||||||
AS_IF([test "$enable_checks_all" = yes], [enable_checks_all=yes], [enable_checks_all=no])
|
AS_IF([test "$enable_checks_all" = yes], [enable_checks_all=yes], [enable_checks_all=no])
|
||||||
AS_IF([test "$enable_checks_cppcheck" = yes], [enable_checks_cppcheck=yes], [enable_checks_cppcheck=no])
|
AS_IF([test "$enable_checks_cppcheck" = yes], [enable_checks_cppcheck=yes], [enable_checks_cppcheck=no])
|
||||||
AS_IF([test "$enable_split_libc" = yes], [enable_split_libc=yes], [enable_split_libc=no])
|
|
||||||
|
|
||||||
dnl Features (with parameter)
|
dnl Features (with parameter)
|
||||||
AS_IF([test "$enable_pkg_config" = yes], [enable_pkg_config='${libdir}/pkgconfig'])
|
AS_IF([test "$enable_pkg_config" = yes], [enable_pkg_config='${libdir}/pkgconfig'])
|
||||||
AS_IF([test "$enable_pkg_config" = no ], [enable_pkg_config=''])
|
AS_IF([test "$enable_pkg_config" = no ], [enable_pkg_config=''])
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
|
||||||
AS_IF([test "$with_libc" = yes], [with_libc=yes], [with_libc=no])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
|
@ -104,7 +94,6 @@ AS_IF([test "$with_libc" = yes], [with_libc=yes], [wit
|
||||||
#############
|
#############
|
||||||
|
|
||||||
AS_IF([test "$enable_checks" = yes -a "$enable_freestanding" = yes], AC_MSG_ERROR([can not build freestanding tests]))
|
AS_IF([test "$enable_checks" = yes -a "$enable_freestanding" = yes], AC_MSG_ERROR([can not build freestanding tests]))
|
||||||
AS_IF([test "$enable_checks" = yes -a "$with_libc" = yes], AC_MSG_ERROR([can not use package `libc' with tests]))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,14 +117,10 @@ dnl Features (disabled by default)
|
||||||
AM_CONDITIONAL([ENABLE_FREESTANDING], [test "$enable_freestanding" = yes])
|
AM_CONDITIONAL([ENABLE_FREESTANDING], [test "$enable_freestanding" = yes])
|
||||||
AM_CONDITIONAL([ENABLE_CHECKS], [test "$enable_checks" = yes])
|
AM_CONDITIONAL([ENABLE_CHECKS], [test "$enable_checks" = yes])
|
||||||
AM_CONDITIONAL([ENABLE_CHECKS_CPPCHECK], [test "$enable_checks_cppcheck" = yes])
|
AM_CONDITIONAL([ENABLE_CHECKS_CPPCHECK], [test "$enable_checks_cppcheck" = yes])
|
||||||
AM_CONDITIONAL([ENABLE_SPLIT_LIBC], [test "$enable_split_libc" = yes])
|
|
||||||
|
|
||||||
dnl Features (with parameter)
|
dnl Features (with parameter)
|
||||||
AM_CONDITIONAL([ENABLE_PKG_CONFIG], [test ! -z "$enable_pkg_config"])
|
AM_CONDITIONAL([ENABLE_PKG_CONFIG], [test ! -z "$enable_pkg_config"])
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
|
||||||
AM_CONDITIONAL([WITH_LIBC], [test "$with_libc" = yes])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
@ -159,10 +144,6 @@ dnl Features (disabled by default)
|
||||||
AS_IF([test "$enable_freestanding" = yes], [AC_DEFINE([ENABLE_FREESTANDING], [1], [build for freestanding environment])])
|
AS_IF([test "$enable_freestanding" = yes], [AC_DEFINE([ENABLE_FREESTANDING], [1], [build for freestanding environment])])
|
||||||
AS_IF([test "$enable_checks" = yes], [AC_DEFINE([ENABLE_CHECKS], [1], [enabled usual tests])])
|
AS_IF([test "$enable_checks" = yes], [AC_DEFINE([ENABLE_CHECKS], [1], [enabled usual tests])])
|
||||||
AS_IF([test "$enable_checks_cppcheck" = yes], [AC_DEFINE([ENABLE_CHECKS_CPPCHECK], [1], [enabled cppcheck])])
|
AS_IF([test "$enable_checks_cppcheck" = yes], [AC_DEFINE([ENABLE_CHECKS_CPPCHECK], [1], [enabled cppcheck])])
|
||||||
AS_IF([test "$enable_split_libc" = yes], [AC_DEFINE([ENABLE_SPLIT_LIBC], [1], [split off libc])])
|
|
||||||
|
|
||||||
dnl Packages (disabled by default)
|
|
||||||
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with libc replacement])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
include $(top_srcdir)/make/shared.am
|
|
||||||
|
|
||||||
SUBDIRS = include
|
|
||||||
|
|
||||||
if ENABLE_SPLIT_LIBC
|
|
||||||
lib_LTLIBRARIES = libc.la
|
|
||||||
else
|
|
||||||
EXTRA_LTLIBRARIES = libc.la
|
|
||||||
endif
|
|
||||||
|
|
||||||
libc_la_SOURCES = \
|
|
||||||
src/ctype.c \
|
|
||||||
src/errno.c \
|
|
||||||
src/kernaux.c \
|
|
||||||
src/stdlib.c \
|
|
||||||
src/string.c
|
|
||||||
|
|
||||||
if ASM_I386
|
|
||||||
libc_la_SOURCES += \
|
|
||||||
src/asm/i386/longjmp.S \
|
|
||||||
src/asm/i386/setjmp.S
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ASM_X86_64
|
|
||||||
libc_la_SOURCES += \
|
|
||||||
src/asm/x86_64/longjmp.S \
|
|
||||||
src/asm/x86_64/setjmp.S
|
|
||||||
endif
|
|
||||||
|
|
||||||
# TODO: implement setjmp/longjmp for riscv64
|
|
|
@ -25,8 +25,6 @@ CPPCHECK_SUPPRESS = \
|
||||||
CPPCHECK_PATHS = \
|
CPPCHECK_PATHS = \
|
||||||
$(top_builddir)/include \
|
$(top_builddir)/include \
|
||||||
$(top_srcdir)/include \
|
$(top_srcdir)/include \
|
||||||
$(top_builddir)/libc \
|
|
||||||
$(top_srcdir)/libc \
|
|
||||||
$(top_builddir)/src \
|
$(top_builddir)/src \
|
||||||
$(top_srcdir)/src \
|
$(top_srcdir)/src \
|
||||||
$(top_builddir)/tests \
|
$(top_builddir)/tests \
|
||||||
|
|
|
@ -9,12 +9,6 @@ AM_CFLAGS = \
|
||||||
-I$(top_srcdir)/include \
|
-I$(top_srcdir)/include \
|
||||||
-D_POSIX_C_SOURCE=200809L
|
-D_POSIX_C_SOURCE=200809L
|
||||||
|
|
||||||
if WITH_LIBC
|
|
||||||
AM_CFLAGS += \
|
|
||||||
-I$(top_builddir)/libc/include \
|
|
||||||
-I$(top_srcdir)/libc/include
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ENABLE_WERROR
|
if ENABLE_WERROR
|
||||||
AM_CFLAGS += -Werror
|
AM_CFLAGS += -Werror
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue