Skip to content

Commit d108989

Browse files
vdyedscho
authored andcommitted
Merge pull request #472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 9e88f52 + 3ad2e4b commit d108989

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
@@ -26,7 +26,7 @@ VERSION := $(shell echo $(ORIGINAL_VERSION) | sed 's/-rc/.rc/g')
2626
BUILD_DIR := $(GITHUB_WORKSPACE)/payload
2727
DESTDIR := $(PWD)/stage/git-$(ARCH_UNIV)-$(VERSION)
2828
ARTIFACTDIR := build-artifacts
29-
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)
29+
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)
3030
CORES := $(shell bash -c "sysctl hw.ncpu | awk '{print \$$2}'")
3131

3232
# Guard against environment variables

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

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ jobs:
511511
512512
make -C git -j$(sysctl -n hw.physicalcpu) GIT-VERSION-FILE dist dist-doc
513513
514+
export GIT_BUILT_FROM_COMMIT=$(gunzip -c git/git-$BUILD_VERSION.tar.gz | git get-tar-commit-id) ||
515+
die "Could not determine commit for build"
516+
514517
# Extract tarballs
515518
mkdir payload manpages
516519
tar -xvf git/git-$BUILD_VERSION.tar.gz -C payload
@@ -709,12 +712,83 @@ jobs:
709712
*.deb
710713
# End build and sign Debian package
711714

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

Makefile

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

0 commit comments

Comments
 (0)