Skip to content

Commit 29c0630

Browse files
vdyedscho
authored andcommitted
Merge pull request #472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 8545373 + d574cc9 commit 29c0630

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
@@ -3,6 +3,7 @@
33
/fuzz-pack-headers
44
/fuzz-pack-idx
55
/GIT-BUILD-OPTIONS
6+
/GIT-BUILT-FROM-COMMIT
67
/GIT-CFLAGS
78
/GIT-LDFLAGS
89
/GIT-PREFIX

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ include shared.mak
402402
# Define GIT_USER_AGENT if you want to change how git identifies itself during
403403
# network interactions. The default is "git/$(GIT_VERSION)".
404404
#
405+
# Define GIT_BUILT_FROM_COMMIT if you want to force the commit hash identified
406+
# in 'git version --build-options' to a specific value. The default is the
407+
# commit hash of the current HEAD.
408+
#
405409
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
406410
# (defaults to "man") if you want to have a different default when
407411
# "git help" is called without a parameter specifying the format.
@@ -2231,6 +2235,15 @@ GIT-USER-AGENT: FORCE
22312235
echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
22322236
fi
22332237

2238+
GIT_BUILT_FROM_COMMIT = $(eval GIT_BUILT_FROM_COMMIT := $$(shell \
2239+
GIT_CEILING_DIRECTORIES="$$(CURDIR)/.." \
2240+
git rev-parse -q --verify HEAD 2>/dev/null))$(GIT_BUILT_FROM_COMMIT)
2241+
GIT-BUILT-FROM-COMMIT: FORCE
2242+
@if test x'$(GIT_BUILT_FROM_COMMIT)' != x"`cat GIT-BUILT-FROM-COMMIT 2>/dev/null`" ; then \
2243+
echo >&2 " * new built-from commit"; \
2244+
echo '$(GIT_BUILT_FROM_COMMIT)' >GIT-BUILT-FROM-COMMIT; \
2245+
fi
2246+
22342247
ifdef DEFAULT_HELP_FORMAT
22352248
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
22362249
endif
@@ -2345,13 +2358,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
23452358
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
23462359
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
23472360

2348-
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
2361+
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT GIT-BUILT-FROM-COMMIT
23492362
version.sp version.s version.o: EXTRA_CPPFLAGS = \
23502363
'-DGIT_VERSION="$(GIT_VERSION)"' \
23512364
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
2352-
'-DGIT_BUILT_FROM_COMMIT="$(shell \
2353-
GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2354-
git rev-parse -q --verify HEAD 2>/dev/null)"'
2365+
'-DGIT_BUILT_FROM_COMMIT="$(GIT_BUILT_FROM_COMMIT)"'
23552366

23562367
$(BUILT_INS): git$X
23572368
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -3436,7 +3447,7 @@ dist: git-archive$(X) configure
34363447
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
34373448
./git-archive --format=tar \
34383449
$(GIT_ARCHIVE_EXTRA_FILES) \
3439-
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
3450+
--prefix=$(GIT_TARNAME)/ HEAD > $(GIT_TARNAME).tar
34403451
@$(RM) -r .dist-tmp-dir
34413452
gzip -f -9 $(GIT_TARNAME).tar
34423453

0 commit comments

Comments
 (0)