Skip to content

Commit d9b71eb

Browse files
authored
Merge pull request #1076 from ychin/fix-gettext-dynamic-linkage
Fix gettext dynamic linkage breaking binary builds due to missing dylib
2 parents 98523ad + 26b49d4 commit d9b71eb

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

.travis.yml

+17-3
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ script:
6161
grep -q -- "-DDYNAMIC_RUBY_DLL=\\\\\"${vi_cv_dll_name_ruby}\\\\\"" src/auto/config.mk
6262
fi
6363
- echo -en "travis_fold:end:configure\\r\\033[0K"
64+
6465
- echo -e "\\033[33;1mBuilding MacVim\\033[0m" && echo -en "travis_fold:start:build\\r\\033[0K"
6566
- make -j${NPROC}
6667
- echo -en "travis_fold:end:build\\r\\033[0K"
67-
- set +o errexit
6868
- ${VIMCMD} --version
69-
- echo -e "\\033[33;1mTesting MacVim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
69+
70+
- echo -e "\\033[33;1mSmoketest\\033[0m" && echo -en "travis_fold:start:smoketest\\r\\033[0K"
7071
# Smoketest scripting languages
7172
- |
7273
macvim_excmd() {
@@ -84,7 +85,20 @@ script:
8485
if [[ -n "${HAS_GETTEXT}" ]]; then
8586
${VIMCMD} -es -c 'lang es_ES' -c 'redir @a' -c 'version' -c 'put a' -c 'print' -c 'qa!' | grep Enlazado
8687
fi
87-
# Run standard test suites
88+
# Make sure there isn't any dynamic linkage to third-party dependencies in the built binary, as we should only use
89+
# static linkage to avoid dependency hell. First, sanity check that we have some dylib linkage to make sure objdump is
90+
# working properly, then test that all those dylib's are in /usr/lib which is bundled with macOS and not third-party.
91+
- |
92+
if (which objdump > /dev/null); then
93+
objdump -p ${VIMCMD} | grep -q dylib &&
94+
! (objdump -p ${VIMCMD} | grep dylib | grep -v "name /usr/lib/")
95+
fi
96+
- echo -en "travis_fold:end:smoketest\\r\\033[0K"
97+
98+
# Run standard test suites.
99+
# Disable errexit so flaky tests won't immediately exit to allow us to see all the errors.
100+
- set +o errexit
101+
- echo -e "\\033[33;1mTesting MacVim\\033[0m" && echo -en "travis_fold:start:test\\r\\033[0K"
88102
- make test
89103
- make -C runtime/doc vimtags VIMEXE=../../src/MacVim/build/Release/MacVim.app/Contents/bin/vim
90104
- echo -en "travis_fold:end:test\\r\\033[0K"

src/auto/configure

+17
Original file line numberDiff line numberDiff line change
@@ -14705,6 +14705,23 @@ $as_echo "no" >&6; }
1470514705
fi
1470614706
rm -f core conftest.err conftest.$ac_objext \
1470714707
conftest$ac_exeext conftest.$ac_ext
14708+
14709+
# MacVim: Hack to statically link against libintl instead of dynamic link, as we can't distribute app bundles with
14710+
# external linkage dependencies. Clang doesn't support any way to specify static linkage as it prefers dynamic
14711+
# linkage if a dylib exists in the same folder, and as such we have to manually specify the library path instead
14712+
# of using -l<lib> syntax. This also means it won't work with AC_TRY_LINK as specifying full lib path only works
14713+
# if you have separate compile/link stages but AC_TRY_LINK just compiles/link in one command.
14714+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libintl.a" >&5
14715+
$as_echo_n "checking for libintl.a... " >&6; }
14716+
if test -f ${local_dir}/lib/libintl.a; then
14717+
LIBS="$olibs ${local_dir}/lib/libintl.a"
14718+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using ${local_dir}/lib/libintl.a instead of -lintl" >&5
14719+
$as_echo "Using ${local_dir}/lib/libintl.a instead of -lintl" >&6; };
14720+
else
14721+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: libintl.a not found - keeping using -lintl" >&5
14722+
$as_echo "libintl.a not found - keeping using -lintl" >&6; };
14723+
fi
14724+
1470814725
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if msgfmt supports --desktop" >&5
1470914726
$as_echo_n "checking if msgfmt supports --desktop... " >&6; }
1471014727
MSGFMT_DESKTOP=

src/configure.ac

+14
Original file line numberDiff line numberDiff line change
@@ -4425,6 +4425,20 @@ if test "$enable_nls" = "yes"; then
44254425
[++_nl_msg_cat_cntr;],
44264426
AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_NL_MSG_CAT_CNTR),
44274427
AC_MSG_RESULT([no]))
4428+
4429+
# MacVim: Hack to statically link against libintl instead of dynamic link, as we can't distribute app bundles with
4430+
# external linkage dependencies. Clang doesn't support any way to specify static linkage as it prefers dynamic
4431+
# linkage if a dylib exists in the same folder, and as such we have to manually specify the library path instead
4432+
# of using -l<lib> syntax. This also means it won't work with AC_TRY_LINK as specifying full lib path only works
4433+
# if you have separate compile/link stages but AC_TRY_LINK just compiles/link in one command.
4434+
AC_MSG_CHECKING([for libintl.a])
4435+
if test -f ${local_dir}/lib/libintl.a; then
4436+
LIBS="$olibs ${local_dir}/lib/libintl.a"
4437+
AC_MSG_RESULT([Using ${local_dir}/lib/libintl.a instead of -lintl]);
4438+
else
4439+
AC_MSG_RESULT([libintl.a not found - keeping using -lintl]);
4440+
fi
4441+
44284442
AC_MSG_CHECKING([if msgfmt supports --desktop])
44294443
MSGFMT_DESKTOP=
44304444
if "$MSGFMT" --help | grep -e '--desktop' >/dev/null; then

0 commit comments

Comments
 (0)