Improve build variant support

This commit is contained in:
Ehmry - 2019-06-29 11:45:36 +02:00
parent b6422c3dcc
commit d1eead8de2
28 changed files with 93 additions and 127 deletions

View File

@ -1,3 +1,5 @@
.gitignore
GENODE_DIR = $(TUP_CWD)
export NIX_PATH
@ -18,30 +20,6 @@ INCLUDES_LIBPORTS += -I$(GENODE_DIR)/repos/libports/include
LIB_DIR = $(GENODE_DIR)/lib
STUB_DIR = $(GENODE_DIR)/stub
LIBGCC = `$(CC) $(CC_MARCH) -print-libgcc-file-name`
!prg = | $(GENODE_DIR)/<stub> $(GENODE_DIR)/<pkg-config> \
|> ^o LD %o^ \
$(LD) $(LD_MARCH) $(LDFLAGS) \
-L$(STUB_DIR) \
`$(PKG_CONFIG) --libs $(LIBS) genode-prg` \
%f \
$(LIBGCC) \
-o %o \
|>
!lib = | $(GENODE_DIR)/<stub> $(GENODE_DIR)/<pkg-config> |> ^o LD %o^ $(LD) $(LD_MARCH) %f $(LDFLAGS) `$(PKG_CONFIG) --libs genode-lib $(LIBS)` -L$(STUB_DIR) -o %o |>
ifeq (@(TUP_ARCH),i386)
CC_MARCH = -march=i686 -m32
LD_MARCH = -melf_i386
endif
ifeq (@(TUP_ARCH),x86_64)
CC_MARCH = -m64 -mcmodel=large
LD_MARCH = -melf_x86_64
endif
BASE_DIR = $(GENODE_DIR)/repos/base
&BASE_DIR = repos/base
&BASE_INCLUDES = repos/base/headers.tup
@ -61,6 +39,7 @@ export LD_DIR
export TOOLCHAIN_DIR
SED_PKGCONFIG_FLAGS += -e "s|@LD_DIR@|$LD_DIR|"
SED_PKGCONFIG_FLAGS += -e "s|@TOOLCHAIN_DIR@|$TOOLCHAIN_DIR|"
SED_FLAGS += -e "s|@version@|`git describe --always`|"
!sed_pkgconfig_file = |> ^ SED %B^ \
sed $(SED_PKGCONFIG_FLAGS) $(SED_FLAGS) < %f > %o \

@ -1 +1 @@
Subproject commit e56077da32d4f8ed19964f20b1a7ff2adca451da
Subproject commit ad0c2bc8779eab6051697550e8bf323c4539180e

View File

@ -1,3 +1,5 @@
ifeq (@(BUILD_NOVA),y)
include_rules
GEN_CORE_DIR = $(BASE_DIR)/src/core
@ -47,3 +49,5 @@ CXXFLAGS_$(GEN_CORE_DIR)/version.cc += -DGENODE_VERSION=\"`git describe`\"
CORE_OBJ = core-nova.o
include $(BASE_DIR)/src/core/target.tup
endif

View File

@ -1,3 +1,5 @@
ifeq (@(BUILD_NOVA),y)
include_rules
INCLUDES += -I$(BASE_DIR)/src/include
@ -38,3 +40,5 @@ SRC_CC += \
: foreach $(SRC_CC) |> !cxx |> {base-obj}
: {base-obj} |> !ar |> base-nova.lib.a
endif

View File

@ -1,3 +1,5 @@
ifeq (@(BUILD_NOVA),y)
TARGET_NAME = base-nova
include_rules
INCLUDES += -I$(BASE_DIR)/src/include
@ -58,3 +60,5 @@ BASE_LIBS += \
: {bin} |> !collect_bin |>
include &(BIN_RULES)
endif

View File

@ -1,7 +1,9 @@
include_rules
SED_FLAGS += -e "s|@includedir@|`nix-store --add $(REP_DIR)/include`|"
SED_FLAGS += -e "s|@toolchainincludedir@|`$(CC) -print-file-name=include`|"
SED_FLAGS += -e "s|@lddir@|`nix-store --add $(REP_DIR)/src/ld`|"
SED_FLAGS += -e "s|@toolchainincludedir@|`$(CC) $(CC_MARCH) -print-file-name=include`|"
SED_FLAGS += -e "s|@libgcc@|`$(CC) $(CC_MARCH) -print-file-name=libgcc.a`|"
SED_FLAGS += -e "s|@cc@|$(CC)|"
SED_FLAGS += -e "s|@cxx@|$(CXX)|"
@ -9,12 +11,6 @@ SED_FLAGS += -e "s|@ld@|$(LD)|"
SED_FLAGS += -e "s|@ar@|$(AR)|"
SED_FLAGS += -e "s|@ranlib@|$(RANLIB)|"
SED_FLAGS += -e "s|@version@|`git describe --always`|"
ifeq (@(TUP_ARCH),arm64)
SED_FLAGS += -e 's|@spec_includes@| -I${includedir}/spec/arm_64 -I${includedir}/spec/64bit|'
endif
ifeq (@(TUP_ARCH),i386)
SED_FLAGS += -e 's|@spec_includes@|-I${includedir}/spec/x86_32 -I${includedir}/spec/x86 -I${includedir}/spec/32bit|'
endif
@ -23,4 +19,8 @@ ifeq (@(TUP_ARCH),x86_64)
SED_FLAGS += -e 's|@spec_includes@|-I${includedir}/spec/x86_64 -I${includedir}/spec/x86 -I${includedir}/spec/64bit|'
endif
ifeq (@(TUP_ARCH),arm_v8)
SED_FLAGS += -e 's|@spec_includes@| -I${includedir}/spec/arm_64 -I${includedir}/spec/64bit|'
endif
: foreach *.pc.in |> !sed_pkgconfig_file |>

