Improve build variant support
This commit is contained in:
parent
b6422c3dcc
commit
d1eead8de2
27
Tuprules.tup
27
Tuprules.tup
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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 |>
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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@
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 |>
|
|
@ -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>
|
||||
|
|
|
@ -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 |>
|
||||
|
|
|
@ -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 |>
|
||||
|
|
20
repos/libports/ports/egl_api.nix
Normal file
20
repos/libports/ports/egl_api.nix
Normal 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
|
||||
'';
|
||||
}
|
4
repos/libports/src/lib/egl_api/Tupfile
Normal file
4
repos/libports/src/lib/egl_api/Tupfile
Normal 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 |>
|
|
@ -1,5 +1,6 @@
|
|||
includedir=@includedir@/egl_api
|
||||
includedir=@includedir@
|
||||
|
||||
Name: EGL
|
||||
Description: EGL API headers
|
||||
Version: @version@
|
||||
Cflags: -I${includedir}
|
||||
|
|
50
repos/libports/src/lib/libc/.gitignore
vendored
50
repos/libports/src/lib/libc/.gitignore
vendored
|
@ -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
|
|
@ -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./
|
||||
|
||||
|
|
|
@ -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 |>
|
||||
|
|
|
@ -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
|
3
repos/os/src/drivers/ahci/Tuprules.tup
Normal file
3
repos/os/src/drivers/ahci/Tuprules.tup
Normal file
|
@ -0,0 +1,3 @@
|
|||
LIBS = base
|
||||
INCLUDES += -I$(TUP_CWD)
|
||||
SRC_CC = $(TUP_CWD)/*.cc
|
10
repos/os/src/drivers/ahci/spec/x86/Tupfile
Normal file
10
repos/os/src/drivers/ahci/spec/x86/Tupfile
Normal 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
|
1
repos/os/src/drivers/input/spec/ps2/Tuprules.tup
Normal file
1
repos/os/src/drivers/input/spec/ps2/Tuprules.tup
Normal file
|
@ -0,0 +1 @@
|
|||
INCLUDES += -I$(TUP_CWD)
|
10
repos/os/src/drivers/input/spec/ps2/x86/Tupfile
Normal file
10
repos/os/src/drivers/input/spec/ps2/x86/Tupfile
Normal 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
|
|
@ -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}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Libs: -l:%d.lib.so
|
|
@ -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
|
Loading…
Reference in New Issue
Block a user