Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag

COMPONENT_TARGETS  = $(HARDWARE_S824L)
COMPONENT_TARGETS += $(HARDWARE_VESNIN)
COMPONENT_TARGETS += $(HARDWARE_TL2WK2)
COMPONENT_TARGETS += $(HARDWARE_TL2SV2)

NEED_ABS_PATH      = true
COMPONENT_IS_3PP   = true

CREATE_PPC32_PACKAGE = true


include ../../../../build-system/constants.mk


SOURCE_REQUIRES    = sources/packages/l/poppler

REQUIRES           = env/X11/poppler/23.02.0
REQUIRES          += libs/lcms2/2.14-ppc32
REQUIRES          += libs/libjpeg-turbo/2.1.2-ppc32
REQUIRES          += libs/libpng/libpng16/1.6.37-ppc32
REQUIRES          += libs/libtiff/4.3.0-ppc32
REQUIRES          += libs/boost/1.77.0-ppc32
REQUIRES          += libs/glib2/2.76.0-ppc32
REQUIRES          += media/openjpeg2/2.5.0-ppc32
REQUIRES          += net/nss/3.97-ppc32
REQUIRES          += net/curl/7.75.0-ppc32
REQUIRES          += env/X11/cairo/1.17.8-ppc32

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


version            = 23.02.0
tar_xz_archive     = $(SRC_PACKAGE_PATH)/packages/l/poppler/poppler-$(version).tar.xz
SRC_ARCHIVE        = $(tar_xz_archive)
SRC_DIR            = $(TARGET_BUILD_DIR)/poppler-$(version)
src_dir_name       = poppler-$(version)
doc_dir_name       = poppler-$(version)
src_done           = $(TARGET_BUILD_DIR)/.source_done

PATCHES = PATCHES

build_dir          = $(TARGET_BUILD_DIR)/build
build_target       = $(TARGET_BUILD_DIR)/.build_done
install_target     = $(TARGET_BUILD_DIR)/.install_done


####### Targets


POPPLER_32_PKG   = $(CURDIR)/$(TARGET_BUILD_DIR)/poppler-x32-package

BUILD_TARGETS    = $(build_target)
BUILD_TARGETS   += $(install_target)


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


env_sysroot = DESTDIR=$(POPPLER_32_PKG)


ENABLE_GTK_DOCUMENTATION = no

TARGET_BIN_RPATH = /lib$(MULTILIB_PPC32_SUFFIX):/usr/lib$(MULTILIB_PPC32_SUFFIX)
TARGET_LIB_RPATH = /lib$(MULTILIB_PPC32_SUFFIX):/usr/lib$(MULTILIB_PPC32_SUFFIX):/usr/lib/../lib$(MULTILIB_PPC32_SUFFIX)

suppress-warnings   = -Wno-use-after-free -Wno-unused-but-set-variable -Wno-format -Wno-format-security
suppress-warnings  += -Wno-maybe-uninitialized -Wno-cast-align -Wno-stringop-overflow -Wno-psabi

configure_switches  = -DCMAKE_BUILD_TYPE='Release'

configure_switches += -DCMAKE_C_COMPILER='$(CROSS_PREFIX)gcc'
configure_switches += -DCMAKE_LINKER='$(CROSS_PREFIX)ld'
configure_switches += -DCMAKE_AR='$(CROSS_PREFIX)ar'
configure_switches += -DCMAKE_NM='$(CROSS_PREFIX)nm'
configure_switches += -DCMAKE_RANLIB='$(CROSS_PREFIX)ranlib'
configure_switches += -DCMAKE_OBJCOPY='$(CROSS_PREFIX)objcopy'
configure_switches += -DCMAKE_OBJDUMP='$(CROSS_PREFIX)objdump'
configure_switches += -DCMAKE_STRIP='$(CROSS_PREFIX)strip'

configure_switches += -DCMAKE_C_FLAGS='--sysroot=$(TARGET_DEST_DIR) -m32 $(CFLAGS) $(ARCH_FLAGS) $(ARCH_DEFS) $(HW_FLAGS) $(suppress-warnings)'
configure_switches += -DCMAKE_CXX_FLAGS='--sysroot=$(TARGET_DEST_DIR) -m32 $(CFLAGS) $(ARCH_FLAGS) $(ARCH_DEFS) $(HW_FLAGS) $(suppress-warnings)'

configure_switches += -DCMAKE_EXE_LINKER_FLAGS='--sysroot=$(TARGET_DEST_DIR) -m32 -Wl,-rpath,$(TARGET_BIN_RPATH) -L$(TARGET_DEST_DIR)/lib$(MULTILIB_PPC32_SUFFIX) -L$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX) -lstdc++'
configure_switches += -DCMAKE_MODULE_LINKER_FLAGS='--sysroot=$(TARGET_DEST_DIR) -m32 -Wl,-rpath,$(TARGET_LIB_RPATH) -L$(TARGET_DEST_DIR)/lib$(MULTILIB_PPC32_SUFFIX) -L$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX) -lstdc++'
configure_switches += -DCMAKE_SHARED_LINKER_FLAGS='--sysroot=$(TARGET_DEST_DIR) -m32 -Wl,-rpath,$(TARGET_LIB_RPATH) -L$(TARGET_DEST_DIR)/lib$(MULTILIB_PPC32_SUFFIX) -L$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX) -lstdc++'