View File

@ -1,8 +1,4 @@
lddir=@LD_DIR@
toolchaindir=@TOOLCHAIN_DIR@
Name: genode-lib
Description: Flags for linking Genode libraries
Version: @version@
Requires: base
Libs: -shared --eh-frame-hdr -melf_x86_64 -gc-sections -z max-page-size=0x1000 -T ${lddir}/genode_rel.ld --entry=0x0 -l:ldso-startup.lib.a ${toolchaindir}/lib/gcc/x86_64-pc-elf/8.3.0/64/libgcc.a
Libs: -shared --eh-frame-hdr -gc-sections -z max-page-size=0x1000 -T@lddir@/genode_rel.ld --entry=0x0 -l:ldso-startup.lib.a @libgcc@

View File

@ -1,9 +1,7 @@
lddir=@LD_DIR@
toolchaindir=@TOOLCHAIN_DIR@
ld=${toolchaindir}/bin/genode-x86-ld
lddir=@lddir@
Name: genode-prg
Description: Flags for dynamically-linked Genode programs
URL: https://genode.org/
Version: @SDK_VERSION@
Libs: -melf_x86_64 -gc-sections -z max-page-size=0x1000 --dynamic-list=${lddir}/genode_dyn.dl -nostdlib -Ttext=0x01000000 --dynamic-linker=ld.lib.so --eh-frame-hdr -rpath-link=. -T ${lddir}/genode_dyn.ld -l:ld.lib.so ${toolchaindir}/lib/gcc/x86_64-pc-elf/8.3.0/64/libgcc.a
Version: @version@
Libs: -gc-sections -z max-page-size=0x1000 --dynamic-list=${lddir}/genode_dyn.dl -nostdlib -Ttext=0x01000000 --dynamic-linker=ld.lib.so --eh-frame-hdr -rpath-link=. -T${lddir}/genode_dyn.ld -l:ld.lib.so @libgcc@

View File

@ -10,4 +10,9 @@ INCLUDES += -I$(BASE_DIR)/include/spec/x86
INCLUDES += -I$(BASE_DIR)/include/spec/64bit
endif
ifeq (@(TUP_ARCH),arm_v8)
INCLUDES += -I$(BASE_DIR)/include/spec/arm_64
INCLUDES += -I$(BASE_DIR)/include/spec/64bit
endif
INCLUDES += -I$(BASE_DIR)/include

View File

@ -1,8 +0,0 @@
include_rules
ifeq (@(TUP_ARCH),x86_64)
SED_FLAGS += -e 's|@TOOL_PREFIX@|genode-x86-|'
SED_FLAGS += -e 's|@SPEC_INCLUDES@|-I${includedir}/spec/x86_64 -I${includedir}/spec/x86 -I${includedir}/spec/64bit|'
endif
: foreach *.pc.in |> !sed_pkgconfig_file |>

View File

