@@ -20,41 +20,24 @@ if [[ -z "${CURL_INSTALL_DIR}" ]]; then
2020 exit 1
2121fi
2222
23+ if [[ -z " ${SYSROOT_DIR} " ]]; then
24+ echo " Required environment variable SYSROOT_DIR was not set"
25+ exit 1
26+ fi
27+
2328case " $TARGET_ARCH " in
2429 " x64" )
25- # __GLIBC_MINOR__ is used as a feature test macro. Replace it with the
26- # earliest supported version of glibc 2.17 as was previously the case when building on ubuntu-18.04
27- sudo sed -i ' s|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' " /usr/include/features.h"
28- # fcntl64() was introduced in glibc 2.28. Make sure to use fcntl() instead.
29- sudo sed -i ' {N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' " /usr/include/fcntl.h"
3030 DEPENDENCY_ARCH=" amd64"
31- export CC=" gcc"
31+ export CC=" gcc --sysroot= $SYSROOT_DIR "
3232 STRIP=" strip"
3333 HOST=" "
3434 TARGET=" " ;;
35- " x86" )
36- DEPENDENCY_ARCH=" x86"
37- export CC=" i686-linux-gnu-gcc"
38- STRIP=" i686-gnu-strip"
39- HOST=" --host=i686-linux-gnu"
40- TARGET=" --target=i686-linux-gnu" ;;
4135 " arm64" )
42- # __GLIBC_MINOR__ is used as a feature test macro. Replace it with the
43- # earliest supported version of glibc 2.17 as was previously the case when building on ubuntu-18.04
44- sudo sed -i ' s|\(#define\s\+__GLIBC_MINOR__\)|\1 17 //|' " /usr/aarch64-linux-gnu/include/features.h"
45- # fcntl64() was introduced in glibc 2.28. Make sure to use fcntl() instead.
46- sudo sed -i ' {N; s/#ifndef __USE_FILE_OFFSET64\(\nextern int fcntl\)/#if 1\1/}' " /usr/aarch64-linux-gnu/include/fcntl.h"
4736 DEPENDENCY_ARCH=" arm64"
4837 export CC=" aarch64-linux-gnu-gcc"
4938 STRIP=" aarch64-linux-gnu-strip"
5039 HOST=" --host=aarch64-linux-gnu"
5140 TARGET=" --target=aarch64-linux-gnu" ;;
52- " arm" )
53- DEPENDENCY_ARCH=" arm"
54- export CC=" arm-linux-gnueabihf-gcc"
55- STRIP=" arm-linux-gnueabihf-strip"
56- HOST=" --host=arm-linux-gnueabihf"
57- TARGET=" --target=arm-linux-gnueabihf" ;;
5841 * )
5942 exit 1 ;;
6043esac
@@ -70,11 +53,20 @@ source "$CURRENT_DIR/compute-checksum.sh"
7053# shellcheck source=script/check-static-linking.sh
7154source " $CURRENT_DIR /check-static-linking.sh"
7255
56+ echo " -- Setting up sysroot at $SYSROOT_DIR "
57+ sudo mkdir -p " $SYSROOT_DIR "
58+ sudo debootstrap --variant=buildd --arch amd64 \
59+ --include=libx11-dev,libxkbfile-dev,libfontconfig1-dev,libcurl4-gnutls-dev,libexpat1-dev,gettext \
60+ focal " $SYSROOT_DIR " http://archive.ubuntu.com/ubuntu/
61+
7362echo " -- Building vanilla curl at $CURL_INSTALL_DIR instead of distro-specific version"
7463
7564CURL_FILE_NAME=" curl-7.68.0"
7665CURL_FILE=" $CURL_FILE_NAME .tar.gz"
7766
67+ sudo mkdir -p " $CURL_INSTALL_DIR " || exit 1
68+ sudo chown -R " $USER " " $CURL_INSTALL_DIR " || exit 1
69+
7870cd /tmp || exit 1
7971curl -LO " https://curl.haxx.se/download/$CURL_FILE "
8072tar -xf $CURL_FILE
@@ -84,6 +76,9 @@ cd $CURL_FILE_NAME || exit 1
8476./configure --prefix=" $CURL_INSTALL_DIR " " $HOST " " $TARGET "
8577make install
8678)
79+
80+ CURL_CONFIG=" $CURL_INSTALL_DIR /bin/curl-config"
81+
8782echo " -- Building git at $SOURCE to $DESTINATION "
8883
8984(
0 commit comments