Skip to content

Commit c01c7a9

Browse files
vdyedscho
authored andcommitted
Merge pull request #472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 76e7de6 + af69221 commit c01c7a9

File tree

3 files changed

+76
-2
lines changed

3 files changed

+76
-2
lines changed

.github/macos-installer/Makefile

Lines changed: 1 addition & 1 deletion
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

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,9 @@ jobs:
508508
509509
make -C git -j$(sysctl -n hw.physicalcpu) GIT-VERSION-FILE dist dist-doc
510510
511+
export GIT_BUILT_FROM_COMMIT=$(gunzip -c git/git-$VERSION.tar.gz | git get-tar-commit-id) ||
512+
die "Could not determine commit for build"
513+
511514
# Extract tarballs
512515
mkdir payload manpages
513516
tar -xvf git/git-$VERSION.tar.gz -C payload
@@ -708,12 +711,83 @@ jobs:
708711
*.deb
709712
# End build and sign Debian package
710713

714+
# Validate installers
715+
validate-installers:
716+
name: Validate installers
717+
strategy:
718+
matrix:
719+
component:
720+
- os: ubuntu-latest
721+
artifact: linux-artifacts
722+
command: git
723+
- os: macos-latest
724+
artifact: macos-artifacts
725+
command: git
726+
- os: macos-latest
727+
artifact: macos-artifacts
728+
command: git
729+
- os: windows-latest
730+
artifact: win-installer-x86_64
731+
command: $PROGRAMFILES\Git\cmd\git.exe
732+
- os: windows-11-arm
733+
artifact: win-installer-aarch64
734+
command: $PROGRAMFILES\Git\cmd\git.exe
735+
runs-on: ${{ matrix.component.os }}
736+
needs: [prereqs, windows_artifacts, create-macos-artifacts, create-linux-artifacts]
737+
steps:
738+
- name: Download artifacts
739+
uses: actions/download-artifact@v4
740+
with:
741+
name: ${{ matrix.component.artifact }}
742+
743+
- name: Install Windows
744+
if: contains(matrix.component.artifact, 'win-installer')
745+
shell: pwsh
746+
run: |
747+
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
748+
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
749+
750+
- name: Install Linux
751+
if: contains(matrix.component.artifact, 'linux')
752+
run: |
753+
debpath=$(find ./*.deb)
754+
sudo apt install $debpath
755+
756+
- name: Install macOS
757+
if: contains(matrix.component.artifact, 'macos')
758+
run: |
759+
# avoid letting Homebrew's `git` in `/opt/homebrew/bin` override `/usr/local/bin/git`
760+
arch="$(uname -m)"
761+
test arm64 != "$arch" ||
762+
brew uninstall git
763+
764+
pkgpath=$(find ./*universal*.pkg)
765+
sudo installer -pkg $pkgpath -target /
766+
767+
- name: Validate
768+
shell: bash
769+
run: |
770+
"${{ matrix.component.command }}" --version | sed 's/git version //' >actual
771+
echo ${{ needs.prereqs.outputs.tag_version }} >expect
772+
cmp expect actual || exit 1
773+
774+
- name: Validate universal binary CPU architecture
775+
if: contains(matrix.component.os, 'macos')
776+
shell: bash
777+
run: |
778+
set -ex
779+
git version --build-options >actual
780+
cat actual
781+
grep "cpu: $(uname -m)" actual
782+
# End validate installers
783+
711784
create-github-release:
712785
runs-on: ubuntu-latest
713786
permissions:
714787
contents: write
715788
id-token: write # required for Azure login via OIDC
716789
needs:
790+
- validate-installers
717791
- create-linux-artifacts
718792
- create-macos-artifacts
719793
- windows_artifacts

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3761,7 +3761,7 @@ dist: git-archive$(X) configure
37613761
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
37623762
./git-archive --format=tar \
37633763
$(GIT_ARCHIVE_EXTRA_FILES) \
3764-
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
3764+
--prefix=$(GIT_TARNAME)/ HEAD > $(GIT_TARNAME).tar
37653765
@$(RM) -r .dist-tmp-dir
37663766
gzip -f -9 $(GIT_TARNAME).tar
37673767

0 commit comments

Comments
 (0)