diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc15111a..1e43842f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: fail-fast: false matrix: os: [macos-10.15, windows-2019, ubuntu-18.04] - arch: [x86, x64] + arch: [32, 64] go: [1.16.3] include: - os: macos-10.15 @@ -43,22 +43,16 @@ jobs: - os: ubuntu-18.04 friendlyName: Linux targetPlatform: ubuntu - - os: ubuntu-18.04 - friendlyName: Linux - targetPlatform: ubuntu - arch: arm64 - - os: ubuntu-18.04 - friendlyName: Linux - targetPlatform: ubuntu - arch: arm exclude: - os: macos-10.15 - arch: x86 + arch: 32 + - os: ubuntu-18.04 + arch: 32 timeout-minutes: 20 steps: # We need to use Xcode 10.3 for maximum compatibility with older macOS (x64) - name: Switch to Xcode 10.3 - if: matrix.targetPlatform == 'macOS' && matrix.arch == 'x64' + if: matrix.targetPlatform == 'macOS' && matrix.arch == 64 run: | sudo xcode-select -s /Applications/Xcode_10.3.app/Contents/Developer/ # Delete the command line tools to make sure they don't get our builds @@ -79,35 +73,11 @@ jobs: run: npm run prettier - name: Build tools run: npm run check - - name: Install extra dependencies for building Git on Ubuntu (x64) - if: matrix.targetPlatform == 'ubuntu' && matrix.arch == 'x64' + - name: Install extra dependencies for building Git on Ubuntu + if: matrix.targetPlatform == 'ubuntu' run: | sudo apt-get update sudo apt-get install libcurl4-openssl-dev libexpat1-dev gettext - - name: Install extra dependencies for building Git on Ubuntu (x86) - if: matrix.targetPlatform == 'ubuntu' && matrix.arch == 'x86' - run: | - sudo dpkg --add-architecture i386 - sudo apt-get update - sudo apt-get install gcc-i686-linux-gnu binutils-i686-gnu libcurl4-openssl-dev:i386 libssl-dev:i386 zlib1g-dev:i386 gettext - - name: Install extra dependencies for building Git on Ubuntu (arm64) - if: matrix.targetPlatform == 'ubuntu' && matrix.arch == 'arm64' - run: | - sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list - echo "deb [arch=arm64,armhf] http://azure.ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list - echo "deb [arch=arm64,armhf] http://azure.ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list - sudo dpkg --add-architecture arm64 - sudo apt-get update - sudo apt-get install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libcurl4-openssl-dev:arm64 libssl-dev:arm64 zlib1g-dev:arm64 gettext - - name: Install extra dependencies for building Git on Ubuntu (arm) - if: matrix.targetPlatform == 'ubuntu' && matrix.arch == 'arm' - run: | - sudo sed -i "s/^deb/deb [arch=amd64,i386]/g" /etc/apt/sources.list - echo "deb [arch=arm64,armhf] http://azure.ports.ubuntu.com/ $(lsb_release -s -c) main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list - echo "deb [arch=arm64,armhf] http://azure.ports.ubuntu.com/ $(lsb_release -s -c)-updates main universe multiverse restricted" | sudo tee -a /etc/apt/sources.list - sudo dpkg --add-architecture armhf - sudo apt-get update - sudo apt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libcurl4-openssl-dev:armhf libssl-dev:armhf zlib1g-dev:armhf gettext - name: Build (except macOS arm64) if: matrix.targetPlatform != 'macOS' || matrix.arch != 'arm64' shell: bash diff --git a/dependencies.json b/dependencies.json index 868b2aff..532c5e56 100644 --- a/dependencies.json +++ b/dependencies.json @@ -27,24 +27,6 @@ "name": "git-lfs-linux-amd64-v3.3.0.tar.gz", "checksum": "6a4e6bd7d06d5c024bc70c8ee8c9da143ffc37d2646e252a17a6126d30cdebc1" }, - { - "platform": "linux", - "arch": "x86", - "name": "git-lfs-linux-386-v3.3.0.tar.gz", - "checksum": "14415ebafc3ace60f178cd69d4f2e0ed42dbbf32cb2aba80e46ec3c8f7c1401f" - }, - { - "platform": "linux", - "arch": "arm64", - "name": "git-lfs-linux-arm64-v3.3.0.tar.gz", - "checksum": "e97c477981a9b6a40026cadc1bf005541d973fc32df2de2f398643b15df6b5c6" - }, - { - "platform": "linux", - "arch": "arm", - "name": "git-lfs-linux-arm-v3.3.0.tar.gz", - "checksum": "df8b24cf7ff6a2f105dd1a3d0a4990c53980272ea94da67d854921e21bc5444c" - }, { "platform": "windows", "arch": "x86", diff --git a/script/build-macos.sh b/script/build-macos.sh index be14a768..d2b99202 100755 --- a/script/build-macos.sh +++ b/script/build-macos.sh @@ -7,7 +7,7 @@ set -eu -o pipefail MACOSX_BUILD_VERSION="10.9" -if [ "$TARGET_ARCH" = "x64" ]; then +if [ "$TARGET_ARCH" = "64" ]; then HOST_CPU=x86_64 TARGET_CFLAGS="-target x86_64-apple-darwin" GOARCH=amd64 diff --git a/script/build-ubuntu.sh b/script/build-ubuntu.sh index 17f03cb0..9f200633 100755 --- a/script/build-ubuntu.sh +++ b/script/build-ubuntu.sh @@ -20,39 +20,15 @@ if [[ -z "${CURL_INSTALL_DIR}" ]]; then exit 1 fi -case "$TARGET_ARCH" in - "x64") - DEPENDENCY_ARCH="amd64" - export CC="gcc" - STRIP="strip" - HOST="" - TARGET="" ;; - "x86") - DEPENDENCY_ARCH="x86" - export CC="i686-linux-gnu-gcc" - STRIP="i686-gnu-strip" - HOST="--host=i686-linux-gnu" - TARGET="--target=i686-linux-gnu" ;; - "arm64") - DEPENDENCY_ARCH="arm64" - export CC="aarch64-linux-gnu-gcc" - STRIP="aarch64-linux-gnu-strip" - HOST="--host=aarch64-linux-gnu" - TARGET="--target=aarch64-linux-gnu" ;; - "arm") - DEPENDENCY_ARCH="arm" - export CC="arm-linux-gnueabihf-gcc" - STRIP="arm-linux-gnueabihf-strip" - HOST="--host=arm-linux-gnueabihf" - TARGET="--target=arm-linux-gnueabihf" ;; - *) - exit 1 ;; -esac +if [ "$TARGET_ARCH" = "64" ]; then + DEPENDENCY_ARCH="amd64" +else + DEPENDENCY_ARCH="x86" +fi CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" GIT_LFS_VERSION="$(jq --raw-output '.["git-lfs"].version[1:]' dependencies.json)" GIT_LFS_CHECKSUM="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .checksum" dependencies.json)" -GIT_LFS_FILENAME="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"linux\") | .name" dependencies.json)" # shellcheck source=script/compute-checksum.sh source "$CURRENT_DIR/compute-checksum.sh" @@ -70,7 +46,7 @@ tar -xf $CURL_FILE ( cd $CURL_FILE_NAME || exit 1 -./configure --prefix="$CURL_INSTALL_DIR" "$HOST" "$TARGET" +./configure --prefix="$CURL_INSTALL_DIR" make install ) echo " -- Building git at $SOURCE to $DESTINATION" @@ -79,12 +55,12 @@ echo " -- Building git at $SOURCE to $DESTINATION" cd "$SOURCE" || exit 1 make clean make configure -CFLAGS='-Wall -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE' \ - LDFLAGS='-Wl,-Bsymbolic-functions -Wl,-z,relro' ac_cv_iconv_omits_bom=no ac_cv_fread_reads_directories=no ac_cv_snprintf_returns_bogus=no \ - ./configure $HOST \ +CC='gcc' \ + CFLAGS='-Wall -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE' \ + LDFLAGS='-Wl,-Bsymbolic-functions -Wl,-z,relro' \ + ./configure \ --with-curl="$CURL_INSTALL_DIR" \ --prefix=/ -sed -i "s/STRIP = strip/STRIP = $STRIP/" Makefile DESTDIR="$DESTINATION" \ NO_TCLTK=1 \ NO_GETTEXT=1 \ @@ -96,7 +72,7 @@ DESTDIR="$DESTINATION" \ if [[ "$GIT_LFS_VERSION" ]]; then echo "-- Bundling Git LFS" GIT_LFS_FILE=git-lfs.tar.gz - GIT_LFS_URL="https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/${GIT_LFS_FILENAME}" + GIT_LFS_URL="https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-amd64-v${GIT_LFS_VERSION}.tar.gz" echo "-- Downloading from $GIT_LFS_URL" curl -sL -o $GIT_LFS_FILE "$GIT_LFS_URL" COMPUTED_SHA256=$(compute_checksum $GIT_LFS_FILE) @@ -152,13 +128,12 @@ check_static_linking "$DESTINATION" set -eu -o pipefail -if [ "$TARGET_ARCH" == "x64" ]; then -( echo "-- Testing clone operation with generated binary" TEMP_CLONE_DIR=/tmp/clones mkdir -p $TEMP_CLONE_DIR +( cd "$DESTINATION/bin" || exit 1 ./git --version GIT_CURL_VERBOSE=1 \ @@ -168,6 +143,5 @@ GIT_CURL_VERBOSE=1 \ PREFIX="$DESTINATION" \ ./git clone https://github.com/git/git.github.io "$TEMP_CLONE_DIR/git.github.io" ) -fi set +eu diff --git a/script/build-win32.sh b/script/build-win32.sh index c493ddce..c84af434 100755 --- a/script/build-win32.sh +++ b/script/build-win32.sh @@ -10,7 +10,7 @@ if [[ -z "${DESTINATION}" ]]; then exit 1 fi -if [ "$TARGET_ARCH" = "x64" ]; then +if [ "$TARGET_ARCH" = "64" ]; then DEPENDENCY_ARCH="amd64" MINGW_DIR="mingw64" else @@ -20,7 +20,6 @@ fi GIT_LFS_VERSION=$(jq --raw-output ".[\"git-lfs\"].version[1:]" dependencies.json) GIT_LFS_CHECKSUM="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .checksum" dependencies.json)" -GIT_LFS_FILENAME="$(jq --raw-output ".\"git-lfs\".files[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .name" dependencies.json)" GIT_FOR_WINDOWS_URL=$(jq --raw-output ".git.packages[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .url" dependencies.json) GIT_FOR_WINDOWS_CHECKSUM=$(jq --raw-output ".git.packages[] | select(.arch == \"$DEPENDENCY_ARCH\" and .platform == \"windows\") | .checksum" dependencies.json) @@ -48,7 +47,8 @@ if [[ "$GIT_LFS_VERSION" ]]; then # download Git LFS, verify its the right contents, and unpack it echo "-- Bundling Git LFS" GIT_LFS_FILE=git-lfs.zip - GIT_LFS_URL="https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/${GIT_LFS_FILENAME}" + if [ "$TARGET_ARCH" -eq "64" ]; then GIT_LFS_ARCH="amd64"; else GIT_LFS_ARCH="386"; fi + GIT_LFS_URL="https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-windows-${GIT_LFS_ARCH}-v${GIT_LFS_VERSION}.zip" echo "-- Downloading from $GIT_LFS_URL" curl -sL -o $GIT_LFS_FILE "$GIT_LFS_URL" COMPUTED_SHA256=$(compute_checksum $GIT_LFS_FILE) diff --git a/script/check-static-linking.sh b/script/check-static-linking.sh index d22cbd51..6cba81a6 100644 --- a/script/check-static-linking.sh +++ b/script/check-static-linking.sh @@ -11,7 +11,7 @@ check_static_linking_file() { # ermagherd there's two whitespace characters between 'LSB' and 'executable' # when running this on Travis - why is everything so terrible? - if file "$1" | grep -q 'ELF [36][24]-bit LSB'; then + if file "$1" | grep -q 'ELF 64-bit LSB'; then if readelf -d "$1" | grep -q 'Shared library'; then echo "File: $file" # this is done twice rather than storing in a bash variable because diff --git a/script/package.sh b/script/package.sh index 9063ef08..f37f9bb0 100755 --- a/script/package.sh +++ b/script/package.sh @@ -34,14 +34,16 @@ if ! [ -d "$DESTINATION" ]; then fi if [ "$TARGET_PLATFORM" == "ubuntu" ]; then - GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-ubuntu-$TARGET_ARCH.tar.gz" - LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-ubuntu-$TARGET_ARCH.lzma" + GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-ubuntu.tar.gz" + LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-ubuntu.lzma" elif [ "$TARGET_PLATFORM" == "macOS" ]; then - GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-macOS-$TARGET_ARCH.tar.gz" - LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-macOS-$TARGET_ARCH.lzma" + if [ "$TARGET_ARCH" -eq "64" ]; then ARCH="x64"; else ARCH="arm64"; fi + GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-macOS-$ARCH.tar.gz" + LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-macOS-$ARCH.lzma" elif [ "$TARGET_PLATFORM" == "win32" ]; then - GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-windows-$TARGET_ARCH.tar.gz" - LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-windows-$TARGET_ARCH.lzma" + if [ "$TARGET_ARCH" -eq "64" ]; then ARCH="x64"; else ARCH="x86"; fi + GZIP_FILE="dugite-native-$VERSION-$BUILD_HASH-windows-$ARCH.tar.gz" + LZMA_FILE="dugite-native-$VERSION-$BUILD_HASH-windows-$ARCH.lzma" else echo "Unable to package Git for platform $TARGET_PLATFORM" exit 1 diff --git a/script/update-git-lfs.ts b/script/update-git-lfs.ts index 288e686c..ba4cb7a9 100644 --- a/script/update-git-lfs.ts +++ b/script/update-git-lfs.ts @@ -27,12 +27,6 @@ function getArch(fileName: string) { if (fileName.match(/-386-/)) { return 'x86' } - if (fileName.match(/-arm64-/)) { - return 'arm64' - } - if (fileName.match(/-arm-/)) { - return 'arm' - } throw new Error(`Unable to find arch for file: ${fileName}`) } @@ -88,9 +82,6 @@ async function run(): Promise { const files = [ `git-lfs-linux-amd64-${version}.tar.gz`, - `git-lfs-linux-386-${version}.tar.gz`, - `git-lfs-linux-arm64-${version}.tar.gz`, - `git-lfs-linux-arm-${version}.tar.gz`, `git-lfs-windows-386-${version}.zip`, `git-lfs-windows-amd64-${version}.zip`, ]