diff --git a/include/expat.mak b/include/expat.mak new file mode 100644 index 0000000..c4d7566 --- /dev/null +++ b/include/expat.mak @@ -0,0 +1,65 @@ +NAME := libexpat +EXPAT_VERSION := 2.5.0 + +# The download URL should point to a tar archive of some sort. +# On most systems, tar will handle most compression formats, so +# tar/gzip, tar/bzip2, etc, are fine. If the archive is in a different +# format, a recipe to create $(SRC) will need to be provided. +EXPAT_URL := https://github.com/libexpat/libexpat/releases/download/R_$(subst .,_,$(EXPAT_VERSION))/expat-$(EXPAT_VERSION).tar.gz + +# The list of all programs that the package builds. +# These targets can be called and built from the command line. +# If the package provides no programs, leave this list empty. +# EXPAT_PROGRAMS := program-a program-b program-c + +# The list of library names that the package builds. +# If the package provides no libraries, leave this list empty. +# Libraries will be represented as variables so that other packages may use them. +# For example, libsomething.a will be available as $$(libsomething). +EXPAT_LIBRARIES := libexpat.a + +# Allow the user to add any make, autoconf, or configure options that they want. +# Feel free to put any reasonable default values here. +# EXPAT_CONFIG = --disable-unpopular-feature --disable-bulky-feature + +# This creates the recipe chain that downloads, extracts, builds, and strips +# the binaries created by this package. This makes it so that only the main +# build recipe's contents need to be provided by the package author. +$(eval $(call create_recipes, \ + $(NAME), \ + $(EXPAT_VERSION), \ + $(EXPAT_URL), \ + $(EXPAT_PROGRAMS), \ + $(EXPAT_LIBRARIES), \ +)) + +# This is the main build recipe! +# Using $(BUILD_FLAG) as a target, it must compile the sources in $(SRC) and +# install the resulting programs and libraries into $(SYSROOT). If the package +# depends on any libraries, add their variable representations to this target's +# dependency list. For example, if the package depends on libsomething.a, +# add $$(libsomething) to $(BUILD_FLAG)'s dependencies. +$(BUILD_FLAG): $$(libz) +# This activates the cross-compiler toolchain by setting/exporting a lot of variables. +# Without this, builds would default to the system's compilers and libraries. + $(eval $(call activate_toolchain,$@)) +# The configure step defines what features should be enabled for the program. +# If available, the --host and --prefix values should always be the values below. +# Try to only hard-code the flags that are critical to a successful static build. +# Optional flags should be put in EXPAT_CONFIG so the user can override them. + + cd "$(SRC)" && ./configure \ + $(CONFIGURE_DEFAULTS) \ + --enable-static --disable-shared \ + --with-zlib="$(SYSROOT)" \ + $(EXPAT_CONFIG) \ + CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" + $(MAKE) -C "$(SRC)" clean + $(MAKE) -C "$(SRC)" + $(MAKE) -C "$(SRC)" install + +# All programs should add themselves to the ALL_PROGRAMS list. +ALL_PROGRAMS += $(EXPAT_PROGRAMS) + +# Only programs that most users would want should be added to DEFAULT_PROGRAMS. +DEFAULT_PROGRAMS += $(EXPAT_PROGRAMS) diff --git a/include/git-wolfssl.patch b/include/git-wolfssl.patch new file mode 100644 index 0000000..ad51305 --- /dev/null +++ b/include/git-wolfssl.patch @@ -0,0 +1,91 @@ +From 011ef3e69ecc641d085cdba424e7312b8dfc49a8 Mon Sep 17 00:00:00 2001 +From: Juliusz Sosinowicz +Date: Fri, 1 Apr 2022 11:32:23 +0200 +Subject: [PATCH] Patch for wolfSSL + +This patch is made for git version 2.35.1/ + +Compile wolfSSL with: +``` +./configure --enable-opensslextra +make +make install +``` + +Compile git with: +``` +patch -p1 < /path/to/this/patch +make USE_WOLFSSL=1 OPENSSL_SHA1=1 OPENSSL_SHA256=1 +make USE_WOLFSSL=1 OPENSSL_SHA1=1 OPENSSL_SHA256=1 install +``` + +If you gave installed wolfSSL in a non-standard directory then you can use the `WOLFSSSLDIR` variable to point git to that directory as such: +``` +make USE_WOLFSSL=1 OPENSSL_SHA1=1 OPENSSL_SHA256=1 WOLFSSSLDIR=/path/to/wolfssl/install +make USE_WOLFSSL=1 OPENSSL_SHA1=1 OPENSSL_SHA256=1 WOLFSSSLDIR=/path/to/wolfssl/install install +``` + +All of the tests run with `make USE_WOLFSSL=1 OPENSSL_SHA1=1 OPENSSL_SHA256=1 test` should pass +--- + Makefile | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 5580859afd..ad4114759d 100644 +--- a/Makefile ++++ b/Makefile +@@ -27,6 +27,9 @@ all:: + # + # Define NO_OPENSSL environment variable if you do not have OpenSSL. + # ++# Define USE_WOLFSSL environment variable if you want to use wolfSSL instead ++# of OpenSSL ++# + # Define USE_LIBPCRE if you have and want to use libpcre. Various + # commands such as log and grep offer runtime options to use + # Perl-compatible regular expressions instead of standard or extended +@@ -1458,7 +1461,7 @@ else + endif + endif + endif +-IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO) ++IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO) $(WOLFSSL_LINK) + + ifdef ZLIB_PATH + BASIC_CFLAGS += -I$(ZLIB_PATH)/include +@@ -1466,6 +1469,15 @@ ifdef ZLIB_PATH + endif + EXTLIBS += -lz + ++ifdef USE_WOLFSSL ++ NO_OPENSSL = YesPlease ++ ifndef WOLFSSSLDIR ++ WOLFSSSLDIR = /usr/local ++ endif ++ BASIC_CFLAGS += -I$(WOLFSSSLDIR)/include -I$(WOLFSSSLDIR)/include/wolfssl -DEXTERNAL_OPTS_OPENVPN -DUSE_WOLFSSL ++ WOLFSSL_LINK = -L$(WOLFSSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(WOLFSSSLDIR)/$(lib) ++endif ++ + ifndef NO_OPENSSL + OPENSSL_LIBSSL = -lssl + ifdef OPENSSLDIR +@@ -1478,11 +1490,16 @@ ifndef NO_OPENSSL + OPENSSL_LIBSSL += -lcrypto + endif + else +- BASIC_CFLAGS += -DNO_OPENSSL ++ ifndef NO_OPENSSL ++ BASIC_CFLAGS += -DNO_OPENSSL ++ endif + OPENSSL_LIBSSL = + endif + ifdef NO_OPENSSL + LIB_4_CRYPTO = ++ ifdef USE_WOLFSSL ++ LIB_4_CRYPTO = $(WOLFSSL_LINK) -lwolfssl ++ endif + else + ifdef NEEDS_SSL_WITH_CRYPTO + LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl +-- +2.25.1 diff --git a/include/git.mak b/include/git.mak new file mode 100644 index 0000000..48e6ac8 --- /dev/null +++ b/include/git.mak @@ -0,0 +1,88 @@ +NAME := git +GIT_VERSION := 2.40.1 + +# The download URL should point to a tar archive of some sort. +# On most systems, tar will handle most compression formats, so +# tar/gzip, tar/bzip2, etc, are fine. If the archive is in a different +# format, a recipe to create $(SRC) will need to be provided. +GIT_URL := https://github.com/git/git/archive/refs/tags/v$(GIT_VERSION).tar.gz + +# The list of all programs that the package builds. +# These targets can be called and built from the command line. +# If the package provides no programs, leave this list empty. +GIT_PROGRAMS := git git.tar.gz + + +# The list of library names that the package builds. +# If the package provides no libraries, leave this list empty. +# Libraries will be represented as variables so that other packages may use them. +# For example, libsomething.a will be available as $$(libsomething). +# GIT_LIBRARIES := libexample.a + +# Allow the user to add any make, autoconf, or configure options that they want. +# Feel free to put any reasonable default values here. +GIT_CONFIG = INSTALL_SYMLINKS=1 + +# This creates the recipe chain that downloads, extracts, builds, and strips +# the binaries created by this package. This makes it so that only the main +# build recipe's contents need to be provided by the package author. +$(eval $(call create_recipes, \ + $(NAME), \ + $(GIT_VERSION), \ + $(GIT_URL), \ + $(GIT_PROGRAMS), \ + $(GIT_LIBRARIES), \ +)) +GIT_WOLFSSL_PATCH := $(src)/.wolfssl + +# This is the main build recipe! +# Using $(BUILD_FLAG) as a target, it must compile the sources in $(SRC) and +# install the resulting programs and libraries into $(SYSROOT). If the package +# depends on any libraries, add their variable representations to this target's +# dependency list. For example, if the package depends on libsomething.a, +# add $$(libsomething) to $(BUILD_FLAG)'s dependencies. +$(GIT_WOLFSSL_PATCH): + cd "$(SRC)" && patch -p1 < $(MAKEFILE_DIR)/include/git-wolfssl.patch + touch $(GIT_WOLFSSL_PATCH) + +TOOLS = AR=$(SYSROOT)/bin/$(TARGET)-ar AS=$(SYSROOT)/bin/$(TARGET)-as CC=$(SYSROOT)/bin/$(TARGET)-cc CXX=$(SYSROOT)/bin/$(TARGET)-g++ LD=$(SYSROOT)/bin/$(TARGET)-ld NM=$(SYSROOT)/bin/$(TARGET)-nm OBJCOPY=$(SYSROOT)/bin/$(TARGET)-objcopy OBJDUMP=$(SYSROOT)/bin/$(TARGET)-objdump RANLIB=$(SYSROOT)/bin/$(TARGET)-ranlib READELF=$(SYSROOT)/bin/$(TARGET)-readelf STRIP=$(SYSROOT)/bin/$(TARGET)-strip prefix="$(SYSROOT)" + +$(BUILD_FLAG): $$(libz) $$(libcurl) $$(libssl) $$(openssl) $$(curl) $(libexpat) $(GIT_WOLFSSL_PATCH) +# This activates the cross-compiler toolchain by setting/exporting a lot of variables. +# Without this, builds would default to the system's compilers and libraries. + $(eval $(call activate_toolchain,$@)) +# The configure step defines what features should be enabled for the program. +# If available, the --host and --prefix values should always be the values below. +# Try to only hard-code the flags that are critical to a successful static build. +# Optional flags should be put in GIT_CONFIG so the user can override them. + + $(MAKE) -C "$(SRC)" clean + $(MAKE) -C "$(SRC)" V=1 $(TOOLS) \ + NO_REGEX=YesPlease NO_ICONV=YesPlease NO_GETTEXT=YesPlease NO_TCLTK=YesPlease NO_PERL=1 $(SSL_FLAGS) \ + CURL_LDFLAGS="-L/build/sysroot/aarch64-linux-musl/lib -lcurl $(SSL_CURL_FLAGS) -lm -lz" \ + CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(GIT_CONFIG) + $(MAKE) -C "$(SRC)" $(TOOLS) prefix="$(SYSROOT)" \ + NO_REGEX=YesPlease NO_ICONV=YesPlease NO_GETTEXT=YesPlease NO_TCLTK=YesPlease NO_PERL=1 $(SSL_FLAGS) \ + CURL_LDFLAGS="-L/build/sysroot/aarch64-linux-musl/lib -lcurl $(SSL_CURL_FLAGS) -lm -lz" \ + CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(GIT_CONFIG) install + $(MAKE) -C "$(SRC)" $(TOOLS) prefix="/" \ + NO_REGEX=YesPlease NO_ICONV=YesPlease NO_GETTEXT=YesPlease NO_TCLTK=YesPlease NO_PERL=1 $(SSL_FLAGS) \ + CURL_LDFLAGS="-L/build/sysroot/aarch64-linux-musl/lib -lcurl $(SSL_CURL_FLAGS) -lm -lz" \ + CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(GIT_CONFIG) DESTDIR=/tmp/git install + tar czf $(SYSROOT)/bin/git.tar.gz -C /tmp/git . + +SSL_FLAGS := +SSL_CURL_FLAGS := -lssl -lcrypto +ifeq (wolfssl,$(OPENSSL)) +SSL_FLAGS := USE_WOLFSSL=1 OPENSSL_SHA1=1 OPENSSL_SHA256=1 WOLFSSSLDIR="$(SYSROOT)" +SSL_CURL_FLAGS := -lwolfssl + +else ifeq (wolfssl,$(CURL_SSL)) +SSL_CURL_FLAGS := $(SSL_CURL_FLAGS) -lwolfssl +endif + +# All programs should add themselves to the ALL_PROGRAMS list. +ALL_PROGRAMS += $(GIT_PROGRAMS) + +# Only programs that most users would want should be added to DEFAULT_PROGRAMS. +DEFAULT_PROGRAMS += $(GIT_PROGRAMS) diff --git a/include/wolfssl.mak b/include/wolfssl.mak index d580a69..75b908a 100644 --- a/include/wolfssl.mak +++ b/include/wolfssl.mak @@ -18,8 +18,8 @@ $(BUILD_FLAG): cd "$(SRC)" && ./configure \ $(CONFIGURE_DEFAULTS) \ --disable-shared --enable-static \ - --enable-opensslall \ + --enable-opensslall --enable-opensslextra --enable-curl \ CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKE) -C "$(SRC)" clean $(MAKE) -C "$(SRC)" - $(MAKE) -C "$(SRC)" install \ No newline at end of file + $(MAKE) -C "$(SRC)" install