Merge branch 'cb/no-tcl86-on-macos'

* cb/no-tcl86-on-macos:
  git-gui: ensure own version of git-gui--askpass is used
  git-gui: honor TCLTK_PATH in git-gui--askpass
  git-gui: retire Git Gui.app
  git-gui: fix dependency of GITGUI_MAIN on generator
  git-gui: remove uname_O in Makefile
maint
Johannes Sixt 2025-08-04 18:27:03 +02:00
commit e3923e3e90
12 changed files with 46 additions and 247 deletions

2
.gitignore vendored
View File

@ -1,8 +1,8 @@
.DS_Store
config.mak
Git Gui.app*
git-gui.tcl
GIT-GUI-BUILD-OPTIONS
GIT-VERSION-FILE
git-gui
git-gui--askpass
lib/tclIndex

View File

@ -4,4 +4,3 @@ GITGUI_RELATIVE=@GITGUI_RELATIVE@
SHELL_PATH=@SHELL_PATH@
TCLTK_PATH=@TCLTK_PATH@
TCL_PATH=@TCL_PATH@
TKEXECUTABLE=@TKEXECUTABLE@

View File

@ -11,7 +11,6 @@ GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN . $@

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')

SCRIPT_SH = git-gui.sh
@ -53,8 +52,6 @@ INSTALL_R0 = $(INSTALL) -m 644 # space is required here
INSTALL_R1 =
INSTALL_X0 = $(INSTALL) -m 755 # space is required here
INSTALL_X1 =
INSTALL_A0 = find # space is required here
INSTALL_A1 = | cpio -pud
INSTALL_L0 = rm -f # space is required here
INSTALL_L1 = && ln # space is required here
INSTALL_L2 =
@ -79,8 +76,6 @@ ifndef V
INSTALL_R1 = && echo ' ' INSTALL 644 `basename $$src` && $(INSTALL) -m 644 $$src
INSTALL_X0 = src=
INSTALL_X1 = && echo ' ' INSTALL 755 `basename $$src` && $(INSTALL) -m 755 $$src
INSTALL_A0 = src=
INSTALL_A1 = && echo ' ' INSTALL ' ' `basename "$$src"` && find "$$src" | cpio -pud

INSTALL_L0 = dst=
INSTALL_L1 = && src=
@ -101,18 +96,6 @@ else
TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH)))
endif

ifeq ($(uname_S),Darwin)
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell echo "$(uname_R)" | awk -F. '{if ($$1 >= 9) print "y"}')_$(shell test -d $(TKFRAMEWORK) || echo n),y_n)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell test -d $(TKFRAMEWORK) || echo n),n)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
endif
endif
TKEXECUTABLE = $(TKFRAMEWORK)/Contents/MacOS/$(shell basename "$(TKFRAMEWORK)" .app)
TKEXECUTABLE_SQ = $(subst ','\'',$(TKEXECUTABLE))
endif

ifeq ($(findstring $(firstword -$(MAKEFLAGS)),s),s)
QUIET_GEN =
endif
@ -130,16 +113,10 @@ libdir_SQ = $(subst ','\'',$(gg_libdir))
exedir = $(dir $(gitexecdir))share/git-gui/lib

GITGUI_RELATIVE :=
GITGUI_MACOSXAPP :=

ifeq ($(exedir),$(gg_libdir))
GITGUI_RELATIVE := 1
endif
ifeq ($(uname_S),Darwin)
ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
GITGUI_MACOSXAPP := YesPlease
endif
endif
ifneq (,$(findstring MINGW,$(uname_S)))
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
NO_MSGFMT=1
@ -148,20 +125,6 @@ endif
GITGUI_RELATIVE := 1
endif

ifdef GITGUI_MACOSXAPP
GITGUI_MAIN := git-gui.tcl

git-gui: generate-macos-wrapper.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
$(QUIET_GEN)$(SHELL_PATH) generate-macos-wrapper.sh "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE

Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS \
macosx/Info.plist \
macosx/git-gui.icns \
macosx/AppMain.tcl \
$(TKEXECUTABLE)
$(QUIET_GEN)$(SHELL_PATH) generate-macos-app.sh . "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
endif

ifdef GITGUI_WINDOWS_WRAPPER
GITGUI_MAIN := git-gui.tcl

@ -169,7 +132,7 @@ git-gui: windows/git-gui.sh
cp $< $@
endif

$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS generate-git-gui.sh
$(QUIET_GEN)$(SHELL_PATH) generate-git-gui.sh "$<" "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE

XGETTEXT ?= xgettext
@ -206,18 +169,17 @@ GIT-GUI-BUILD-OPTIONS: FORCE
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@TCLTK_PATH@|$(TCLTK_PATH_SQ)|' \
-e 's|@TCL_PATH@|$(TCL_PATH_SQ)|' \
-e 's|@TKEXECUTABLE@|$(TKEXECUTABLE_SQ)|' \
$@.in >$@+
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi

