Skip to content

Commit 48ed842

Browse files
vdyedscho
authored andcommitted
Merge pull request #472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 2331626 + 6f1ee27 commit 48ed842

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

.github/macos-installer/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GIT_PREFIX := $(PREFIX)/git
2121
BUILD_DIR := $(GITHUB_WORKSPACE)/payload
2222
DESTDIR := $(PWD)/stage/git-$(ARCH_UNIV)-$(VERSION)
2323
ARTIFACTDIR := build-artifacts
24-
SUBMAKE := $(MAKE) C_INCLUDE_PATH="$(C_INCLUDE_PATH)" CPLUS_INCLUDE_PATH="$(CPLUS_INCLUDE_PATH)" LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" TARGET_FLAGS="$(TARGET_FLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NO_GETTEXT=1 NO_DARWIN_PORTS=1 prefix=$(GIT_PREFIX) DESTDIR=$(DESTDIR)
24+
SUBMAKE := $(MAKE) C_INCLUDE_PATH="$(C_INCLUDE_PATH)" CPLUS_INCLUDE_PATH="$(CPLUS_INCLUDE_PATH)" LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" TARGET_FLAGS="$(TARGET_FLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NO_GETTEXT=1 NO_DARWIN_PORTS=1 prefix=$(GIT_PREFIX) GIT_BUILT_FROM_COMMIT="$(GIT_BUILT_FROM_COMMIT)" DESTDIR=$(DESTDIR)
2525
CORES := $(shell bash -c "sysctl hw.ncpu | awk '{print \$$2}'")
2626

2727
# Guard against environment variables

.github/workflows/build-git-installers.yml

+74
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ jobs:
446446
447447
make -C git -j$(sysctl -n hw.physicalcpu) GIT-VERSION-FILE dist dist-doc
448448
449+
export GIT_BUILT_FROM_COMMIT=$(gunzip -c git/git-$VERSION.tar.gz | git get-tar-commit-id) ||
450+
die "Could not determine commit for build"
451+
449452
# Extract tarballs
450453
mkdir payload manpages
451454
tar -xvf git/git-$VERSION.tar.gz -C payload
@@ -640,12 +643,83 @@ jobs:
640643
*.deb
641644
# End build and sign Debian package
642645

646+
# Validate installers
647+
validate-installers:
648+
name: Validate installers
649+
strategy:
650+
matrix:
651+
component:
652+
- os: ubuntu-latest
653+
artifact: linux-artifacts
654+
command: git
655+
- os: macos-latest-xl-arm64
656+
artifact: macos-artifacts
657+
command: git
658+
- os: macos-latest
659+
artifact: macos-artifacts
660+
command: git
661+
- os: windows-latest
662+
artifact: win-installer-x86_64
663+
command: $PROGRAMFILES\Git\cmd\git.exe
664+
- os: ['self-hosted', '1ES.Pool=github-arm64-pool']
665+
artifact: win-installer-aarch64
666+
command: $PROGRAMFILES\Git\cmd\git.exe
667+
runs-on: ${{ matrix.component.os }}
668+
needs: [prereqs, windows_artifacts, create-macos-artifacts, create-linux-artifacts]
669+
steps:
670+
- name: Download artifacts
671+
uses: actions/download-artifact@v4
672+
with:
673+
name: ${{ matrix.component.artifact }}
674+
675+
- name: Install Windows
676+
if: contains(matrix.component.artifact, 'win-installer')
677+
shell: pwsh
678+
run: |
679+
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
680+
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
681+
682+
- name: Install Linux
683+
if: contains(matrix.component.artifact, 'linux')
684+
run: |
685+
debpath=$(find ./*.deb)
686+
sudo apt install $debpath
687+
688+
- name: Install macOS
689+
if: contains(matrix.component.artifact, 'macos')
690+
run: |
691+
# avoid letting Homebrew's `git` in `/opt/homebrew/bin` override `/usr/local/bin/git`
692+
arch="$(uname -m)"
693+
test arm64 != "$arch" ||
694+
brew uninstall git
695+
696+
pkgpath=$(find ./*universal*.pkg)
697+
sudo installer -pkg $pkgpath -target /
698+
699+
- name: Validate
700+
shell: bash
701+
run: |
702+
"${{ matrix.component.command }}" --version | sed 's/git version //' >actual
703+
echo ${{ needs.prereqs.outputs.tag_version }} >expect
704+
cmp expect actual || exit 1
705+
706+
- name: Validate universal binary CPU architecture
707+
if: contains(matrix.component.os, 'macos')
708+
shell: bash
709+
run: |
710+
set -ex
711+
git version --build-options >actual
712+
cat actual
713+
grep "cpu: $(uname -m)" actual
714+
# End validate installers
715+
643716
create-github-release:
644717
runs-on: ubuntu-latest
645718
permissions:
646719
contents: write
647720
id-token: write # required for Azure login via OIDC
648721
needs:
722+
- validate-installers
649723
- create-linux-artifacts
650724
- create-macos-artifacts
651725
- windows_artifacts

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3740,7 +3740,7 @@ dist: git-archive$(X) configure
37403740
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
37413741
./git-archive --format=tar \
37423742
$(GIT_ARCHIVE_EXTRA_FILES) \
3743-
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
3743+
--prefix=$(GIT_TARNAME)/ HEAD > $(GIT_TARNAME).tar
37443744
@$(RM) -r .dist-tmp-dir
37453745
gzip -f -9 $(GIT_TARNAME).tar
37463746

0 commit comments

Comments
 (0)