@ -2,8 +2,14 @@ include_rules
: foreach *.cc |> !cxx |> {obj}
ifeq (@(TUP_ARCH),i386)
: foreach spec/x86_32/*.s |> !asm |> {obj}
endif
ifeq (@(TUP_ARCH),x86_64)
: foreach spec/x86_64/*.s |> !asm |> {obj}
endif
ifeq (@(TUP_ARCH),arm_v8)
: foreach spec/arm_64/*.s |> !asm |> {obj}
endif
: {obj} |> !ar |> startup.lib.a $(BASE_DIR)/<base-libs>

View File

@ -1,6 +1,5 @@
include_rules
SED_FLAGS += -e "s|@includedir@|`nix-store --add $(REP_DIR)/include`|"
SED_FLAGS += -e "s|@version@|`git describe --always`|"
: *.pc.in |> !sed_pkgconfig_file |>

View File

@ -1,4 +1,3 @@
include_rules
SED_FLAGS += -e "s|@includedir@|`nix-store --add include`|"
SED_FLAGS += -e "s|@version@|`git describe --always`|"
: *.pc.in |> !sed_pkgconfig_file |>

View File

@ -0,0 +1,20 @@
{ preparePort, fetchFromGitHub }:
preparePort {
name = "egl";
outputs = [ "include" ];
src = fetchFromGitHub {
name = "EGL";
owner = "KhronosGroup";
repo = "EGL-Registry";
rev = "d738c39fe25bab9f65bed2cb78c4db253bd473c4";
sha256 = "1bb2pgv516i1p8x3171yj3gqkxqxqwg7q42ak627md4x3irmqf2q";
};
installPhase = ''
mkdir -p $include
cp -r api/1.? api/EGL api/KHR $include
cp ${../include/EGL/eglplatform.h} $include/EGL/eglplatform.h
'';
}

View File

@ -0,0 +1,4 @@
include_rules
SED_FLAGS += -e "s|@includedir@|`readlink result-include`|"
: |> nix-build $(REP_DIR)/ports -A egl_api |> result-include
: egl_api.pc.in | result-include |> !sed_pkgconfig_file |>

View File

@ -1,5 +1,6 @@
includedir=@includedir@/egl_api
includedir=@includedir@
Name: EGL
Description: EGL API headers
Version: @version@
Cflags: -I${includedir}

View File

@ -1,50 +0,0 @@
contrib
lib
libc-include
libc-source
sys
##### TUP GITIGNORE #####
##### Lines below automatically generated by Tup.
##### Do not edit.
/.gitignore
/atexit.o
/dummies.o
/dynamic_linker.o
/environ.o
/errno.o
/exit.o
/fd_alloc.o
/file_operations.o
/gai_strerror.o
/getpwent.o
/getrandom.o
/issetugid.o
/lib
/libc-include
/libc-source
/libc_mem_alloc.o
/malloc.o
/nolocale.o
/plugin.o
/plugin_registry.o
/poll.o
/pread_pwrite.o
/progname.o
/readv_writev.o
/rlimit.o
/rtc.o
/rwlock.o
/select.o
/semaphore.o
/signal.o
/sleep.o
/socket_fs_plugin.o
/socket_operations.o
/sys
/syscall.o
/sysctl.o
/task.o
/thread.o
/thread_create.o
/time.o
/vfs_plugin.o

View File

@ -23,6 +23,11 @@ INCLUDES += -Ilibc-include/spec/x86
INCLUDES += -I./include/spec/x86_64
endif
ifeq (@(TUP_ARCH),arm_v8)
INCLUDES += -Ilibc-include/spec/arm_64
INCLUDES += -I./include/spec/arm_64
endif
INCLUDES += -Ilibc-include
INCLUDES += -I./

View File

@ -1,6 +1,5 @@
include_rules
SED_FLAGS += -e "s|@includedir@|`nix-store --add $(REP_DIR)/include`|"
SED_FLAGS += -e "s|@version@|`git describe --always`|"
: *.pc.in |> !sed_pkgconfig_file |>

View File

@ -1,8 +0,0 @@
LIBS = base
INCLUDES += -I./
include_rules
: foreach *.cc |> !cxx |> %B.o {obj}
: foreach spec/x86/*.cc |> !cxx |> %B.o {obj}
: {obj} | |> !prg |> ahci_drv

View File

@ -0,0 +1,3 @@
LIBS = base
INCLUDES += -I$(TUP_CWD)
SRC_CC = $(TUP_CWD)/*.cc

View File

@ -0,0 +1,10 @@
ifdef x86
TARGET_NAME = ahci_drv
include_rules
: foreach $(SRC_CC) *.cc |> !cxx |> %B.o {obj}
: {obj} | |> !prg |> $(TARGET_NAME) {bin}
: {bin} |> !collect_bin |>
include &(BIN_RULES)
endif

View File

@ -0,0 +1 @@
INCLUDES += -I$(TUP_CWD)

View File

@ -0,0 +1,10 @@
ifdef x86
TARGET_NAME = ps2_drv
include_rules
: foreach $(SRC_CC) *.cc |> !cxx |> %B.o {obj}
: {obj} | |> !prg |> $(TARGET_NAME) {bin}
: {bin} |> !collect_bin |>
include &(BIN_RULES)
endif

View File

@ -5,7 +5,6 @@ include_rules
: $(REP_DIR)/lib/symbols/vfs |> !abi_stub |>
SED_FLAGS += -e "s|@version@|`git describe --always`|"
: vfs.pc.in |> !sed_pkgconfig_file |>
: foreach *.cc |> !cxx |> %B.o {lib-obj}

View File

View File

@ -1 +0,0 @@
Libs: -l:%d.lib.so

View File

@ -1,13 +0,0 @@
TEMPLATE_FILE = $(TUP_CWD)/template.pc.in
: $(TEMPLATE_FILE) | $(LOCAL_LIB_PREFIX)/*.lib.so \
|> ^ Generate %d^ sed 's|%%d|%d|' %f > %o \
|> $(LOCAL_PKGCONFIG_PREFIX)/arm64/%d.pc
: $(TEMPLATE_FILE) | $(LOCAL_LIB_PREFIX)/*.lib.so \
|> ^ Generate %d^ sed 's|%%d|%d|' %f > %o \
|> $(LOCAL_PKGCONFIG_PREFIX)/x86_32/%d.pc
: $(TEMPLATE_FILE) | $(LOCAL_LIB_PREFIX)/*.lib.so \
|> ^ Generate %d^ sed 's|%%d|%d|' %f > %o \
|> $(LOCAL_PKGCONFIG_PREFIX)/x86_64/%d.pc