From 3cb38d379d56246328e20f5cea96d7e3b3bf989a Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sun, 25 Dec 2022 14:14:39 +0400 Subject: [PATCH] Rename the library to libclayer --- .github/workflows/main.yml | 10 ++++---- .gitignore | 2 +- .openbsd.yml | 6 ++--- CONTRIBUTING.md | 15 +---------- Makefile.am | 16 ++++++------ README.md | 14 +++++------ configure.ac | 12 ++++----- include/Makefile.am | 2 +- include/{kernaux/libc.h => libclayer.h} | 8 +++--- libkernaux.pc.in => libclayer.pc.in | 2 +- pkgs/freebsd/.gitignore | 1 - pkgs/freebsd/devel/libkernaux/Makefile | 19 -------------- pkgs/freebsd/devel/libkernaux/distinfo | 3 --- pkgs/freebsd/devel/libkernaux/pkg-descr | 3 --- pkgs/freebsd/devel/libkernaux/pkg-plist | 5 ---- sha256sums.txt | 33 ------------------------- src/{kernaux.c => libclayer.c} | 4 +-- src/stdlib.c | 14 +++++------ 18 files changed, 44 insertions(+), 125 deletions(-) rename include/{kernaux/libc.h => libclayer.h} (74%) rename libkernaux.pc.in => libclayer.pc.in (87%) delete mode 100644 pkgs/freebsd/.gitignore delete mode 100644 pkgs/freebsd/devel/libkernaux/Makefile delete mode 100644 pkgs/freebsd/devel/libkernaux/distinfo delete mode 100644 pkgs/freebsd/devel/libkernaux/pkg-descr delete mode 100644 pkgs/freebsd/devel/libkernaux/pkg-plist rename src/{kernaux.c => libclayer.c} (75%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 00e9c9a..d19bda2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -129,12 +129,12 @@ jobs: - name: dist run: make dist - name: extract - run: tar -xzf "libkernaux-$(cat VERSION).tar.gz" + run: tar -xzf "libclayer-$(cat VERSION).tar.gz" - name: configure - run: cd "libkernaux-$(cat VERSION)" && ./configure --enable-checks + run: cd "libclayer-$(cat VERSION)" && ./configure --enable-checks - name: make - run: cd "libkernaux-$(cat VERSION)" && make + run: cd "libclayer-$(cat VERSION)" && make - name: check - run: cd "libkernaux-$(cat VERSION)" && make check || (./make/test-suite-log && false) + run: cd "libclayer-$(cat VERSION)" && make check || (./make/test-suite-log && false) - name: install - run: cd "libkernaux-$(cat VERSION)" && sudo make install + run: cd "libclayer-$(cat VERSION)" && sudo make install diff --git a/.gitignore b/.gitignore index fd9ead8..a35472b 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,4 @@ /include/Makefile /tests/Makefile -/libkernaux.pc +/libclayer.pc diff --git a/.openbsd.yml b/.openbsd.yml index 8442820..4c0635a 100644 --- a/.openbsd.yml +++ b/.openbsd.yml @@ -4,7 +4,7 @@ image: openbsd/7.2 arch: amd64 sources: - - https://github.com/tailix/libkernaux.git + - https://github.com/tailix/libclayer.git packages: - autoconf-2.71 - automake-1.16.5 @@ -23,11 +23,11 @@ tasks: make doas make install - build: | - cd libkernaux + cd libclayer ./autogen.sh ./configure --enable-checks-all CFLAGS='-O3' make doas make install - test: | - cd libkernaux + cd libclayer make check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8857098..0f03c94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ 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), +* If you change the behavior (even just fix a bug) of **libclayer** (stable), add a record to [ChangeLog](/ChangeLog). Prohibitions: @@ -88,19 +88,6 @@ Use **cppcheck**. and with the prefix of the type name in Pascal case (example: `FooBar_car_cdr`). -* Name public (*defined in the headers and exported as symbols*) regular - functions (*not methods*) and variables with the prefix `kernaux_` (example: - `kernaux_foo_bar`). -* Name public (*defined in the headers*) macros with the prefix `KERNAUX_` - (example: `KERNAUX_FOO_BAR`). -* Name public (*defined in the headers*) types with the prefix `KernAux_` - (example: `KernAux_FooBar`). -* Name public (*defined in the headers*) with the prefix `KernAux_` and with the - prefix of the surrounding type, separate type names with underscore (example: - `KernAux_FooBar_CarCdr`). -* Name public (*defined in the headers*) methods with the prefix `KernAux_` and - with the prefix of the type name (example: `KernAux_FooBar_car_cdr`). - * Use postfix `size` for a byte size. * Use postfix `slen` for C string length without terminating `\0` character (size - 1). diff --git a/Makefile.am b/Makefile.am index d338a6a..ba6f7d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,36 +10,34 @@ if ENABLE_CHECKS SUBDIRS += tests endif -AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE - -lib_LTLIBRARIES = libkernaux.la +lib_LTLIBRARIES = libclayer.la if ENABLE_PKG_CONFIG pkgconfigdir = @pkgconfdir@ -pkgconfig_DATA = libkernaux.pc +pkgconfig_DATA = libclayer.pc endif ################## # Required files # ################## -libkernaux_la_LDFLAGS = -version-info @PACKAGE_VERSION_SO@ +libclayer_la_LDFLAGS = -version-info @PACKAGE_VERSION_SO@ -libkernaux_la_SOURCES = \ +libclayer_la_SOURCES = \ src/ctype.c \ src/errno.c \ - src/kernaux.c \ + src/clayer.c \ src/stdlib.c \ src/string.c if ASM_I386 -libkernaux_la_SOURCES += \ +libclayer_la_SOURCES += \ src/asm/i386/longjmp.S \ src/asm/i386/setjmp.S endif if ASM_X86_64 -libkernaux_la_SOURCES += \ +libclayer_la_SOURCES += \ src/asm/x86_64/longjmp.S \ src/asm/x86_64/setjmp.S endif diff --git a/README.md b/README.md index 49e79de..52b6779 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,17 @@ -libkernaux -========== +libclayer +========= -[![Build status](https://github.com/tailix/libkernaux/actions/workflows/main.yml/badge.svg)](https://github.com/tailix/libkernaux/actions/workflows/main.yml) -[![Build status (FreeBSD)](https://api.cirrus-ci.com/github/tailix/libkernaux.svg?task=Main%20(FreeBSD))](https://cirrus-ci.com/github/tailix/libkernaux) +[![Build status](https://github.com/tailix/libclayer/actions/workflows/main.yml/badge.svg)](https://github.com/tailix/libclayer/actions/workflows/main.yml) +[![Build status (FreeBSD)](https://api.cirrus-ci.com/github/tailix/libclayer.svg?task=Main%20(FreeBSD))](https://cirrus-ci.com/github/tailix/libclayer) -Auxiliary library for kernel development. - -[Topic on OSDev.org forum](https://forum.osdev.org/viewtopic.php?f=1&t=37958). +libc for both hosted and freestanding environments. Table of contents ----------------- -* [Overview](#libkernaux) +* [Overview](#libclayer) * [Table of contents](#table-of-contents) * [API](#api) * [Headers](#headers) diff --git a/configure.ac b/configure.ac index 0764a57..2f7c3fb 100644 --- a/configure.ac +++ b/configure.ac @@ -11,11 +11,11 @@ LT_PREREQ([2.4.6]) # Initialize Autoconf & Automake # ################################## -AC_INIT([libkernaux], +AC_INIT([libclayer], m4_normalize(m4_include([VERSION])), - [https://github.com/tailix/libkernaux/issues], - [libkernaux], - [https://github.com/tailix/libkernaux]) + [https://github.com/tailix/libclayer/issues], + [libclayer], + [https://github.com/tailix/libclayer]) AC_CANONICAL_BUILD AC_CANONICAL_HOST @@ -25,14 +25,14 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR([src/xxxxx.c]) AC_CONFIG_FILES([ Makefile - libkernaux.pc + libclayer.pc include/Makefile tests/Makefile ]) AM_INIT_AUTOMAKE([1.16 subdir-objects]) -AC_SUBST([PACKAGE_DESCR], ['Auxiliary library for kernel development']) +AC_SUBST([PACKAGE_DESCR], ['libc for both hosted and freestanding environments']) AC_SUBST([PACKAGE_VERSION_SO], m4_normalize(m4_include([VERSION_SO]))) diff --git a/include/Makefile.am b/include/Makefile.am index 4a748cc..172988f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,8 +1,8 @@ nobase_include_HEADERS = \ - kernaux/libc.h \ ctype.h \ errno.h \ inttypes.h \ + libclayer.h \ setjmp.h \ stdlib.h \ string.h \ diff --git a/include/kernaux/libc.h b/include/libclayer.h similarity index 74% rename from include/kernaux/libc.h rename to include/libclayer.h index 46ceb92..e6416bf 100644 --- a/include/kernaux/libc.h +++ b/include/libclayer.h @@ -1,5 +1,5 @@ -#ifndef KERNAUX_INCLUDED_LIBC -#define KERNAUX_INCLUDED_LIBC +#ifndef _LIBCLAYER_H +#define _LIBCLAYER_H 1 #ifdef __cplusplus extern "C" { @@ -7,7 +7,7 @@ extern "C" { #include -struct KernAux_Libc { +struct Libclayer { void (*abort)() __attribute__((noreturn)); void (*exit)(int status) __attribute__((noreturn)); @@ -17,7 +17,7 @@ struct KernAux_Libc { void *(*realloc)(void *ptr, size_t size); }; -extern struct KernAux_Libc kernaux_libc; +extern struct Libclayer libclayer; #ifdef __cplusplus } diff --git a/libkernaux.pc.in b/libclayer.pc.in similarity index 87% rename from libkernaux.pc.in rename to libclayer.pc.in index 6caa194..09df636 100644 --- a/libkernaux.pc.in +++ b/libclayer.pc.in @@ -7,5 +7,5 @@ Name: @PACKAGE_NAME@ Description: @PACKAGE_DESCR@ URL: @PACKAGE_URL@ Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lkernaux +Libs: -L${libdir} -lclayer Cflags: -I${includedir} diff --git a/pkgs/freebsd/.gitignore b/pkgs/freebsd/.gitignore deleted file mode 100644 index caefc69..0000000 --- a/pkgs/freebsd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/devel/libkernaux/work/ diff --git a/pkgs/freebsd/devel/libkernaux/Makefile b/pkgs/freebsd/devel/libkernaux/Makefile deleted file mode 100644 index c59edfb..0000000 --- a/pkgs/freebsd/devel/libkernaux/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -PORTNAME= libkernaux -DISTVERSION= 0.7.0 -CATEGORIES= devel -MASTER_SITES= https://github.com/tailix/libkernaux/releases/download/v${DISTVERSION}/ - -MAINTAINER= kotovalexarian@gmail.com -COMMENT= Auxiliary library for kernel development -WWW= https://github.com/tailix/libkernaux - -LICENSE= MIT -LICENSE_FILE= ${WRKSRC}/COPYING - -USES= libtool -USE_LDCONFIG= yes -GNU_CONFIGURE= yes - -CONFIGURE_ARGS+= --enable-pkg-config=${PREFIX}/libdata/pkgconfig - -.include diff --git a/pkgs/freebsd/devel/libkernaux/distinfo b/pkgs/freebsd/devel/libkernaux/distinfo deleted file mode 100644 index ab6e09f..0000000 --- a/pkgs/freebsd/devel/libkernaux/distinfo +++ /dev/null @@ -1,3 +0,0 @@ -TIMESTAMP = 1671787519 -SHA256 (libkernaux-0.7.0.tar.gz) = 19bbfe5d38731175fd762547fc169adffde6350cf30c9238f931909b26decd85 -SIZE (libkernaux-0.7.0.tar.gz) = 500752 diff --git a/pkgs/freebsd/devel/libkernaux/pkg-descr b/pkgs/freebsd/devel/libkernaux/pkg-descr deleted file mode 100644 index 01173d6..0000000 --- a/pkgs/freebsd/devel/libkernaux/pkg-descr +++ /dev/null @@ -1,3 +0,0 @@ -Auxiliary library for kernel development. - -It's in the early stage of the development so there is no detailed description. diff --git a/pkgs/freebsd/devel/libkernaux/pkg-plist b/pkgs/freebsd/devel/libkernaux/pkg-plist deleted file mode 100644 index 4851932..0000000 --- a/pkgs/freebsd/devel/libkernaux/pkg-plist +++ /dev/null @@ -1,5 +0,0 @@ -lib/libkernaux.a -lib/libkernaux.so -lib/libkernaux.so.0 -lib/libkernaux.so.0.0.0 -libdata/pkgconfig/libkernaux.pc diff --git a/sha256sums.txt b/sha256sums.txt index 466d17f..e69de29 100644 --- a/sha256sums.txt +++ b/sha256sums.txt @@ -1,33 +0,0 @@ -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 -bfa7c9412830917526a563ac6a4402a579e5dba1a51666430069b8c9b5b8b428 kernaux-0.6.1.gem -# -6f32427f7cffdf11c0a11c26605b93e4bc2bdc6b02dd308d75d1e4aed88c6055 libkernaux-0.6.0.tar.gz -2734241f544ae5f5cceb72e9b61ac01b84013e6455c4adb4c0a74c4ac68f477c kernaux-0.6.0.crate -4cd9e098209d1f81cf9efeb334d8b5b9814d875e3ca7ea2e83741acf40d21477 kernaux-sys-0.6.0.crate -56b78efbb4714719c151c6b63dc708db28a5eed8c6ea60e7f96f8c9f355c65ef kernaux-0.6.0.gem -# -e18d88baa68295e57a05348f059bed105b14d6c6b52904db8c04c84cd70629ee libkernaux-0.5.0.tar.gz -c0bc0ed3c396893797912356366068ad04054ade23e293bbf61c72975165a3fc kernaux-0.5.0.crate -986b2f1b0befb8e1e1a6f97e67a64ab52974524eaa3f3948deef2dff28be946a kernaux-sys-0.5.0.crate -da5fbc5ad8d0d1f3c7a9c8627b59bb9c670893eed800f7b2190c81767f8bb70f kernaux-0.5.0.gem -# -893292882e0b658d92e104dc0d2974d61daca60efdf9fdf80996c3db54b0cab2 libkernaux-0.4.0.tar.gz -eb27d72d658f87638998cdb0056018edd49cc8f1144e23a1e00f7921a6bbd5b2 kernaux-0.4.0.crate -ee0d63d1f86113f3f652427b908da27fda7be496b5bdbba9947977891b2e50ef kernaux-sys-0.4.0.crate -2c765894b10830abc5945b003d465515fb28b964f1e2f7cdd5594bbf1cdbce97 kernaux-0.4.0.gem -# -6887939c01b65a4e864d47f103a06a6ad1639f4bffaa5582c95252c4646c8d2a libkernaux-0.3.0.tar.gz -564e5a58a854dd6b2b4e212ebac9c76a099971a2fa95324916de07b67f46934c kernaux-0.3.0.crate -1fddd0383dcce818273f305fffd0c7153d3772fcaf78dae38c30dae4f0960a25 kernaux-sys-0.3.0.crate -986b84827466d4ba7244c2e3ba41502a7984156346613af545946423f913d520 kernaux-0.3.0.gem -# -# Yanked: -00b22e28ecddde5beca8b7d425d91eaf3634ee1d9df0bcf9565938d02353cd49 libkernaux-0.2.0.tar.gz -b80c1d94519a43bd92c2b1a7626bdb5af5aa98dd993b2332d56449b0be7dbc8f libkernaux-0.1.0.tar.gz diff --git a/src/kernaux.c b/src/libclayer.c similarity index 75% rename from src/kernaux.c rename to src/libclayer.c index 688c769..ae5aebc 100644 --- a/src/kernaux.c +++ b/src/libclayer.c @@ -2,11 +2,11 @@ #include "config.h" #endif -#include +#include #include -struct KernAux_Libc kernaux_libc = { +struct Libclayer libclayer = { .abort = NULL, .exit = NULL, diff --git a/src/stdlib.c b/src/stdlib.c index 5d6a9ca..75af43f 100644 --- a/src/stdlib.c +++ b/src/stdlib.c @@ -2,7 +2,7 @@ #include "config.h" #endif -#include +#include #include #include @@ -12,13 +12,13 @@ void exit(const int status) { // Custom implementation - kernaux_libc.exit(status); + libclayer.exit(status); } void abort() { // Custom implementation - if (kernaux_libc.abort) kernaux_libc.abort(); + if (libclayer.abort) libclayer.abort(); // Default implementation exit(EXIT_FAILURE); @@ -27,7 +27,7 @@ void abort() void *calloc(const size_t nmemb, const size_t size) { // Custom implementation - if (kernaux_libc.calloc) return kernaux_libc.calloc(nmemb, size); + if (libclayer.calloc) return libclayer.calloc(nmemb, size); // Default implementation const size_t total_size = nmemb * size; @@ -41,19 +41,19 @@ void *calloc(const size_t nmemb, const size_t size) void free(void *const ptr) { // Custom implementation - kernaux_libc.free(ptr); + libclayer.free(ptr); } void *malloc(const size_t size) { // Custom implementation - return kernaux_libc.malloc(size); + return libclayer.malloc(size); } void *realloc(void *const ptr, const size_t size) { // Custom implementation - return kernaux_libc.realloc(ptr, size); + return libclayer.realloc(ptr, size); } int atoi(const char *str)