Skip to content

Commit 61281b5

Browse files
authored
Merge pull request #1373 from ychin/remove-sparkle-framework-when-disabled
Remove Sparkle.framework when configured with --disable-sparkle
2 parents decde54 + 8aaea5c commit 61281b5

5 files changed

Lines changed: 46 additions & 19 deletions

File tree

.github/workflows/ci-macvim.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,26 @@ jobs:
242242
${VIM_BIN} -u NONE -i NONE --not-a-term -esNX -V1 -S ci/if_ver-2.vim -c quit
243243
244244
- name: Smoketest
245+
run: |
246+
set -o verbose
247+
248+
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
249+
# static linkage to avoid dependency hell. Test that all those dylib's are in /usr/lib which is bundled with macOS and not third-party.
250+
if otool -L ${VIM_BIN} | grep '\.dylib\s' | grep -v '^\s*/usr/lib/'; then
251+
echo 'Found external dynamic linkage!'; false
252+
fi
253+
254+
# Make sure that --disable-sparkle flag will properly exclude all references to Sparkle symbols. This is
255+
# necessary because we still use weak linking to Sparkle when that flag is set and so references to Sparkle
256+
# wouldn't fail the build (we just remove Sparkle.framework from the built app after the fact).
257+
if ${{ matrix.publish == false }}; then
258+
# Currently we pass --disable-sparkle flag when publish==false
259+
if objdump -t ${MACVIM_BIN} | grep "_SPU\|_SUUpdate"; then
260+
echo 'Found references to Sparkle even when using --disable-sparkle'; false
261+
fi
262+
fi
263+
264+
- name: Smoketest (publish)
245265
if: matrix.publish
246266
run: |
247267
set -o verbose
@@ -263,12 +283,6 @@ jobs:
263283
# Check that libsodium is working
264284
macvim_excmd -c 'set cryptmethod=xchacha20'
265285
266-
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
267-
# static linkage to avoid dependency hell. Test that all those dylib's are in /usr/lib which is bundled with macOS and not third-party.
268-
if otool -L ${VIM_BIN} | grep '\.dylib\s' | grep -v '^\s*/usr/lib/'; then
269-
echo 'Found external dynamic linkage!'; false
270-
fi
271-
272286
# Make sure we are building universal x86_64 / arm64 builds and didn't accidentally create a thin app.
273287
check_arch() {
274288
local archs=($(lipo -archs "$1"))

src/MacVim/MacVim.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@
10531053
);
10541054
runOnlyForDeploymentPostprocessing = 0;
10551055
shellPath = /bin/sh;
1056-
shellScript = "./scripts/cleanup-after-build \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME\"\n";
1056+
shellScript = "./scripts/cleanup-after-build \"$BUILT_PRODUCTS_DIR/$WRAPPER_NAME\" \"$REMOVE_SPARKLE\"\n";
10571057
showEnvVarsInLog = 0;
10581058
};
10591059
90BD4EF224E0E8B700BF29F2 /* Copy locale message translation files */ = {

src/MacVim/scripts/cleanup-after-build

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,35 @@
33
# Utility script to clean up after a MacVim build.
44

55
if [[ $# == 0 ]]; then
6-
echo "Usage: cleanup-after-build <MacVim_app>"
6+
echo "Usage: cleanup-after-build <MacVim_app> <remove_sparkle>"
77
exit -1
88
fi
99

1010
set -e
1111

1212
macvim_path=$1
13+
remove_sparkle=$2
1314

14-
sparkle_xpcservices_symlink="$macvim_path/Contents/Frameworks/Sparkle.framework/XPCServices"
15-
sparkle_xpcservices="$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/Current/XPCServices"
15+
if [ "$remove_sparkle" == "1" ]; then
16+
sparkle_path="$macvim_path/Contents/Frameworks/Sparkle.framework"
17+
if [ -d "$sparkle_path" ]; then
18+
# Remove the entire Sparkle folder. Used when --disable-sparkle was set.
19+
# Using a clean up script is easier because there isn't an easy way to tell
20+
# Xcode not to link/copy it unless we make another target, or dynamically
21+
# patch the project file.
22+
set -x
23+
rm -rf "$sparkle_path"
24+
fi
25+
else
26+
sparkle_xpcservices_symlink="$macvim_path/Contents/Frameworks/Sparkle.framework/XPCServices"
27+
sparkle_xpcservices="$macvim_path/Contents/Frameworks/Sparkle.framework/Versions/Current/XPCServices"
1628

17-
if [ -d "$sparkle_xpcservices" ]; then
18-
# This only happens when building using Sparkle 2. It contains XPC Services
19-
# files which are only necessary for sandboxed apps, and not recommended
20-
# otherwise. See https://sparkle-project.org/documentation/sandboxing/.
21-
set -x
22-
rm -rf "$sparkle_xpcservices"
23-
rm "$sparkle_xpcservices_symlink"
29+
if [ -d "$sparkle_xpcservices" ]; then
30+
# This only happens when building using Sparkle 2. It contains XPC Services
31+
# files which are only necessary for sandboxed apps, and not recommended
32+
# otherwise. See https://sparkle-project.org/documentation/sandboxing/.
33+
set -x
34+
rm -rf "$sparkle_xpcservices"
35+
rm "$sparkle_xpcservices_symlink"
36+
fi
2437
fi

src/auto/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5015,7 +5015,7 @@ printf "%s\n" "no" >&6; }
50155015
else
50165016
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
50175017
printf "%s\n" "yes" >&6; }
5018-
XCODEFLAGS="$XCODEFLAGS GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS DISABLE_SPARKLE=1'"
5018+
XCODEFLAGS="$XCODEFLAGS GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS DISABLE_SPARKLE=1' REMOVE_SPARKLE=1"
50195019
fi
50205020

50215021
if test "$enable_sparkle" == "yes"; then

src/configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ if test "$vim_cv_uname_output" = Darwin; then
236236
AC_MSG_RESULT(no)
237237
else
238238
AC_MSG_RESULT(yes)
239-
XCODEFLAGS="$XCODEFLAGS GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS DISABLE_SPARKLE=1'"
239+
XCODEFLAGS="$XCODEFLAGS GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS DISABLE_SPARKLE=1' REMOVE_SPARKLE=1"
240240
fi
241241

242242
if test "$enable_sparkle" == "yes"; then

0 commit comments

Comments
 (0)