configure_switches += -DCMAKE_INSTALL_PREFIX=/usr

configure_switches += -DCMAKE_INSTALL_DOCDIR='/usr/share/doc/$(doc_dir_name)'
configure_switches += -DCMAKE_INSTALL_INFODIR='/usr/share/info'
configure_switches += -DCMAKE_INSTALL_MANDIR='/usr/share/man'

configure_switches += -DCMAKE_INSTALL_SYSCONFDIR='etc'
configure_switches += -DCMAKE_INSTALL_BINDIR='bin/32'
configure_switches += -DCMAKE_INSTALL_LIBDIR='lib$(MULTILIB_PPC32_SUFFIX)'

configure_switches += -DCMAKE_CROSSCOMPILING=True

configure_switches += -DBUILD_SHARED_LIBS=ON

configure_switches += -DBUILD_GTK_TESTS=OFF
configure_switches += -DBUILD_QT5_TESTS=OFF
configure_switches += -DBUILD_QT6_TESTS=OFF
configure_switches += -DBUILD_CPP_TESTS=OFF
configure_switches += -DBUILD_MANUAL_TESTS=OFF
configure_switches += -DENABLE_BOOST=ON
configure_switches += -DENABLE_UTILS=ON
configure_switches += -DENABLE_CPP=ON
configure_switches += -DENABLE_GLIB=ON
configure_switches += -DENABLE_GOBJECT_INTROSPECTION=OFF
configure_switches += -DENABLE_LIBOPENJPEG=openjpeg2
configure_switches += -DENABLE_CMS=lcms2
configure_switches += -DENABLE_LIBCURL=ON
configure_switches += -DENABLE_ZLIB=ON
configure_switches += -DENABLE_QT5=OFF
configure_switches += -DENABLE_QT6=OFF

configure_switches += -DENABLE_UNSTABLE_API_ABI_HEADERS=ON
configure_switches += -DTESTDATADIR=$(CURDIR)/$(SRC_DIR)/test

configure_switches += -DENABLE_GTK_DOC=False

configure_switches += -DFREETYPE_INCLUDE_DIR_freetype2=$(TARGET_DEST_DIR)/usr/include/freetype2
configure_switches += -DFREETYPE_INCLUDE_DIR_ft2build=$(TARGET_DEST_DIR)/usr/include/freetype2
configure_switches += -DFREETYPE_LIBRARY_RELEASE=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/libfreetype.so

configure_switches += -DFontconfig_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include
configure_switches += -DFontconfig_LIBRARY=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/libfontconfig.so

configure_switches += -DJPEG_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include
configure_switches += -DJPEG_LIBRARY_RELEASE=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/libjpeg.so

configure_switches += -DPNG_LIBRARY_RELEASE=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/libpng.so
configure_switches += -DPNG_PNG_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include

configure_switches += -DTIFF_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include
configure_switches += -DTIFF_LIBRARY_RELEASE=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/libtiff.so

configure_switches += -DZLIB_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include
configure_switches += -DZLIB_LIBRARY_RELEASE=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/libz.so

configure_switches += -DBoost_DIR=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/cmake/Boost-1.77.0
configure_switches += -DBoost_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include/boost

configure_switches += -DLCMS2_INCLUDE_DIR=$(TARGET_DEST_DIR)/usr/include
configure_switches += -DLCMS2_LIBRARIES=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/liblcms2.so

configure_switches += -DOpenJPEG_DIR=$(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/openjpeg-2.5


####### Dependencies

$(src_done): $(SRC_ARCHIVE) $(PATCHES_DEP)
	$(UNPACK_SRC_ARCHIVE)
	$(APPLY_PATCHES)
	@touch $(SRC_DIR)/test/test-poppler.c
	@touch $@

$(build_target): $(src_done)
	# ======= Build Poppler =======
	@mkdir -p $(build_dir)
	@( cd $(build_dir) ; \
	   $(BUILD_ENVIRONMENT) cmake $(configure_switches) ../$(src_dir_name) ; \
	 )
	@( cd $(build_dir) ; \
	   $(BUILD_ENVIRONMENT) $(MAKE) ; \
	 )
	@touch $@

$(install_target): $(build_target)
	@mkdir -p $(POPPLER_32_PKG)
	@cd $(build_dir) && $(BUILD_ENVIRONMENT) $(MAKE) -j1 install $(env_sysroot)
	@rm -rf $(POPPLER_32_PKG)/usr/include
	@rm -rf $(POPPLER_32_PKG)/usr/share
	# ======= Install the same to $(TARGET_DEST_DIR) =======
	$(call install-into-devenv, $(POPPLER_32_PKG))
	# ======= tune pkg-config *.pc search path to the target destination for development =======
	@( cd $(TARGET_DEST_DIR)/usr/lib$(MULTILIB_PPC32_SUFFIX)/pkgconfig ; \
	   sed -i "s,/usr,$(TARGET_DEST_DIR)/usr,g" poppler-cpp.pc poppler-glib.pc poppler.pc ; \
	 )
	# ======= Strip binaries =======
	@( cd $(POPPLER_32_PKG) ; \
	   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
	   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs $(STRIP) --strip-unneeded 2> /dev/null ; \
	 )
	@touch $@