Radix cross Linux Toolchains

Toolchains for all supported by Radix cross Linux devices

80 Commits   2 Branches   13 Tags


COMPONENT_TARGETS = $(TOOLCHAIN_X86_64_GLIBC)


FLAVOURS = compat next

include ../../../build-system/config.mk

SOURCE_REQUIRES = sources/crypt

ifeq ($(FLAVOUR),compat)
REQUIRES  = core/glibc/2.41-x86_32^full
endif
ifeq ($(FLAVOUR),next)
REQUIRES  = core/crypt/4.4.38-x86_32^compat
endif

# ======= __END_OF_REQUIRES__ =======

tar_xz_archive  = $(SRC_PACKAGE_PATH)/crypt/libxcrypt/libxcrypt-4.4.38.tar.xz
SRC_ARCHIVE     = $(tar_xz_archive)
SRC_DIR         = $(TARGET_BUILD_DIR)/libxcrypt-4.4.38
src_dir_name    = libxcrypt-4.4.38
src_done        = $(TARGET_BUILD_DIR)/.source-done

PATCHES         = PATCHES

build_compat_dir    = $(TARGET_BUILD_DIR)/build-compat
build_next_dir      = $(TARGET_BUILD_DIR)/build-next

sysroot_dir         = $(TOOLCHAIN_PATH)/$(TARGET)/sys-root

build_compat_target = $(TARGET_BUILD_DIR)/.compat-built
compat_target       = $(TARGET_BUILD_DIR)/.compat-installed

build_next_target   = $(TARGET_BUILD_DIR)/.next-built
next_target         = $(TARGET_BUILD_DIR)/.next-installed


ifeq ($(FLAVOUR),compat)
BUILD_TARGETS  = $(build_compat_target)
BUILD_TARGETS += $(compat_target)
endif

ifeq ($(FLAVOUR),next)
BUILD_TARGETS  = $(build_next_target)
BUILD_TARGETS += $(next_target)
endif

include ../../../build-system/core.mk


env_sysroot     = DESTDIR=$(sysroot_dir)


CC           = $(CCACHE)$(TOOLCHAIN_PATH)/bin/$(TARGET)-gcc -m32
CXX          = $(CCACHE)$(TOOLCHAIN_PATH)/bin/$(TARGET)-g++ -m32

environment  = AS=$(TOOLCHAIN_PATH)/bin/$(TARGET)-as
environment += LD=$(TOOLCHAIN_PATH)/bin/$(TARGET)-ld
environment += CC="$(CC)"
environment += CXX="$(CXX)"
environment += AR=$(TOOLCHAIN_PATH)/bin/$(TARGET)-ar
environment += RANLIB=$(TOOLCHAIN_PATH)/bin/$(TARGET)-ranlib

environment += PATH=$(TOOLCHAIN_PATH)/bin:$(PATH)

LIBSUFFIX    =

ifeq ($(TOOLCHAIN),$(TOOLCHAIN_X86_64_GLIBC))
environment += CFLAGS="-g -O3 -march=i686 -mtune=i686"
LIBSUFFIX    = 32
endif

TARGET32 = $(shell echo $(TARGET) | sed 's/x86_64/i686/')


extra_configure_switches   = --libdir=/usr/lib$(LIBSUFFIX)
extra_configure_switches  += --mandir=/usr/share/man
ifeq ($(FLAVOUR),compat)
extra_configure_switches  += --enable-hashes=strong,glibc
extra_configure_switches  += --enable-obsolete-api=glibc
extra_configure_switches  += --disable-feature-tokens
endif
ifeq ($(FLAVOUR),next)
extra_configure_switches  += --enable-hashes=strong,glibc
extra_configure_switches  += --enable-obsolete-api=no
extra_configure_switches  += --disable-feature-tokens
extra_configure_switches  += --enable-static=no
endif



$(src_done): $(SRC_ARCHIVE) $(PATCHES_DEP)
	$(UNPACK_SRC_ARCHIVE)
	$(APPLY_PATCHES)
	@touch $@

$(build_compat_target): $(src_done)
	@mkdir -p $(build_compat_dir)
	@cd $(build_compat_dir) && $(env_sysroot) $(environment) ../$(src_dir_name)/configure \
	  --prefix=/usr                \
	  --build=$(BUILD)             \
	  --host=$(TARGET32)           \
	  $(extra_configure_switches)
	@cd $(build_compat_dir) && $(environment) $(MAKE) all
	@touch $@

$(build_next_target): $(src_done)
	@mkdir -p $(build_next_dir)
	@cd $(build_next_dir) && $(env_sysroot) $(environment) ../$(src_dir_name)/configure \
	  --prefix=/usr                \
	  --build=$(BUILD)             \
	  --host=$(TARGET32)           \
	  $(extra_configure_switches)
	@cd $(build_next_dir) && $(environment) $(MAKE) all
	@touch $@

$(compat_target): $(build_compat_target)
	@mkdir -p $(sysroot_dir)/{,usr/}lib$(LIBSUFFIX)
	@cd $(build_compat_dir) && $(environment) $(MAKE) -j1 install $(env_sysroot)
	@( cd $(sysroot_dir)/usr/lib$(LIBSUFFIX) ; \
	   rm -f *.la ; \
	   rm libcrypt.so ; \
	   mv libcrypt.so* ../../lib$(LIBSUFFIX) ; \
	   ln -sf ../../lib$(LIBSUFFIX)/libcrypt.so.1 libcrypt.so ; \
	 )
	@echo "  $(subst $(TOP_BUILD_DIR_ABS)/,,$(CURDIR))$(if $(FLAVOUR),:$(FLAVOUR),)" >> $(TOOLCHAIN_PATH)/README
	@touch $@

$(next_target): $(build_next_target)
	@mkdir -p $(sysroot_dir)/{,usr/}lib$(LIBSUFFIX)
	@cd $(build_next_dir) && $(environment) $(MAKE) -j1 install $(env_sysroot)
	@( cd $(sysroot_dir)/usr/lib$(LIBSUFFIX) ; \
	   rm -f *.la ; \
	   rm libcrypt.so ; \
	   mv libcrypt.so* ../../lib$(LIBSUFFIX) ; \
	   ln -sf ../../lib$(LIBSUFFIX)/libcrypt.so.2 libcrypt.so ; \
	 )
	@echo "  $(subst $(TOP_BUILD_DIR_ABS)/,,$(CURDIR))$(if $(FLAVOUR),:$(FLAVOUR),)" >> $(TOOLCHAIN_PATH)/README
	@touch $@