mirror of https://github.com/tailix/libkernaux.git
Compare commits
6 Commits
b812b52a9c
...
5ac4de4203
Author | SHA1 | Date |
---|---|---|
Alex Kotov | 5ac4de4203 | |
Alex Kotov | 3cef48e2f3 | |
Alex Kotov | 16d47b8e42 | |
Alex Kotov | b5d7f714a1 | |
Alex Kotov | 1cfff3fca3 | |
Alex Kotov | 4d493ba3df |
|
@ -122,7 +122,7 @@ jobs:
|
|||
- name: autogen
|
||||
run: ./autogen.sh
|
||||
- name: configure
|
||||
run: ./configure --host='i386-elf' ${{matrix.assert}} --enable-freestanding --with-libc CC="$(which i686-linux-gnu-gcc)"
|
||||
run: ./configure --host='i386-elf' ${{matrix.assert}} --enable-freestanding CC="$(which i686-linux-gnu-gcc)"
|
||||
- name: make
|
||||
run: make
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
/examples/Makefile.in
|
||||
/fixtures/Makefile.in
|
||||
/include/Makefile.in
|
||||
/libc/Makefile.in
|
||||
/libc/include/Makefile.in
|
||||
/tests/Makefile.in
|
||||
|
||||
###########################################
|
||||
|
@ -78,6 +76,6 @@
|
|||
/examples/Makefile
|
||||
/fixtures/Makefile
|
||||
/include/Makefile
|
||||
/libc/Makefile
|
||||
/libc/include/Makefile
|
||||
/tests/Makefile
|
||||
|
||||
/libkernaux.pc
|
||||
|
|
|
@ -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), add a record
|
||||
to [ChangeLog](/ChangeLog).
|
||||
|
||||
Prohibitions:
|
||||
|
||||
|
|
59
ChangeLog
59
ChangeLog
|
@ -1,58 +1,7 @@
|
|||
2022-12-22 Alex Kotov <kotovalexarian@gmail.com>
|
||||
2022-12-27 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/memmap.h: Complete rewrite
|
||||
* configure.ac: Package "--with[out]-libc" has been removed
|
||||
|
||||
2022-12-21 Alex Kotov <kotovalexarian@gmail.com>
|
||||
2022-12-23 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* configure.ac: Rename feature "--(enable|disable)-debug" to
|
||||
"--(enable|disable)-assert"
|
||||
* include/: Definition "KERNAUX_DEBUG" has been removed
|
||||
* include/kernaux/runtime.h: New header
|
||||
* include/kernaux/assert.h: Removed header
|
||||
|
||||
2022-12-19 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* src/multiboot2/*_print.c: Print Multiboot 2 ELF section headers
|
||||
|
||||
2022-12-17 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* configure.ac: Feature "--(enable|disable)-fixtures" has been added
|
||||
* src/multiboot2/*_print.c: Print some values in hex
|
||||
|
||||
2022-12-16 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* configure.ac: Package "--with[out]-multiboot2" has been added
|
||||
* include/kernaux/multiboot2.h: Has been made stable
|
||||
|
||||
2022-12-14 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* configure.ac: Enable shared library
|
||||
|
||||
2022-12-13 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* tests/Makefile.am: Fix FreeBSD builds
|
||||
|
||||
2022-12-12 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* examples/Makefile.am: Fix builds without pthreads
|
||||
* include/: Non-conditional headers (except <kernaux/version.h>)
|
||||
|
||||
2022-12-11 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/macro.h: Macro "KERNAUX_STATIC_TEST" has been added
|
||||
|
||||
2022-12-10 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/macro.h: Macros "KERNAUX_CAST_(VAR|CONST)" have been added
|
||||
|
||||
2022-12-09 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/generic/display.h: The header has been added
|
||||
|
||||
2022-12-08 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/*.h: Definition "KERNAUX_BITFIELDS" has been added
|
||||
|
||||
2022-12-05 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
libkernaux 0.6.1 released
|
||||
libkernaux 0.7.0 released
|
||||
|
|
21
Makefile.am
21
Makefile.am
|
@ -6,11 +6,6 @@ EXTRA_DIST = autogen.sh CONTRIBUTING.md sha256sums.txt src/assert.h
|
|||
|
||||
SUBDIRS = include
|
||||
|
||||
if WITH_LIBC
|
||||
# FIXME: after "make clean" libc is not rebuiling
|
||||
SUBDIRS += libc
|
||||
endif
|
||||
|
||||
SUBDIRS += .
|
||||
|
||||
if ENABLE_FIXTURES
|
||||
|
@ -21,13 +16,15 @@ if ENABLE_CHECKS
|
|||
SUBDIRS += examples tests
|
||||
endif
|
||||
|
||||
libc/libc.la:
|
||||
$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/libc libc.la
|
||||
|
||||
AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE
|
||||
|
||||
lib_LTLIBRARIES = libkernaux.la
|
||||
|
||||
if ENABLE_PKG_CONFIG
|
||||
pkgconfigdir = @pkgconfdir@
|
||||
pkgconfig_DATA = libkernaux.pc
|
||||
endif
|
||||
|
||||
##################
|
||||
# Required files #
|
||||
##################
|
||||
|
@ -40,14 +37,6 @@ libkernaux_la_SOURCES = \
|
|||
src/generic/mutex.c \
|
||||
src/runtime.c
|
||||
|
||||
########
|
||||
# libc #
|
||||
########
|
||||
|
||||
if WITH_LIBC
|
||||
libkernaux_la_LIBADD += libc/libc.la
|
||||
endif
|
||||
|
||||
#######
|
||||
# ARCH #
|
||||
#######
|
||||
|
|
38
NEWS.md
38
NEWS.md
|
@ -3,6 +3,44 @@ Releases
|
|||
|
||||
|
||||
|
||||
0.7.0 (2022-12-23)
|
||||
------------------
|
||||
|
||||
169 files changed, 6332 insertions(+), 3858 deletions(-)
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* `./configure` - feature `--(enable|disable)-debug` has been removed.
|
||||
* `<kernaux/*>` - definition `KERNAUX_DEBUG` has been removed.
|
||||
* `<kernaux/assert.h>` - it has been removed.
|
||||
* `<kernaux/memmap.h>` - it has been completely rewritten.
|
||||
|
||||
### New features
|
||||
|
||||
* `./configure` - feature `--(enable|disable)-fixtures` has been added.
|
||||
* `./configure` - feature `--(enable|disable)-pkg-config[=PATH` has been added.
|
||||
It allows you to specify where to install **pkg-config** files.
|
||||
* `./configure` - package `--with[out]-multiboot2` has been added.
|
||||
* `<kernaux/*>` - definition `KERNAUX_BITFIELDS` has been added.
|
||||
* `<kernaux/generic/display.h>` - new header.
|
||||
* `<kernaux/macro.h>` - macro `KERNAUX_STATIC_TEST` has been added.
|
||||
* `<kernaux/macro.h>` - macros `KERNAUX_CAST_(VAR|CONST)` have been added.
|
||||
* `<kernaux/multiboot2.h>` - new header.
|
||||
* `<kernaux/runtime.h>` - new header. Now it contains the variable
|
||||
`kernaux_assert_cb`.
|
||||
|
||||
### Other changes
|
||||
|
||||
* `./configure` - a shared library is built by default.
|
||||
* `<kernaux/*>` - the headers are the same regardless of the selection
|
||||
of features and packages (except `<kernaux/version.h>`).
|
||||
* `examples/Makefile` - the test suite can be built now without **pthreads**.
|
||||
* `tests/Makefile` - the ability to run tests from with any working directory
|
||||
has been added.
|
||||
* `tests/Makefile` - the test suite has been fixed to run on FreeBSD.
|
||||
|
||||
|
||||
|
||||
0.6.1 (2022-12-05)
|
||||
------------------
|
||||
|
||||
|
|
32
README.md
32
README.md
|
@ -40,16 +40,16 @@ zero). Work-in-progress APIs can change at any time.
|
|||
|
||||
* Basic features
|
||||
* [Feature macros](/include/kernaux/version.h.in) (*work in progress*)
|
||||
* [Runtime environment](/include/kernaux/runtime.h) (*non-breaking since* **?.?.?**)
|
||||
* [Runtime environment](/include/kernaux/runtime.h) (*non-breaking since* **0.7.0**)
|
||||
* [Macros](/include/kernaux/macro.h) (*non-breaking since* **0.6.0**)
|
||||
* [Example: packing](/examples/macro_packing.c)
|
||||
* [Example: BITS](/examples/macro_bits.c)
|
||||
* [Example: CAST\_\*](/examples/macro_cast.c);
|
||||
* [Example: CONTAINER\_OF](/examples/macro_container_of.c)
|
||||
* [Example: BITS](/examples/macro_bits.c)
|
||||
* [Example: STATIC\_TEST\*](/examples/macro_static_test.c)
|
||||
* Stack trace *(planned)*
|
||||
* Generic types
|
||||
* [Display](/include/kernaux/generic/display.h) (*non-breaking since* **?.?.?**)
|
||||
* [Display](/include/kernaux/generic/display.h) (*non-breaking since* **0.7.0**)
|
||||
* [Example](/examples/generic_display.c)
|
||||
* [Memory allocator](/include/kernaux/generic/malloc.h) (*non-breaking since* **0.5.0**)
|
||||
* [Example](/examples/generic_malloc.c)
|
||||
|
@ -64,12 +64,12 @@ zero). Work-in-progress APIs can change at any time.
|
|||
* Data formats
|
||||
* [ELF](/include/kernaux/elf.h) (*work in progress*)
|
||||
* [MBR](/include/kernaux/mbr.h) (*work in progress*)
|
||||
* [Multiboot 2 (GRUB 2)](/include/kernaux/multiboot2.h.in) (*non-breaking since* **?.?.?**)
|
||||
* [Multiboot 2 (GRUB 2)](/include/kernaux/multiboot2.h.in) (*non-breaking since* **0.7.0**)
|
||||
* [Example: header macros](/examples/multiboot2_header_macro.c)
|
||||
* Utilities
|
||||
* [Measurement units utils](/include/kernaux/units.h) (*work in progress*)
|
||||
* [Example: To human](/examples/units_human.c)
|
||||
* [Memory map](/include/kernaux/memmap.h) (*non-breaking since* **?.?.?**)
|
||||
* [Memory map](/include/kernaux/memmap.h) (*non-breaking since* **0.7.0**)
|
||||
* [Example](/examples/memmap.c)
|
||||
* [printf format parser](/include/kernaux/printf_fmt.h) (*non-breaking since* **0.6.0**)
|
||||
* [Example](/examples/printf_fmt.c)
|
||||
|
@ -81,14 +81,6 @@ zero). Work-in-progress APIs can change at any time.
|
|||
* [Example: vfprintf](/examples/printf_file_va.c)
|
||||
* [Example: snprintf](/examples/printf_str.c)
|
||||
* [Example: vsnprintf](/examples/printf_str_va.c)
|
||||
* 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)
|
||||
* Architecture-specific code (*work in progress*)
|
||||
* [Declarations](/include/kernaux/arch/)
|
||||
* [Functions](/include/kernaux/asm/)
|
||||
|
@ -140,11 +132,8 @@ stable options.
|
|||
* `--enable-checks-python` - enable tests that require Python 3 with YAML and
|
||||
Jinja2
|
||||
* `--enable-fixtures` - enable fixtures for tests and bindings
|
||||
|
||||
#### Packages
|
||||
|
||||
* `--with-libc` - provides the replacement for some standard C functions.
|
||||
Useful in freestanding environment, where no libc is present.
|
||||
* `--enable-pkg-config[=PATH]` - install pkg-config files
|
||||
[PATH='${libdir}/pkgconfig']
|
||||
|
||||
### Default options
|
||||
|
||||
|
@ -209,6 +198,9 @@ You can test with `make check`.
|
|||
|
||||
Create configuration script with `./autogen.sh` (if present).
|
||||
|
||||
The library requires some functions from the standard C library.
|
||||
Use [libclayer](https://github.com/tailix/libclayer).
|
||||
|
||||
Let's assume that your target triplet is `i386-elf`. Configure with
|
||||
[cross-compiler](https://wiki.osdev.org/GCC_Cross-Compiler) in `$PATH` to make
|
||||
without it in `$PATH`:
|
||||
|
@ -218,8 +210,8 @@ without it in `$PATH`:
|
|||
--host='i386-elf' \
|
||||
--disable-shared \
|
||||
--enable-freestanding \
|
||||
--with-libc \
|
||||
CC="$(which i386-elf-gcc)"
|
||||
CC="$(which i386-elf-gcc)" \
|
||||
CFLAGS='-I<path/to/libc/headers>'
|
||||
```
|
||||
|
||||
The variables include `AR`, `AS`, `CC`, `CCAS`, `LD`, `NM`, `OBJDUMP`, `RANLIB`,
|
||||
|
|
|
@ -19,8 +19,8 @@ MRuby::Build.new do |conf|
|
|||
# ...
|
||||
conf.gem github: 'tailix/libkernaux',
|
||||
path: 'bindings/mruby',
|
||||
branch: 'v0.6.1',
|
||||
checksum_hash: 'dfaf233b1a03de29a04560902010c6a31e37140a'
|
||||
branch: 'v0.7.0',
|
||||
checksum_hash: '1cfff3fca3fc3f8990f43f0d6d5c91929c8f359c'
|
||||
# ...
|
||||
end
|
||||
```
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
MRuby::Gem::Specification.new 'mruby-kernaux' do |spec|
|
||||
spec.version = '0.6.1'
|
||||
spec.version = '0.7.0'
|
||||
spec.license = 'MIT'
|
||||
spec.homepage =
|
||||
'https://github.com/tailix/libkernaux/tree/master/bindings/ruby'
|
||||
|
|
|
@ -15,7 +15,7 @@ Install
|
|||
Add the following to your `Gemfile`:
|
||||
|
||||
```ruby
|
||||
gem 'kernaux', '~> 0.6.1'
|
||||
gem 'kernaux', '~> 0.7.0'
|
||||
```
|
||||
|
||||
Or add the following to your `*.gemspec`:
|
||||
|
@ -23,7 +23,7 @@ Or add the following to your `*.gemspec`:
|
|||
```ruby
|
||||
Gem::Specification.new do |spec|
|
||||
# ...
|
||||
spec.add_runtime_dependency 'kernaux', '~> 0.6.1'
|
||||
spec.add_runtime_dependency 'kernaux', '~> 0.7.0'
|
||||
# ...
|
||||
end
|
||||
```
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module KernAux
|
||||
# Gem version.
|
||||
VERSION = '0.6.1'
|
||||
VERSION = '0.7.0'
|
||||
|
||||
##
|
||||
# This module includes functions to determine if specific features are
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "kernaux-sys"
|
||||
version = "0.6.1"
|
||||
version = "0.7.0"
|
||||
authors = ["Alex Kotov <kotovalexarian@gmail.com>"]
|
||||
edition = "2021"
|
||||
description = "Unsafe no-std binding to libkernaux - auxiliary library for kernel development"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "kernaux"
|
||||
version = "0.6.1"
|
||||
version = "0.7.0"
|
||||
authors = ["Alex Kotov <kotovalexarian@gmail.com>"]
|
||||
edition = "2021"
|
||||
description = "Safe binding to libkernaux - auxiliary library for kernel development"
|
||||
|
@ -21,7 +21,7 @@ ntoa = ["kernaux-sys/ntoa"]
|
|||
ctor = "0.1.22"
|
||||
|
||||
[dependencies.kernaux-sys]
|
||||
version = "0.6.1"
|
||||
version = "0.7.0"
|
||||
default-features = false
|
||||
path = "../kernaux-sys"
|
||||
|
||||
|
|
35
configure.ac
35
configure.ac
|
@ -25,12 +25,11 @@ AC_CONFIG_HEADERS([config.h])
|
|||
AC_CONFIG_SRCDIR([src/runtime.c])
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
libkernaux.pc
|
||||
examples/Makefile
|
||||
fixtures/Makefile
|
||||
fixtures/multiboot2_bin_examples_gen.c
|
||||
include/Makefile
|
||||
libc/Makefile
|
||||
libc/include/Makefile
|
||||
include/kernaux/version.h
|
||||
tests/Makefile
|
||||
tests/test_multiboot2_header_print.c
|
||||
|
@ -39,6 +38,7 @@ AC_CONFIG_FILES([
|
|||
|
||||
AM_INIT_AUTOMAKE([1.16 subdir-objects])
|
||||
|
||||
AC_SUBST([PACKAGE_DESCR], ['Auxiliary library for kernel development'])
|
||||
AC_SUBST([PACKAGE_VERSION_SO], m4_normalize(m4_include([VERSION_SO])))
|
||||
|
||||
|
||||
|
@ -55,13 +55,15 @@ AC_ARG_ENABLE([werror], AS_HELP_STRING([--disable-werror], [dis
|
|||
dnl Features (disabled by default)
|
||||
AC_ARG_ENABLE([fixtures], AS_HELP_STRING([--enable-fixtures], [enable fixtures for tests and bindings]))
|
||||
AC_ARG_ENABLE([freestanding], AS_HELP_STRING([--enable-freestanding], [build for freestanding environment]))
|
||||
AC_ARG_ENABLE([split-libc], AS_HELP_STRING([--enable-split-libc], [split off libc]))
|
||||
AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks], [enable usual tests and examples]))
|
||||
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-pthreads], AS_HELP_STRING([--enable-checks-pthreads], [enable tests that require pthreads]))
|
||||
AC_ARG_ENABLE([checks-python], AS_HELP_STRING([--enable-checks-python], [enable tests that require Python 3 with YAML and Jinja2]))
|
||||
|
||||
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 (enabled by default)
|
||||
AC_ARG_WITH( [all], AS_HELP_STRING([--without-all], [without all default packages]))
|
||||
AC_ARG_WITH( [arch-all], AS_HELP_STRING([--without-arch-all], [without all architectures]))
|
||||
|
@ -81,9 +83,6 @@ AC_ARG_WITH( [printf], AS_HELP_STRING([--without-printf], [wit
|
|||
AC_ARG_WITH( [printf-fmt], AS_HELP_STRING([--without-printf-fmt], [without printf format parser]))
|
||||
AC_ARG_WITH( [units], AS_HELP_STRING([--without-units], [without measurement units utils]))
|
||||
|
||||
dnl Packages (disabled by default)
|
||||
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
|
||||
|
||||
|
||||
|
||||
################
|
||||
|
@ -141,13 +140,16 @@ AS_IF([test "$enable_werror" = no ], [enable_werror=no], [ena
|
|||
dnl Features (disabled by default)
|
||||
AS_IF([test "$enable_fixtures" = yes], [enable_fixtures=yes], [enable_fixtures=no])
|
||||
AS_IF([test "$enable_freestanding" = yes], [enable_freestanding=yes], [enable_freestanding=no])
|
||||
AS_IF([test "$enable_split_libc" = yes], [enable_split_libc=yes], [enable_split_libc=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_cppcheck" = yes], [enable_checks_cppcheck=yes], [enable_checks_cppcheck=no])
|
||||
AS_IF([test "$enable_checks_pthreads" = yes], [enable_checks_pthreads=yes], [enable_checks_pthreads=no])
|
||||
AS_IF([test "$enable_checks_python" = yes], [enable_checks_python=yes], [enable_checks_python=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 (enabled by default)
|
||||
AS_IF([test "$with_all" = no ], [with_all=no], [with_all=yes])
|
||||
AS_IF([test "$with_arch_all" = no ], [with_arch_all=no], [with_arch_all=yes])
|
||||
|
@ -167,9 +169,6 @@ AS_IF([test "$with_printf" = no ], [with_printf=no], [wit
|
|||
AS_IF([test "$with_printf_fmt" = no ], [with_printf_fmt=no], [with_printf_fmt=yes])
|
||||
AS_IF([test "$with_units" = no ], [with_units=no], [with_units=yes])
|
||||
|
||||
dnl Packages (disabled by default)
|
||||
AS_IF([test "$with_libc" = yes], [with_libc=yes], [with_libc=no])
|
||||
|
||||
|
||||
|
||||
#############
|
||||
|
@ -178,8 +177,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_fixtures" = yes -a "$enable_freestanding" = yes], AC_MSG_ERROR([can not build freestanding fixtures]))
|
||||
AS_IF([test "$enable_checks" = yes -a "$with_libc" = yes], AC_MSG_ERROR([can not use package `libc' with tests]))
|
||||
AS_IF([test "$enable_fixtures" = yes -a "$with_libc" = yes], AC_MSG_ERROR([can not use package `libc' with fixtures]))
|
||||
|
||||
AS_IF([test "$with_printf" = yes -a "$with_ntoa" = no], AC_MSG_ERROR([package `printf' requires package `ntoa']))
|
||||
AS_IF([test "$with_printf" = yes -a "$with_printf_fmt" = no], AC_MSG_ERROR([package `printf' requires package `printf-fmt']))
|
||||
|
@ -207,12 +204,14 @@ AM_CONDITIONAL([ENABLE_WERROR], [test "$enable_werror" = yes])
|
|||
dnl Features (disabled by default)
|
||||
AM_CONDITIONAL([ENABLE_FIXTURES], [test "$enable_fixtures" = yes])
|
||||
AM_CONDITIONAL([ENABLE_FREESTANDING], [test "$enable_freestanding" = yes])
|
||||
AM_CONDITIONAL([ENABLE_SPLIT_LIBC], [test "$enable_split_libc" = yes])
|
||||
AM_CONDITIONAL([ENABLE_CHECKS], [test "$enable_checks" = yes])
|
||||
AM_CONDITIONAL([ENABLE_CHECKS_CPPCHECK], [test "$enable_checks_cppcheck" = yes])
|
||||
AM_CONDITIONAL([ENABLE_CHECKS_PTHREADS], [test "$enable_checks_pthreads" = yes])
|
||||
AM_CONDITIONAL([ENABLE_CHECKS_PYTHON], [test "$enable_checks_python" = yes])
|
||||
|
||||
dnl Features (with parameter)
|
||||
AM_CONDITIONAL([ENABLE_PKG_CONFIG], [test ! -z "$enable_pkg_config"])
|
||||
|
||||
dnl Packages (enabled by default)
|
||||
AM_CONDITIONAL([WITH_ARCH_I386], [test "$with_arch_i386" = yes])
|
||||
AM_CONDITIONAL([WITH_ARCH_RISCV64], [test "$with_arch_riscv64" = yes])
|
||||
|
@ -230,9 +229,6 @@ AM_CONDITIONAL([WITH_PRINTF], [test "$with_printf" = yes])
|
|||
AM_CONDITIONAL([WITH_PRINTF_FMT], [test "$with_printf_fmt" = yes])
|
||||
AM_CONDITIONAL([WITH_UNITS], [test "$with_units" = yes])
|
||||
|
||||
dnl Packages (disabled by default)
|
||||
AM_CONDITIONAL([WITH_LIBC], [test "$with_libc" = yes])
|
||||
|
||||
dnl Packages (virtual)
|
||||
AM_CONDITIONAL([WITH_ARCH_X86], [test "$with_arch_i386" = yes -o "$with_arch_x86_64" = yes])
|
||||
|
||||
|
@ -257,7 +253,6 @@ AS_IF([test "$enable_float" = yes], [AC_DEFINE([ENABLE_FLOAT],
|
|||
AS_IF([test "$enable_werror" = yes], [AC_DEFINE([ENABLE_WERROR], [1], [enabled -Werror])])
|
||||
|
||||
dnl Features (disabled by default)
|
||||
AS_IF([test "$enable_split_libc" = yes], [AC_DEFINE([ENABLE_SPLIT_LIBC], [1], [split off libc])])
|
||||
AS_IF([test "$enable_fixtures" = yes], [AC_DEFINE([ENABLE_FIXTURES], [1], [enabled fixtures for tests and bindings])])
|
||||
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 and examples])])
|
||||
|
@ -282,9 +277,6 @@ AS_IF([test "$with_printf" = yes], [AC_DEFINE([WITH_PRINTF],
|
|||
AS_IF([test "$with_printf_fmt" = yes], [AC_DEFINE([WITH_PRINTF_FMT], [1], [with printf format parser])])
|
||||
AS_IF([test "$with_units", = yes], [AC_DEFINE([WITH_UNITS], [1], [with measurement units utils])])
|
||||
|
||||
dnl Packages (disabled by default)
|
||||
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with libc replacement])])
|
||||
|
||||
dnl Packages (virtual)
|
||||
AS_IF([test "$with_arch_i386" = yes], [AC_DEFINE([WITH_ARCH_X86], [1], [with architecture x86])])
|
||||
AS_IF([test "$with_arch_x86_64" = yes], [AC_DEFINE([WITH_ARCH_X86], [1], [with architecture x86])])
|
||||
|
@ -295,6 +287,9 @@ AS_IF([test "$with_arch_x86_64" = yes], [AC_DEFINE([WITH_ARCH_X86],
|
|||
# Autoconf substitutions #
|
||||
##########################
|
||||
|
||||
dnl Features (with parameter)
|
||||
AC_SUBST([pkgconfdir], [$enable_pkg_config])
|
||||
|
||||
dnl Packages (enabled by default)
|
||||
AS_IF([test "$with_arch_i386" = no], [AC_SUBST([comment_line_arch_i386], [//])])
|
||||
AS_IF([test "$with_arch_riscv64" = no], [AC_SUBST([comment_line_arch_riscv64], [//])])
|
||||
|
|
|
@ -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
|
|
@ -1,9 +0,0 @@
|
|||
nobase_include_HEADERS = \
|
||||
kernaux/libc.h \
|
||||
ctype.h \
|
||||
errno.h \
|
||||
inttypes.h \
|
||||
setjmp.h \
|
||||
stdlib.h \
|
||||
string.h \
|
||||
sys/types.h
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int isdigit(int c);
|
||||
int islower(int c);
|
||||
int isspace(int c);
|
||||
int isupper(int c);
|
||||
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef _ERRNO_H
|
||||
#define _ERRNO_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ERANGE 1
|
||||
|
||||
extern int errno;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef _INTTYPES_H
|
||||
#define _INTTYPES_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef KERNAUX_INCLUDED_LIBC
|
||||
#define KERNAUX_INCLUDED_LIBC
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct KernAux_Libc {
|
||||
void (*abort)() __attribute__((noreturn));
|
||||
void (*exit)(int status) __attribute__((noreturn));
|
||||
|
||||
void *(*calloc)(size_t nmemb, size_t size);
|
||||
void (*free)(void *ptr);
|
||||
void *(*malloc)(size_t size);
|
||||
void *(*realloc)(void *ptr, size_t size);
|
||||
};
|
||||
|
||||
extern struct KernAux_Libc kernaux_libc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// TODO: define in architecture-specific header
|
||||
typedef unsigned long __jmp_buf[sizeof(long) == 8 ? 8 : 6];
|
||||
|
||||
typedef struct __jmp_buf_tag {
|
||||
__jmp_buf __jb;
|
||||
unsigned long __fl;
|
||||
unsigned long __ss[128 / sizeof(long)];
|
||||
} jmp_buf[1];
|
||||
|
||||
__attribute__((returns_twice))
|
||||
int setjmp(jmp_buf env);
|
||||
|
||||
__attribute__((noreturn))
|
||||
void longjmp(jmp_buf env, int val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef _STDLIB_H
|
||||
#define _STDLIB_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
|
||||
int atoi(const char *str);
|
||||
|
||||
__attribute__((noreturn))
|
||||
void abort();
|
||||
__attribute__((noreturn))
|
||||
void exit(int status);
|
||||
|
||||
void *calloc(size_t nmemb, size_t size);
|
||||
void free(void *ptr);
|
||||
void *malloc(size_t size);
|
||||
void *realloc(void *ptr, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,37 +0,0 @@
|
|||
#ifndef _STRING_H
|
||||
#define _STRING_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// mem*
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
void *memchr(const void *s, int c, size_t n);
|
||||
void *memset(void *s, int c, size_t n);
|
||||
|
||||
// str*
|
||||
char *strcat(char *dest, const char *src);
|
||||
char *strchr(const char *s, int c);
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
size_t strlen(const char *s);
|
||||
|
||||
// strn*
|
||||
char *strncat(char *dest, const char *src, size_t n);
|
||||
int strncmp(const char *s1, const char *s2, size_t n);
|
||||
char *strncpy(char *dest, const char *src, size_t n);
|
||||
size_t strnlen(const char *s, size_t maxlen);
|
||||
|
||||
// str*
|
||||
char *strstr(const char *haystack, const char *needle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef _SYS_TYPES_H
|
||||
#define _SYS_TYPES_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* The code was taken from musl libc.
|
||||
*
|
||||
* Copyright (c) 2011 Rich Felker
|
||||
* Copyright (c) 2022 Alexander Monakov
|
||||
* Copyright (c) 2022 Alex Kotov
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
.global longjmp
|
||||
.type longjmp, @function
|
||||
longjmp:
|
||||
mov 4(%esp) , %edx
|
||||
mov 8(%esp) , %eax
|
||||
cmp $1 , %eax
|
||||
adc $0 , %al
|
||||
mov (%edx) , %ebx
|
||||
mov 4(%edx) , %esi
|
||||
mov 8(%edx) , %edi
|
||||
mov 12(%edx) , %ebp
|
||||
mov 16(%edx) , %esp
|
||||
jmp *20(%edx)
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* The code was taken from musl libc.
|
||||
*
|
||||
* Copyright (c) 2011-2015 Rich Felker
|
||||
* Copyright (c) 2022 Alex Kotov
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
.global setjmp
|
||||
.type setjmp, @function
|
||||
setjmp:
|
||||
mov 4(%esp) , %eax
|
||||
mov %ebx , (%eax)
|
||||
mov %esi , 4(%eax)
|
||||
mov %edi , 8(%eax)
|
||||
mov %ebp , 12(%eax)
|
||||
lea 4(%esp) , %ecx
|
||||
mov %ecx , 16(%eax)
|
||||
mov (%esp) , %ecx
|
||||
mov %ecx , 20(%eax)
|
||||
xor %eax , %eax
|
||||
ret
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* The code was taken from musl libc.
|
||||
*
|
||||
* Copyright (c) 2011 Nicholas J. Kain
|
||||
* Copyright (c) 2011-2012 Rich Felker
|
||||
* Copyright (c) 2022 Alexander Monakov
|
||||
* Copyright (c) 2022 Alex Kotov
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
.global longjmp
|
||||
.type longjmp, @function
|
||||
longjmp:
|
||||
xor %eax , %eax
|
||||
cmp $1 , %esi /* CF = val ? 0 : 1 */
|
||||
adc %esi , %eax /* eax = val + !val */
|
||||
mov (%rdi) , %rbx /* rdi is the jmp_buf, restore regs from it */
|
||||
mov 8(%rdi) , %rbp
|
||||
mov 16(%rdi) , %r12
|
||||
mov 24(%rdi) , %r13
|
||||
mov 32(%rdi) , %r14
|
||||
mov 40(%rdi) , %r15
|
||||
mov 48(%rdi) , %rsp
|
||||
jmp *56(%rdi) /* goto saved address without altering rsp */
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* The code was taken from musl libc.
|
||||
*
|
||||
* Copyright (c) 2011 Nicholas J. Kain
|
||||
* Copyright (c) 2011-2012 Rich Felker
|
||||
* Copyright (c) 2022 Alexander Monakov
|
||||
* Copyright (c) 2022 Alex Kotov
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
.global setjmp
|
||||
.type setjmp, @function
|
||||
setjmp:
|
||||
mov %rbx , (%rdi) /* rdi is jmp_buf, move registers onto it */
|
||||
mov %rbp , 8(%rdi)
|
||||
mov %r12 , 16(%rdi)
|
||||
mov %r13 , 24(%rdi)
|
||||
mov %r14 , 32(%rdi)
|
||||
mov %r15 , 40(%rdi)
|
||||
lea 8(%rsp) , %rdx /* this is our rsp WITHOUT current ret addr */
|
||||
mov %rdx , 48(%rdi)
|
||||
mov (%rsp) , %rdx /* save return addr ptr for new rip */
|
||||
mov %rdx , 56(%rdi)
|
||||
xor %eax , %eax /* always return 0 */
|
||||
ret
|
|
@ -1,35 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
int isdigit(const int c)
|
||||
{
|
||||
return (unsigned)c - '0' < 10;
|
||||
}
|
||||
|
||||
int islower(const int c)
|
||||
{
|
||||
return (unsigned)c - 'a' < 26;
|
||||
}
|
||||
|
||||
int isspace(const int c)
|
||||
{
|
||||
return c == ' ' || (unsigned)c - '\t' < 5;
|
||||
}
|
||||
|
||||
int isupper(const int c)
|
||||
{
|
||||
return (unsigned)c - 'A' < 26;
|
||||
}
|
||||
|
||||
int tolower(const int c)
|
||||
{
|
||||
return isupper(c) ? (c + ('a' - 'A')) : c;
|
||||
}
|
||||
|
||||
int toupper(const int c)
|
||||
{
|
||||
return islower(c) ? (c - ('a' - 'A')) : c;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
int errno = 0;
|
|
@ -1,17 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/libc.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct KernAux_Libc kernaux_libc = {
|
||||
.abort = NULL,
|
||||
.exit = NULL,
|
||||
|
||||
.calloc = NULL,
|
||||
.free = NULL,
|
||||
.malloc = NULL,
|
||||
.realloc = NULL,
|
||||
};
|
|
@ -1,70 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/libc.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void exit(const int status)
|
||||
{
|
||||
// Custom implementation
|
||||
kernaux_libc.exit(status);
|
||||
}
|
||||
|
||||
void abort()
|
||||
{
|
||||
// Custom implementation
|
||||
if (kernaux_libc.abort) kernaux_libc.abort();
|
||||
|
||||
// Default implementation
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void *calloc(const size_t nmemb, const size_t size)
|
||||
{
|
||||
// Custom implementation
|
||||
if (kernaux_libc.calloc) return kernaux_libc.calloc(nmemb, size);
|
||||
|
||||
// Default implementation
|
||||
const size_t total_size = nmemb * size;
|
||||
if (!total_size) return NULL;
|
||||
if (total_size / nmemb != size) return NULL;
|
||||
void *const ptr = malloc(total_size);
|
||||
if (ptr) memset(ptr, 0, total_size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void free(void *const ptr)
|
||||
{
|
||||
// Custom implementation
|
||||
kernaux_libc.free(ptr);
|
||||
}
|
||||
|
||||
void *malloc(const size_t size)
|
||||
{
|
||||
// Custom implementation
|
||||
return kernaux_libc.malloc(size);
|
||||
}
|
||||
|
||||
void *realloc(void *const ptr, const size_t size)
|
||||
{
|
||||
// Custom implementation
|
||||
return kernaux_libc.realloc(ptr, size);
|
||||
}
|
||||
|
||||
int atoi(const char *str)
|
||||
{
|
||||
while (isspace(*str)) ++str;
|
||||
bool is_negative = false;
|
||||
switch (*str) {
|
||||
case '-': is_negative = true; // fall through
|
||||
case '+': ++str;
|
||||
}
|
||||
int result = 0;
|
||||
while (isdigit(*str)) result = 10 * result - (*str++ - '0');
|
||||
return is_negative ? result : -result;
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
int memcmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
for (const unsigned char *p1 = s1, *p2 = s2; n--; ++p1, ++p2) {
|
||||
if (*p1 != *p2) return *p1 - *p2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
char *dest_cell = dest;
|
||||
char *src_cell = (char*)src;
|
||||
while (n--) *dest_cell++ = *src_cell++;
|
||||
return dest;
|
||||
}
|
||||
|
||||
void *memmove(void *dest, const void *src, size_t n)
|
||||
{
|
||||
char *dest_cell = dest;
|
||||
char *src_cell = (char*)src;
|
||||
if (dest_cell <= src_cell) {
|
||||
while (n--) *dest_cell++ = *src_cell++;
|
||||
} else {
|
||||
dest_cell += n;
|
||||
src_cell += n;
|
||||
while (n--) *--dest_cell = *--src_cell;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
void *memchr(const void *s, int c, size_t n)
|
||||
{
|
||||
for (const unsigned char *p = s; n--; ++p) {
|
||||
if ((unsigned char)c == *p) return (void*)p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *memset(void *s, int c, size_t n)
|
||||
{
|
||||
char *ss = s;
|
||||
while (n--) *ss++ = c;
|
||||
return s;
|
||||
}
|
||||
|
||||
char *strcat(char *dest, const char *src)
|
||||
{
|
||||
char *const dest_start = dest;
|
||||
while (*dest) ++dest;
|
||||
while ((*dest++ = *src++));
|
||||
return dest_start;
|
||||
}
|
||||
|
||||
char *strchr(const char *s, int c)
|
||||
{
|
||||
for (; *s != (char)c; ++s) if (*s == '\0') return NULL;
|
||||
return (char*)s;
|
||||
}
|
||||
|
||||
int strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
for (; *s1; ++s1, ++s2) if (*s1 != *s2) return *s1 < *s2 ? -1 : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *strcpy(char *dest, const char *src)
|
||||
{
|
||||
char *tmp = dest;
|
||||
while ((*dest++ = *src++) != '\0');
|
||||
return tmp;
|
||||
}
|
||||
|
||||
size_t strlen(const char *s)
|
||||
{
|
||||
const char *ss = s;
|
||||
while (*ss != '\0') ++ss;
|
||||
return ss - s;
|
||||
}
|
||||
|
||||
char *strncat(char *dest, const char *src, size_t n)
|
||||
{
|
||||
char *const dest_start = dest;
|
||||
if (n) {
|
||||
while (*dest) ++dest;
|
||||
while ((*dest++ = *src++)) {
|
||||
if (--n == 0) {
|
||||
*dest = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dest_start;
|
||||
}
|
||||
|
||||
int strncmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
for (; *s1 && n; ++s1, ++s2, --n) if (*s1 != *s2) return *s1 < *s2 ? -1 : 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *strncpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
char *tmp = dest;
|
||||
while (n-- && (*dest++ = *src++) != '\0');
|
||||
return tmp;
|
||||
}
|
||||
|
||||
size_t strnlen(const char *s, size_t maxlen)
|
||||
{
|
||||
const char *ss = s;
|
||||
while (*ss != '\0' && maxlen--) ++ss;
|
||||
return ss - s;
|
||||
}
|
||||
|
||||
char *strstr(const char *haystack, const char *needle)
|
||||
{
|
||||
const size_t needle_slen = strlen(needle);
|
||||
if (!needle_slen) return (char*)haystack;
|
||||
|
||||
size_t haystack_slen = strlen(haystack);
|
||||
while (haystack_slen >= needle_slen) {
|
||||
--haystack_slen;
|
||||
if (!memcmp(haystack, needle, needle_slen)) return (char*)haystack;
|
||||
++haystack;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: @PACKAGE_DESCR@
|
||||
URL: @PACKAGE_URL@
|
||||
Version: @PACKAGE_VERSION@
|
||||
Libs: -L${libdir} -lkernaux
|
||||
Cflags: -I${includedir}
|
|
@ -31,8 +31,6 @@ CPPCHECK_PATHS = \
|
|||
$(top_srcdir)/examples \
|
||||
$(top_builddir)/include \
|
||||
$(top_srcdir)/include \
|
||||
$(top_builddir)/libc \
|
||||
$(top_srcdir)/libc \
|
||||
$(top_builddir)/src \
|
||||
$(top_srcdir)/src \
|
||||
$(top_builddir)/tests \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PORTNAME= libkernaux
|
||||
DISTVERSION= 0.6.1
|
||||
DISTVERSION= 0.7.0
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= https://github.com/tailix/libkernaux/releases/download/v${DISTVERSION}/
|
||||
|
||||
|
@ -10,9 +10,10 @@ WWW= https://github.com/tailix/libkernaux
|
|||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/COPYING
|
||||
|
||||
USES= libtool
|
||||
USE_LDCONFIG= yes
|
||||
GNU_CONFIGURE= yes
|
||||
CONFIGURE_ARGS+= --enable-shared
|
||||
USES= libtool
|
||||
USE_LDCONFIG= yes
|
||||
GNU_CONFIGURE= yes
|
||||
|
||||
CONFIGURE_ARGS+= --enable-pkg-config=${PREFIX}/libdata/pkgconfig
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1671469243
|
||||
SHA256 (libkernaux-0.6.1.tar.gz) = 16fc83a36826cad527ec0a232032b7b131b5be0468ccff9163df12e3e3986b9f
|
||||
SIZE (libkernaux-0.6.1.tar.gz) = 486595
|
||||
TIMESTAMP = 1671787519
|
||||
SHA256 (libkernaux-0.7.0.tar.gz) = 19bbfe5d38731175fd762547fc169adffde6350cf30c9238f931909b26decd85
|
||||
SIZE (libkernaux-0.7.0.tar.gz) = 500752
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
include/kernaux.h
|
||||
include/kernaux/arch/i386-idt.h
|
||||
include/kernaux/arch/i386.h
|
||||
include/kernaux/arch/riscv64.h
|
||||
include/kernaux/arch/x86.h
|
||||
include/kernaux/arch/x86_64.h
|
||||
include/kernaux/assert.h
|
||||
include/kernaux/asm/i386.h
|
||||
include/kernaux/asm/riscv64.h
|
||||
include/kernaux/asm/x86.h
|
||||
include/kernaux/asm/x86_64.h
|
||||
include/kernaux/cmdline.h
|
||||
include/kernaux/elf.h
|
||||
include/kernaux/free_list.h
|
||||
include/kernaux/generic/display.h
|
||||
include/kernaux/generic/malloc.h
|
||||
include/kernaux/generic/mutex.h
|
||||
include/kernaux/macro.h
|
||||
|
@ -15,14 +20,24 @@ include/kernaux/macro/packing_start.run
|
|||
include/kernaux/mbr.h
|
||||
include/kernaux/memmap.h
|
||||
include/kernaux/multiboot2.h
|
||||
include/kernaux/multiboot2/header_enums.h
|
||||
include/kernaux/multiboot2/header_helpers.h
|
||||
include/kernaux/multiboot2/header_is_valid.h
|
||||
include/kernaux/multiboot2/header_macro.h
|
||||
include/kernaux/multiboot2/header_print.h
|
||||
include/kernaux/multiboot2/info_enums.h
|
||||
include/kernaux/multiboot2/info_helpers.h
|
||||
include/kernaux/multiboot2/info_is_valid.h
|
||||
include/kernaux/multiboot2/info_print.h
|
||||
include/kernaux/ntoa.h
|
||||
include/kernaux/pfa.h
|
||||
include/kernaux/printf.h
|
||||
include/kernaux/printf_fmt.h
|
||||
include/kernaux/runtime.h
|
||||
include/kernaux/units.h
|
||||
include/kernaux/version.h
|
||||
lib/libkernaux.a
|
||||
lib/libkernaux.so
|
||||
lib/libkernaux.so.0
|
||||
lib/libkernaux.so.0.0.0
|
||||
libdata/pkgconfig/libkernaux.pc
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
19bbfe5d38731175fd762547fc169adffde6350cf30c9238f931909b26decd85 libkernaux-0.7.0.tar.gz
|
||||
ab54d7ed92e37ac9ae4982e297c4dcc49f9ae18e1be59631d175a33596d6cfcc kernaux-0.7.0.crate
|
||||
15d41c87e270fa34a482df5cc243cdc87171ac513eb779f329fd4003d6df693a kernaux-sys-0.7.0.crate
|
||||
0f3f97ad8244cbe2a0cdb8f8092f4f20d704281d91f0b41955270808f66aead4 kernaux-0.7.0.gem
|
||||
#
|
||||
16fc83a36826cad527ec0a232032b7b131b5be0468ccff9163df12e3e3986b9f libkernaux-0.6.1.tar.gz
|
||||
e330f19d04d392e5c5979f3f4b88029b10ffe23fdf34f6d801947b20c8d0ba88 kernaux-0.6.1.crate
|
||||
f21520d8d84558408ea444f0029dfca871fd3622513537837f86a97fc3c60648 kernaux-sys-0.6.1.crate
|
||||
|
|
Loading…
Reference in New Issue