[WIP] cross build json-c and cryptsetup

This commit is contained in:
HardenedVault 2020-10-22 13:16:00 +02:00
parent 209c9778ad
commit 057cc3c377
5 changed files with 51 additions and 10 deletions

View File

View File

@ -14,9 +14,11 @@ cryptsetup_configure := ./configure \
$(CROSS_TOOLS) \ $(CROSS_TOOLS) \
--host i386-elf-linux \ --host i386-elf-linux \
--prefix "/" \ --prefix "/" \
--disable-rpath \
--disable-gcrypt-pbkdf2 \ --disable-gcrypt-pbkdf2 \
--enable-cryptsetup-reencrypt \ --enable-cryptsetup-reencrypt \
--with-crypto_backend=kernel \ --with-crypto_backend=kernel \
--with-tmpfilesdir=$(INSTALL)/lib/tmpfiles.d
# but after building, replace prefix so that they will be installed # but after building, replace prefix so that they will be installed
# in the correct directory. # in the correct directory.
@ -28,10 +30,10 @@ cryptsetup_target := \
install install
cryptsetup_output := \ cryptsetup_output := \
src/.libs/cryptsetup \ .libs/cryptsetup \
src/.libs/cryptsetup-reencrypt \ .libs/cryptsetup-reencrypt \
src/.libs/veritysetup \ .libs/veritysetup \
cryptsetup_libraries := \ cryptsetup_libraries := \
lib/.libs/libcryptsetup.so.12.6.0 \ .libs/libcryptsetup.so.12 \

View File

@ -8,12 +8,30 @@ json-c_hash := 99914e644a25201d82ccefa20430f7515c110923360f9ef46755527c02412afa
# there is a bug in cmake-configure so that it can not be used with a "=", fxed in next # there is a bug in cmake-configure so that it can not be used with a "=", fxed in next
# release though (then it needs to read '--prefix="$(INSTALL)"' here instead # release though (then it needs to read '--prefix="$(INSTALL)"' here instead
json-c_configure := mkdir -p build && \ define toolchain_file =
set\(CMAKE_SYSTEM_NAME Linux\)\n\
set\(CMAKE_SYSROOT $(INSTALL)\)\n\
set\(CMAKE_C_COMPILER $(CROSS)gcc\)\n\
set\(CMAKE_AR $(CROSS)ar\)\n\
set\(CMAKE_LINKER $(CROSS)ld\)\n\
set\(CMAKE_NM $(CROSS)nm\)\n\
set\(CMAKE_OBJCOPY $(CROSS)objcopy\)\n\
set\(CMAKE_OBJDUMP $(CROSS)objdump\)\n\
set\(INSTALL_PKGCONFIG_DIR $(INSTALL)/lib/pkgconfig\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY\)\n\
set\(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY\)
endef
json-c_configure := \
echo -e "$(toolchain_file)" | sed 's/\\//g' > toolchain && \
mkdir -p build && \
cd build && \ cd build && \
../cmake-configure --prefix "$(INSTALL)" cmake .. -DCMAKE_INSTALL_PREFIX="$(INSTALL)" -DCMAKE_TOOLCHAIN_FILE=../toolchain
json-c_target := \ json-c_target := \
$(CROSS_TOOLS) -C $(build)/$(json-c_dir)/build \ $(CROSS_TOOLS) -C $(build)/$(json-c_dir)/build \
all install all install
json-c_libraries := .libs/libjson-c.so.5.0.0 json-c_libraries := build/libjson-c.so.5

View File

