Skip to content

Commit

Permalink
Subcomponize musl (based on Alex work)
Browse files Browse the repository at this point in the history
Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: unikraft#3
  • Loading branch information
gaulthiergain authored and unikraft-bot committed Oct 13, 2021
1 parent 98d5880 commit 04c1904
Show file tree
Hide file tree
Showing 48 changed files with 2,920 additions and 1,771 deletions.
211 changes: 204 additions & 7 deletions Config.uk
Original file line number Diff line number Diff line change
@@ -1,9 +1,206 @@
# hidden
menuconfig LIBMUSL
bool "musl - A C standard library"
default n
select HAVE_LIBC
select LIBKUALLOC
select LIBSYSCALL_SHIM
select LIBVFSCORE
select LIBPOSIX_PROCESS
bool "musl: A C standard library"
default n
select HAVE_LIBC
select LIBKUALLOC
select LIBSYSCALL_SHIM
select LIBVFSCORE
select LIBPOSIX_PROCESS

select LIBMUSL_STAT
select LIBMUSL_DIRENT
select LIBMUSL_TERMIOS
select LIBMUSL_LOCALE
select LIBMUSL_ERRNO
select LIBMUSL_INTERNAL
select LIBMUSL_STRING
select LIBMUSL_CTYPE
select LIBMUSL_STDLIB
select LIBMUSL_ENV

if LIBMUSL

config LIBMUSL_AIO
bool "libaio"
default y

config LIBMUSL_COMPLEX
bool "libcomplex"
default y

config LIBMUSL_CONF
bool "libconf"
default y

config LIBMUSL_CRYPT
bool "libcrypt"
default y

config LIBMUSL_CTYPE
bool "libctype"
default y

config LIBMUSL_DIRENT
bool "libdirent"
default y

config LIBMUSL_ENV
bool "libenv"
default y

config LIBMUSL_ERRNO
bool "liberrno"
default y

config LIBMUSL_EXIT
bool "libexit"
default y

config LIBMUSL_FCNTL
bool "libfcntl"
default y

config LIBMUSL_FENV
bool "libfenv"
default y

config LIBMUSL_INTERNAL
bool "libinternal"
default y

config LIBMUSL_IPC
bool "libipc"
default y

config LIBMUSL_LDSO
bool "libldso"
default y

config LIBMUSL_LEGACY
bool "liblegacy"
default y

config LIBMUSL_LINUX
bool "liblinux"
default y

config LIBMUSL_LOCALE
bool "liblocale"
default y

config LIBMUSL_MALLOC
bool "libmalloc"
default y

config LIBMUSL_MATH
bool "libmath"
default y
select LIBMUSL_FENV

config LIBMUSL_MISC
bool "libmisc"
default y

config LIBMUSL_MMAN
bool "libmman"
default y

config LIBMUSL_MQ
bool "libmq"
default y

config LIBMUSL_MULTIBYTE
bool "libmultibyte"
default y

config LIBMUSL_NETWORK
bool "libnetwork"
default y

config LIBMUSL_PASSWD
bool "libpasswd"
default y

config LIBMUSL_PRNG
bool "libprng"
default y

config LIBMUSL_PROCESS
bool "libprocess"
default y
select LIBMUSL_THREAD

config LIBMUSL_REGEX
bool "libregex"
default y

config LIBMUSL_SCHED
bool "libsched"
default y

config LIBMUSL_SEARCH
bool "libsearch"
default y

config LIBMUSL_SELECT
bool "libselect"
default y

config LIBMUSL_SETJMP
bool "libsetjmp"
default y

config LIBMUSL_SIGNAL
bool "libsignal"
default y

config LIBMUSL_STAT
bool "libstat"
default y

config LIBMUSL_STDIO
bool "libstdio"
default y
select LIBMUSL_FENV
select LIBMUSL_UNISTD

config LIBMUSL_STDLIB
bool "libstdlib"
default y
select LIBMUSL_SIGNAL
select LIBMUSL_MULTIBYTE

config LIBMUSL_STRING
bool "libstring"
default y

config LIBMUSL_TEMP
bool "libtemp"
default y

config LIBMUSL_TERMIOS
bool "libtermios"
default y

config LIBMUSL_THREAD
bool "libthread"
default y
select LIBMUSL_SCHED
select LIBMUSL_MMAN

config LIBMUSL_FORCE_THREAD
bool
default y if LIBUKSCHED
default n
select LIBMUSL_THREAD

config LIBMUSL_TIME
bool "libtime"
default y

config LIBMUSL_UNISTD
bool "libunistd"
default y

endif
31 changes: 31 additions & 0 deletions Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Import a sub-library of musl
#
# @param $(1)
# The name of the sub-library within musl.
# @param $(2)
# The headers for this sub-library.
# @param $(3)
# The source files for this sub-library.
#
define _libmusl_import_lib
$(LIBMUSL_BUILD)/include/$(1):
$(call verbose_cmd,MKDIR,libmusl: $(subst $(LIBMUSL_BUILD),,$(1)): $(notdir $$@), mkdir -p $$@)

# Make a symbolic link of the original header file to a sub-library directory
$(LIBMUSL_BUILD)/include/$(1)/%.h:
$$(Q)mkdir -p $$(shell dirname $$@)
$(call verbose_cmd,HOSTLN,libmusl: $(1): $$(subst $(LIBMUSL_BUILD)/include/$(1)/,,$$@), \
ln -sf $$(subst $(LIBMUSL_BUILD)/include/$(1)/,$(LIBMUSL),$$@) $$@)

LIBMUSL_$(call uc,$(1))_INCLUDES-y += -I$(LIBMUSL_BUILD)/include/$(1)/include
LIBMUSL_$(call uc,$(1))_INCLUDES-y += -I$(LIBMUSL_BUILD)/include/$(1)/src/internal
LIBMUSL_$(call uc,$(1))_INCLUDES-y += -I$(LIBMUSL_BUILD)/include/$(1)/src/$(1)
LIBMUSL_SRCS-y += $(3)

CINCLUDES-y += $$(LIBMUSL_$(call uc,$(1))_INCLUDES-y)
CXXINCLUDES-y += $$(LIBMUSL_$(call uc,$(1))_INCLUDES-y)

# Append the sub library directory to the include path
$(LIBMUSL_BUILD)/.prepared: $(subst $(LIBMUSL),$(LIBMUSL_BUILD)/include/$(1),$(2))
endef
Loading

0 comments on commit 04c1904

Please sign in to comment.