Skip to content

git: build /git-bash.exe & /git-cmd.exe, too #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 26, 2015

Conversation

dscho
Copy link
Member

@dscho dscho commented Mar 25, 2015

And while at it, also install the /cmd/ files.

Signed-off-by: Johannes Schindelin [email protected]

@dscho
Copy link
Member Author

dscho commented Mar 25, 2015

This requires git-for-windows/git#42 to be merged first.

@dscho
Copy link
Member Author

dscho commented Mar 25, 2015

Hmm... strip git-bash.exe claims to result in a segmentation fault because the file is truncated... Needs more investigation, apparently.

@dscho
Copy link
Member Author

dscho commented Mar 25, 2015

Hmm... strip git-bash.exe claims to result in a segmentation fault because the file is truncated... Needs more investigation, apparently.

Conundrum solved: the BeginUpdateResource()/UpdateResource()/EndUpdateResource() function family does not know, nor care, about the symbols that gcc puts into the .exe file. As a consequence, the symbol section gets corrupted and strip.exe says "file truncated" or even results in a segmentation fault.

To help this, I just added the -s -O2 flags, which fixes the issue here.

gcc -DMAGIC_RESOURCE -mwindows -s -O2 -Wall -o edit-res.exe \
compat/win32/git-wrapper.c git.res -lshlwapi &&
cp edit-res.exe git-bash.exe &&
strip git-bash.exe &&

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

dscho added 3 commits March 26, 2015 09:46
We actually never released v2.3.4.windows.1... but the tag exists, so
let's just go straight to release 2.

The difference between v2.3.4.windows.1 and v2.3.4.windows.2 is that the
Git wrapper now supports MSys2, too, and even allows us to compile a
`git-bash.exe` and a `git-cmd.exe` from the same source code.

Signed-off-by: Johannes Schindelin <[email protected]>
In the MSys2 context, it makes most sense to run the Git Bash in a
mintty terminal emulator (it is a mere 170kB executable based on the
same msys2-runtime that the Bash already uses).

And while at it, also install the /cmd/ files: adding the `/cmd/`
directory to the `PATH` will make Git available without cluttering the
PATH with tons of `.dll` files that could possibly interfere with other
`.exe` files on the PATH.

Note: we have to be careful not to include symbols into the executables;
GCC wants to put symbols into them that are however ignored by Win32
API's resource update mechanism. Thus, after resource editing, the
symbols section is corrupted and in the best case, strip.exe (executed
as part of Pacman's makepkg) burps a "file truncated", in the worst case
it crashes with a segmentation fault.

Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this pull request Mar 26, 2015
git: build /git-bash.exe & /git-cmd.exe, too
@dscho dscho merged commit 2a3c089 into git-for-windows:master Mar 26, 2015
@dscho dscho deleted the git-bash branch March 26, 2015 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants