1
0
Fork 0
mirror of https://github.com/tailix/libclayer.git synced 2024-11-20 11:06:24 -05:00

Move libc

This commit is contained in:
Alex Kotov 2022-12-25 14:06:58 +04:00
parent ea359a1795
commit 05e449ee2c
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
27 changed files with 29 additions and 96 deletions

View file

@ -114,7 +114,7 @@ jobs:
- name: autogen
run: ./autogen.sh
- 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
run: make

4
.gitignore vendored
View file

@ -43,8 +43,6 @@
/Makefile.in
/include/Makefile.in
/libc/Makefile.in
/libc/include/Makefile.in
/tests/Makefile.in
###########################################
@ -71,8 +69,6 @@
/Makefile
/include/Makefile
/libc/Makefile
/libc/include/Makefile
/tests/Makefile
/libkernaux.pc

View file

@ -4,8 +4,8 @@ Common
* Add your name to [COPYING](/COPYING).
* Don't add your name to `AUTHORS` - it's for maintainers.
* 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
[libc](/libc), add a record to [ChangeLog](/ChangeLog).
* If you change the behavior (even just fix a bug) of **libkernaux** (stable),
add a record to [ChangeLog](/ChangeLog).
Prohibitions:

View file

@ -4,22 +4,12 @@ include $(top_srcdir)/make/checks.am
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = autogen.sh CONTRIBUTING.md sha256sums.txt
SUBDIRS = include
if WITH_LIBC
# FIXME: after "make clean" libc is not rebuiling
SUBDIRS += libc
endif
SUBDIRS += .
SUBDIRS = include .
if ENABLE_CHECKS
SUBDIRS += tests
endif
libc/libc.la:
$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/libc libc.la
AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE
lib_LTLIBRARIES = libkernaux.la
@ -34,13 +24,24 @@ endif
##################
libkernaux_la_LDFLAGS = -version-info @PACKAGE_VERSION_SO@
libkernaux_la_LIBADD =
libkernaux_la_SOURCES = src/xxxxx.c
########
# libc #
########
libkernaux_la_SOURCES = \
src/ctype.c \
src/errno.c \
src/kernaux.c \
src/stdlib.c \
src/string.c
if WITH_LIBC
libkernaux_la_LIBADD += libc/libc.la
if ASM_I386
libkernaux_la_SOURCES += \
src/asm/i386/longjmp.S \
src/asm/i386/setjmp.S
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

View file

@ -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
zero). Work-in-progress APIs can change at any time.
* libc replacement (*work in progress*)
* [ctype.h](/libc/include/ctype.h)
* [errno.h](/libc/include/errno.h)
* [inttypes.h](/libc/include/inttypes.h)
* [setjmp.h](/libc/include/setjmp.h)
* [stdlib.h](/libc/include/stdlib.h)
* [string.h](/libc/include/string.h)
* [sys/types.h](/libc/include/sys/types.h)
* [ctype.h](/include/ctype.h)
* [errno.h](/include/errno.h)
* [inttypes.h](/include/inttypes.h)
* [setjmp.h](/include/setjmp.h)
* [stdlib.h](/include/stdlib.h)
* [string.h](/include/string.h)
* [sys/types.h](/include/sys/types.h)
@ -70,11 +69,6 @@ stable options.
* `--enable-pkg-config[=PATH]` - install pkg-config files
[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
#### Features
@ -129,7 +123,6 @@ without it in `$PATH`:
--host='i386-elf' \
--disable-shared \
--enable-freestanding \
--with-libc \
CC="$(which i386-elf-gcc)"
```

View file

@ -27,8 +27,6 @@ AC_CONFIG_FILES([
Makefile
libkernaux.pc
include/Makefile
libc/Makefile
libc/include/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-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([split-libc], AS_HELP_STRING([--enable-split-libc], [split off libc]))
dnl Features (with parameter)
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_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_split_libc" = yes], [enable_split_libc=yes], [enable_split_libc=no])
dnl Features (with parameter)
AS_IF([test "$enable_pkg_config" = yes], [enable_pkg_config='${libdir}/pkgconfig'])
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 "$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_CHECKS], [test "$enable_checks" = 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)
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_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_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])])

View file

@ -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

View file

@ -25,8 +25,6 @@ CPPCHECK_SUPPRESS = \
CPPCHECK_PATHS = \
$(top_builddir)/include \
$(top_srcdir)/include \
$(top_builddir)/libc \
$(top_srcdir)/libc \
$(top_builddir)/src \
$(top_srcdir)/src \
$(top_builddir)/tests \

View file

@ -9,12 +9,6 @@ AM_CFLAGS = \
-I$(top_srcdir)/include \
-D_POSIX_C_SOURCE=200809L
if WITH_LIBC
AM_CFLAGS += \
-I$(top_builddir)/libc/include \
-I$(top_srcdir)/libc/include
endif
if ENABLE_WERROR
AM_CFLAGS += -Werror
endif