Skip to content

Commit 204d196

Browse files
vdyedscho
authored andcommitted
Merge pull request #472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 065b160 + 56b9b46 commit 204d196

4 files changed

Lines changed: 72 additions & 7 deletions

File tree

.github/macos-installer/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ BUILD_CODE := intel-$(ARCH_CODE)
2121
BUILD_DIR := $(GITHUB_WORKSPACE)/payload
2222
DESTDIR := $(PWD)/stage/git-$(BUILD_CODE)-$(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
.PHONY: image pkg payload

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

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ jobs:
332332
echo "${{ needs.prereqs.outputs.tag_version }}" >>git/version
333333
make -C git -j$(sysctl -n hw.physicalcpu) GIT-VERSION-FILE dist dist-doc
334334
335+
export GIT_BUILT_FROM_COMMIT=$(gunzip -c git/git-$VERSION.tar.gz | git get-tar-commit-id) ||
336+
die "Could not determine commit for build"
337+
335338
# Extract tarballs
336339
mkdir payload manpages
337340
tar -xvf git/git-$VERSION.tar.gz -C payload
@@ -690,9 +693,59 @@ jobs:
690693
path: signed
691694
# End build & sign Ubuntu package
692695

696+
# Validate installers
697+
validate-installers:
698+
name: Validate installers
699+
strategy:
700+
matrix:
701+
component:
702+
- os: ubuntu-latest
703+
artifact: deb-package-signed
704+
command: git
705+
- os: macos-latest
706+
artifact: osx-signed-pkg
707+
command: git
708+
- os: windows-latest
709+
artifact: win-installer-x86_64
710+
command: $PROGRAMFILES\Git\cmd\git.exe
711+
runs-on: ${{ matrix.component.os }}
712+
needs: [prereqs, windows_artifacts, osx_publish_dmg, ubuntu_sign-artifacts]
713+
steps:
714+
- name: Download artifacts
715+
uses: actions/download-artifact@v2
716+
with:
717+
name: ${{ matrix.component.artifact }}
718+
719+
- name: Install Windows
720+
if: contains(matrix.component.os, 'windows')
721+
shell: pwsh
722+
run: |
723+
$exePath = Get-ChildItem -Path ./*.exe | %{$_.FullName}
724+
Start-Process -Wait -FilePath "$exePath" -ArgumentList "/SILENT /VERYSILENT /NORESTART /SUPPRESSMSGBOXES /ALLOWDOWNGRADE=1"
725+
726+
- name: Install Linux
727+
if: contains(matrix.component.os, 'ubuntu')
728+
run: |
729+
debpath=$(find ./*.deb)
730+
sudo apt install $debpath
731+
732+
- name: Install macOS
733+
if: contains(matrix.component.os, 'macos')
734+
run: |
735+
pkgpath=$(find ./*.pkg)
736+
sudo installer -pkg $pkgpath -target /
737+
738+
- name: Validate
739+
shell: bash
740+
run: |
741+
"${{ matrix.component.command }}" --version | sed 's/git version //' >actual
742+
echo ${{ needs.prereqs.outputs.tag_version }} >expect
743+
cmp expect actual || exit 1
744+
# End validate installers
745+
693746
create-github-release:
694747
runs-on: ubuntu-latest
695-
needs: [prereqs, windows_artifacts, osx_publish_dmg, ubuntu_sign-artifacts]
748+
needs: [validate-installers]
696749
if: |
697750
success() ||
698751
(needs.ubuntu_sign-artifacts.result == 'skipped' &&

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/fuzz_corpora
22
/GIT-BUILD-DIR
33
/GIT-BUILD-OPTIONS
4+
/GIT-BUILT-FROM-COMMIT
45
/GIT-CFLAGS
56
/GIT-LDFLAGS
67
/GIT-PREFIX

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ include shared.mak
321321
# Define GIT_USER_AGENT if you want to change how git identifies itself during
322322
# network interactions. The default is "git/$(GIT_VERSION)".
323323
#
324+
# Define GIT_BUILT_FROM_COMMIT if you want to force the commit hash identified
325+
# in 'git version --build-options' to a specific value. The default is the
326+
# commit hash of the current HEAD.
327+
#
324328
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
325329
# (defaults to "man") if you want to have a different default when
326330
# "git help" is called without a parameter specifying the format.
@@ -2343,6 +2347,15 @@ GIT-USER-AGENT: FORCE
23432347
echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
23442348
fi
23452349

2350+
GIT_BUILT_FROM_COMMIT = $(eval GIT_BUILT_FROM_COMMIT := $$(shell \
2351+
GIT_CEILING_DIRECTORIES="$$(CURDIR)/.." \
2352+
git rev-parse -q --verify HEAD 2>/dev/null))$(GIT_BUILT_FROM_COMMIT)
2353+
GIT-BUILT-FROM-COMMIT: FORCE
2354+
@if test x'$(GIT_BUILT_FROM_COMMIT)' != x"`cat GIT-BUILT-FROM-COMMIT 2>/dev/null`" ; then \
2355+
echo >&2 " * new built-from commit"; \
2356+
echo '$(GIT_BUILT_FROM_COMMIT)' >GIT-BUILT-FROM-COMMIT; \
2357+
fi
2358+
23462359
ifdef DEFAULT_HELP_FORMAT
23472360
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
23482361
endif
@@ -2457,13 +2470,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
24572470
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
24582471
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
24592472

2460-
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
2473+
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT GIT-BUILT-FROM-COMMIT
24612474
version.sp version.s version.o: EXTRA_CPPFLAGS = \
24622475
'-DGIT_VERSION="$(GIT_VERSION)"' \
24632476
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
2464-
'-DGIT_BUILT_FROM_COMMIT="$(shell \
2465-
GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2466-
git rev-parse -q --verify HEAD 2>/dev/null)"'
2477+
'-DGIT_BUILT_FROM_COMMIT="$(GIT_BUILT_FROM_COMMIT)"'
24672478

24682479
$(BUILT_INS): git$X
24692480
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -3631,7 +3642,7 @@ dist: git-archive$(X) configure
36313642
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
36323643
./git-archive --format=tar \
36333644
$(GIT_ARCHIVE_EXTRA_FILES) \
3634-
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
3645+
--prefix=$(GIT_TARNAME)/ HEAD > $(GIT_TARNAME).tar
36353646
@$(RM) -r .dist-tmp-dir
36363647
gzip -f -9 $(GIT_TARNAME).tar
36373648

0 commit comments

Comments
 (0)