ifdef GITGUI_MACOSXAPP
all:: git-gui Git\ Gui.app
endif
git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh
$(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS

ifdef GITGUI_WINDOWS_WRAPPER
all:: git-gui
endif
all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES)

install: all
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
@ -229,10 +191,6 @@ ifdef GITGUI_WINDOWS_WRAPPER
endif
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(INSTALL_D1)
$(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)'
ifdef GITGUI_MACOSXAPP
$(QUIET)$(INSTALL_A0)'Git Gui.app' $(INSTALL_A1) '$(DESTDIR_SQ)$(libdir_SQ)'
$(QUIET)$(INSTALL_X0)git-gui.tcl $(INSTALL_X1) '$(DESTDIR_SQ)$(libdir_SQ)'
endif
$(QUIET)$(foreach p,$(ALL_LIBFILES) $(NONTCL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(INSTALL_D1)
$(QUIET)$(foreach p,$(ALL_MSGFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true
@ -247,10 +205,6 @@ ifdef GITGUI_WINDOWS_WRAPPER
endif
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(libdir_SQ)'
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/tclIndex $(REMOVE_F1)
ifdef GITGUI_MACOSXAPP
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)/Git Gui.app' $(REMOVE_F1)
$(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/git-gui.tcl $(REMOVE_F1)
endif
$(QUIET)$(foreach p,$(ALL_LIBFILES) $(NONTCL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
$(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(msgsdir_SQ)'
$(QUIET)$(foreach p,$(ALL_MSGFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true
@ -264,11 +218,8 @@ dist-version: GIT-VERSION-FILE
@sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version

clean::
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
$(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE)
$(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
ifdef GITGUI_MACOSXAPP
$(RM_RF) 'Git Gui.app'* git-gui
endif
ifdef GITGUI_WINDOWS_WRAPPER
$(RM_RF) git-gui
endif

View File

@ -1,30 +0,0 @@
#!/bin/sh

set -e

SOURCE_DIR="$1"
OUTPUT="$2"
BUILD_OPTIONS="$3"
VERSION_FILE="$4"

. "$BUILD_OPTIONS"
. "$VERSION_FILE"

rm -rf "$OUTPUT" "$OUTPUT+"

mkdir -p "$OUTPUT+/Contents/MacOS"
mkdir -p "$OUTPUT+/Contents/Resources/Scripts"

cp "$TKEXECUTABLE" "$OUTPUT+/Contents/MacOS"
cp "$SOURCE_DIR/macosx/git-gui.icns" "$OUTPUT+/Contents/Resources"
sed \
-e "s/@@GITGUI_VERSION@@/$GITGUI_VERSION/g" \
-e "s/@@GITGUI_TKEXECUTABLE@@/$(basename "$TKEXECUTABLE")/g" \
"$SOURCE_DIR/macosx/Info.plist" \
>"$OUTPUT+/Contents/Info.plist"
sed \
-e "s|@@gitexecdir@@|$GITGUI_GITEXECDIR|" \
-e "s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
"$SOURCE_DIR/macosx/AppMain.tcl" \
>"$OUTPUT+/Contents/Resources/Scripts/AppMain.tcl"
mv "$OUTPUT+" "$OUTPUT"

View File

@ -1,35 +0,0 @@
#!/bin/sh

set -e

if test "$#" -ne 3
then
echo >&2 "usage: $0 <OUTPUT> <BUILD_OPTIONS> <VERSION_FILE>"
exit 1
fi

OUTPUT="$1"
BUILD_OPTIONS="$2"
VERSION_FILE="$3"

. "$BUILD_OPTIONS"

rm -f "$OUTPUT" "$OUTPUT+"

(
echo "#!$SHELL_PATH"
cat "$BUILD_OPTIONS" "$VERSION_FILE"
cat <<-'EOF'
if test "z$*" = zversion ||
test "z$*" = z--version
then
echo "git-gui version $GITGUI_VERSION"
else
libdir="${GIT_GUI_LIB_DIR:-$GITGUI_LIBDIR}"
exec "$libdir/Git Gui.app/Contents/MacOS/$(basename "$TKEXECUTABLE")" "$0" "$@"
fi
EOF
) >"$OUTPUT+"

chmod +x "$OUTPUT+"
mv "$OUTPUT+" "$OUTPUT"

22
generate-script.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh

set -e

if test $# -ne 3
then
echo >&2 "USAGE: $0 <OUTPUT> <INPUT> <GIT-GUI-BUILD-OPTIONS>"
exit 1
fi

OUTPUT="$1"
INPUT="$2"
BUILD_OPTIONS="$3"

. "$BUILD_OPTIONS"

sed \
-e "1s|#!.*/sh|#!$SHELL_PATH|" \
-e "1,3s|^exec wish|exec '$TCLTK_PATH'|" \
"$INPUT" >"$OUTPUT"

chmod a+x "$OUTPUT"

View File

@ -1126,9 +1126,11 @@ citool {
## execution environment

# Suggest our implementation of askpass, if none is set
set argv0dir [file dirname [file normalize $::argv0]]
if {![info exists env(SSH_ASKPASS)]} {
set env(SSH_ASKPASS) [file join [git --exec-path] git-gui--askpass]
set env(SSH_ASKPASS) [file join $argv0dir git-gui--askpass]
}
unset argv0dir

######################################################################
##

View File

@ -1,29 +0,0 @@
set gitexecdir {@@gitexecdir@@}
if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
set gitguilib $::env(GIT_GUI_LIB_DIR)
} else {
set gitguilib {@@GITGUI_LIBDIR@@}
}

set env(PATH) "$gitexecdir:$env(PATH)"

if {[string first -psn [lindex $argv 0]] == 0} {
lset argv 0 [file join $gitexecdir git-gui]
}

if {[file tail [lindex $argv 0]] eq {gitk}} {
set argv0 [lindex $argv 0]
set AppMain_source $argv0
} else {
set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]
set AppMain_source [file join $gitguilib git-gui.tcl]
if {[info exists env(PWD)]} {
cd $env(PWD)
} elseif {[pwd] eq {/}} {
cd $env(HOME)
}
}

unset gitexecdir gitguilib
set argv [lrange $argv 1 end]
source $AppMain_source

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>@@GITGUI_TKEXECUTABLE@@</string>
<key>CFBundleGetInfoString</key>
<string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string>
<key>CFBundleIconFile</key>
<string>git-gui.icns</string>
<key>CFBundleIdentifier</key>
<string>cz.or.repo.git-gui</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Git Gui</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@@GITGUI_VERSION@@</string>
<key>CFBundleSignature</key>
<string>GITg</string>
<key>CFBundleVersion</key>
<string>@@GITGUI_VERSION@@</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

Binary file not shown.

View File

@ -19,17 +19,6 @@ build_options_config.set_quoted('GITGUI_LIBDIR', get_option('prefix') / get_opti
build_options_config.set_quoted('SHELL_PATH', fs.as_posix(shell.full_path()))
build_options_config.set_quoted('TCLTK_PATH', fs.as_posix(wish.full_path()))
build_options_config.set_quoted('TCL_PATH', fs.as_posix(tclsh.full_path()))
if target_machine.system() == 'darwin'
tkexecutables = [
'/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish',
'/System/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish',
'/System/Library/Frameworks/Tk.framework/Resources/Wish Shell.app/Contents/MacOS/Wish Shell',
]
tkexecutable = find_program(tkexecutables)
build_options_config.set_quoted('TKEXECUTABLE', tkexecutable.full_path())
else
build_options_config.set('TKEXECUTABLE', '')
endif

build_options = configure_file(
input: 'GIT-GUI-BUILD-OPTIONS.in',
@ -49,14 +38,6 @@ version_file = custom_target(
build_always_stale: true,
)

configure_file(
input: 'git-gui--askpass',
output: 'git-gui--askpass',
copy: true,
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)

gitgui_main = 'git-gui'
gitgui_main_install_dir = get_option('libexecdir') / 'git-core'

@ -70,54 +51,22 @@ if target_machine.system() == 'windows'
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)
elif target_machine.system() == 'darwin'
gitgui_main = 'git-gui.tcl'
gitgui_main_install_dir = get_option('datadir') / 'git-gui/lib'

custom_target(
output: 'git-gui',
command: [
shell,
meson.current_source_dir() / 'generate-macos-wrapper.sh',
'@OUTPUT@',
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
meson.current_build_dir() / 'GIT-VERSION-FILE',
],
depends: [
version_file,
],
depend_files: [
build_options,
],
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)

custom_target(
output: 'Git Gui.app',
command: [
shell,
meson.current_source_dir() / 'generate-macos-app.sh',
meson.current_source_dir(),
meson.current_build_dir() / 'Git Gui.app',
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
meson.current_build_dir() / 'GIT-VERSION-FILE',
],
depends: [
version_file,
],
depend_files: [
build_options,
'macosx/AppMain.tcl',
'macosx/Info.plist',
'macosx/git-gui.icns',
],
build_by_default: true,
install: true,
install_dir: get_option('datadir') / 'git-gui/lib',
)
endif

custom_target(
output: 'git-gui--askpass',
input: 'git-gui--askpass.sh',
command: [
shell,
meson.current_source_dir() / 'generate-script.sh',
'@OUTPUT@',
'@INPUT@',
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
],
install: true,
install_dir: get_option('libexecdir') / 'git-core',
)

custom_target(
input: 'git-gui.sh',
output: gitgui_main,