@ -26,7 +26,9 @@ util-linux_target := \
$(MAKE_JOBS) \ $(MAKE_JOBS) \
$(CROSS_TOOLS) \ $(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \ DESTDIR="$(INSTALL)" \
install install && \
rm $(INSTALL)/lib/libblkid.la && \
rm $(INSTALL)/lib/libuuid.la
util-linux_libraries += \ util-linux_libraries += \
.libs/libuuid.so.1 \ .libs/libuuid.so.1 \

View File

@ -511,17 +511,36 @@ diff -u -r cryptsetup-2.3.3-clean/Makefile.in cryptsetup-2.3.3/Makefile.in
@CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD) \ @CRYPTSETUP_TRUE@cryptsetup_LDADD = $(LDADD) \
@CRYPTSETUP_TRUE@ libcryptsetup.la \ @CRYPTSETUP_TRUE@ libcryptsetup.la \
@CRYPTSETUP_TRUE@ @POPT_LIBS@ \ @CRYPTSETUP_TRUE@ @POPT_LIBS@ \
+@CRYPTSETUP_TRUE@ @UUID_LIBS@ \
+@CRYPTSETUP_TRUE@ @DEVMAPPER_LIBS@ \ +@CRYPTSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@CRYPTSETUP_TRUE@ @JSON_C_LIBS@ \
@CRYPTSETUP_TRUE@ @PWQUALITY_LIBS@ \ @CRYPTSETUP_TRUE@ @PWQUALITY_LIBS@ \
@CRYPTSETUP_TRUE@ @PASSWDQC_LIBS@ \ @CRYPTSETUP_TRUE@ @PASSWDQC_LIBS@ \
@CRYPTSETUP_TRUE@ @UUID_LIBS@ \ @CRYPTSETUP_TRUE@ @UUID_LIBS@ \
@@ -1060,6 +1062,8 @@ @@ -1060,6 +1062,9 @@
@VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD) \ @VERITYSETUP_TRUE@veritysetup_LDADD = $(LDADD) \
@VERITYSETUP_TRUE@ libcryptsetup.la \ @VERITYSETUP_TRUE@ libcryptsetup.la \
@VERITYSETUP_TRUE@ @POPT_LIBS@ \ @VERITYSETUP_TRUE@ @POPT_LIBS@ \
+@VERITYSETUP_TRUE@ @UUID_LIBS@ \ +@VERITYSETUP_TRUE@ @UUID_LIBS@ \
+@VERITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \ +@VERITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@VERITYSETUP_TRUE@ @JSON_C_LIBS@ \
@VERITYSETUP_TRUE@ @PWQUALITY_LIBS@ \ @VERITYSETUP_TRUE@ @PWQUALITY_LIBS@ \
@VERITYSETUP_TRUE@ @PASSWDQC_LIBS@ \ @VERITYSETUP_TRUE@ @PASSWDQC_LIBS@ \
@VERITYSETUP_TRUE@ @BLKID_LIBS@ @VERITYSETUP_TRUE@ @BLKID_LIBS@
@@ -1093,6 +1093,8 @@
@INTEGRITYSETUP_TRUE@ libcryptsetup.la \
@INTEGRITYSETUP_TRUE@ @POPT_LIBS@ \
@INTEGRITYSETUP_TRUE@ @UUID_LIBS@ \
+@INTEGRITYSETUP_TRUE@ @DEVMAPPER_LIBS@ \
+@INTEGRITYSETUP_TRUE@ @JSON_C_LIBS@ \
@INTEGRITYSETUP_TRUE@ @BLKID_LIBS@
@INTEGRITYSETUP_TRUE@@STATIC_TOOLS_TRUE@integritysetup_static_SOURCES = $(integritysetup_SOURCES)
@@ -1122,6 +1122,8 @@
@REENCRYPT_TRUE@ @POPT_LIBS@ \
@REENCRYPT_TRUE@ @PWQUALITY_LIBS@ \
@REENCRYPT_TRUE@ @PASSWDQC_LIBS@ \
+@REENCRYPT_TRUE@ @DEVMAPPER_LIBS@ \
+@REENCRYPT_TRUE@ @JSON_C_LIBS@ \
@REENCRYPT_TRUE@ @UUID_LIBS@ \
@REENCRYPT_TRUE@ @BLKID_LIBS@