Skip to content

Commit

Permalink
bundle_loader?
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuetzel committed Sep 29, 2024
1 parent 813ed01 commit 535a2f9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
10 changes: 6 additions & 4 deletions build-aux/subst-config-vals.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,17 @@ if [ "x@OCTAVE_RELOCATE_ALL@" = "xyes" ]; then
flibs=`echo '@FLIBS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
ldflags=`echo '@LDFLAGS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
else
cppflags=`echo '@CPPFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
fftw3f_ldflags=`echo '@FFTW3F_LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
fftw3_ldflags=`echo '@FFTW3_LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
flibs=`echo '@FLIBS@' | $SED 's|\"|\\\\\\\"|g'`
ldflags=`echo '@LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'`
fi


Expand Down Expand Up @@ -190,8 +194,6 @@ MKOCTFILE_CXX="@MKOCTFILE_CXX@"
MKOCTFILE_DL_LDFLAGS="@MKOCTFILE_DL_LDFLAGS@"
MKOCTFILE_F77="@MKOCTFILE_F77@"
MKOCTFILE_RANLIB="@MKOCTFILE_RANLIB@"
MKOCTFILE_OCTAVE_LINK_DEPS="@MKOCTFILE_OCTAVE_LINK_DEPS@"
MKOCTFILE_OCT_LINK_DEPS="@MKOCTFILE_OCT_LINK_DEPS@"
OCTAVE_LINK_DEPS="@OCTAVE_LINK_DEPS@"
OCTAVE_LINK_OPTS="@OCTAVE_LINK_OPTS@"
OCT_LINK_DEPS="@OCT_LINK_DEPS@"
Expand Down Expand Up @@ -346,8 +348,8 @@ $SED \
-e "s|%OCTAVE_CONF_MKOCTFILE_CXX%|\"${MKOCTFILE_CXX}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"${MKOCTFILE_DL_LDFLAGS}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_F77%|\"${MKOCTFILE_F77}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${MKOCTFILE_OCTAVE_LINK_DEPS}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${MKOCTFILE_OCT_LINK_DEPS}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${mkoctfile_octave_link_deps}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${mkoctfile_oct_link_deps}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_RANLIB%|\"${MKOCTFILE_RANLIB}\"|" \
-e "s|%OCTAVE_CONF_OCTAVE_LINK_DEPS%|\"${OCTAVE_LINK_DEPS}\"|" \
-e "s|%OCTAVE_CONF_OCTAVE_LINK_OPTS%|\"${OCTAVE_LINK_OPTS}\"|" \
Expand Down
10 changes: 6 additions & 4 deletions build-aux/subst-cross-config-vals.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,17 @@ if [ "x@OCTAVE_RELOCATE_ALL@" = "xyes" ]; then
flibs=`echo '@FLIBS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
ldflags=`echo '@LDFLAGS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED "s|@prefix@|\$\{prefix\}|g" | $SED 's|\"|\\\\\\\"|g'`
else
cppflags=`echo '@CPPFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
fftw3f_ldflags=`echo '@FFTW3F_LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
fftw3_ldflags=`echo '@FFTW3_LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
flibs=`echo '@FLIBS@' | $SED 's|\"|\\\\\\\"|g'`
ldflags=`echo '@LDFLAGS@' | $SED 's|\"|\\\\\\\"|g'`
oct_link_opts=`echo '@OCT_LINK_OPTS@' | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_octave_link_deps=`echo '@MKOCTFILE_OCTAVE_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'`
mkoctfile_oct_link_deps=`echo '@MKOCTFILE_OCT_LINK_DEPS@' | $SED 's|\"|\\\\\\\"|g'`
fi


Expand Down Expand Up @@ -194,8 +198,6 @@ LN_S="@LN_S@"
MAGICK_CPPFLAGS="@MAGICK_CPPFLAGS@"
MAGICK_LDFLAGS="@MAGICK_LDFLAGS@"
MAGICK_LIBS="@MAGICK_LIBS@"
MKOCTFILE_OCTAVE_LINK_DEPS="@MKOCTFILE_OCTAVE_LINK_DEPS@"
MKOCTFILE_OCT_LINK_DEPS="@MKOCTFILE_OCT_LINK_DEPS@"
OCTAVE_LINK_DEPS="@OCTAVE_LINK_DEPS@"
OCTAVE_LINK_OPTS="@OCTAVE_LINK_OPTS@"
OCT_LINK_DEPS="@OCT_LINK_DEPS@"
Expand Down Expand Up @@ -350,8 +352,8 @@ $SED \
-e "s|%OCTAVE_CONF_MKOCTFILE_CXX%|\"${CXX}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%|\"${DL_LDFLAGS}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_F77%|\"${F77}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${MKOCTFILE_OCTAVE_LINK_DEPS}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${MKOCTFILE_OCT_LINK_DEPS}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%|\"${mkoctfile_octave_link_deps}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%|\"${mkoctfile_oct_link_deps}\"|" \
-e "s|%OCTAVE_CONF_MKOCTFILE_RANLIB%|\"${RANLIB}\"|" \
-e "s|%OCTAVE_CONF_OCTAVE_LINK_DEPS%|\"${OCTAVE_LINK_DEPS}\"|" \
-e "s|%OCTAVE_CONF_OCTAVE_LINK_OPTS%|\"${OCTAVE_LINK_OPTS}\"|" \
Expand Down
13 changes: 12 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3048,10 +3048,21 @@ if test $link_all_deps = yes; then
AC_DEFINE(OCTAVE_LINK_ALL_DEPS, 1, [Link with all dependencies.])

OCT_LINK_DEPS="libinterp/liboctinterp.la liboctave/liboctave.la"
OCT_GUI_LINK_DEPS="libgui/liboctgui.la libinterp/liboctinterp.la liboctave/liboctave.la"
case $canonical_host_type in
*-*-darwin*)
OCT_LINK_DEPS="$OCT_LINK_DEPS -bundle_loader ${abs_top_builddir}/src/octave${EXEEXT}"
;;
esac
OCT_GUI_LINK_DEPS="libgui/liboctgui.la $OCT_LINK_DEPS"

MKOCTFILE_OCTAVE_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS $MKOCTFILE_LIBOCTAVE_LINK_DEPS"
MKOCTFILE_OCT_LINK_DEPS="$LIBOCTINTERP $LIBOCTAVE"
case $canonical_host_type in
*-*-darwin*)
MKOCTFILE_OCTAVE_LINK_DEPS="$MKOCTFILE_OCTAVE_LINK_DEPS "'-bundle_loader ${bindir}/octave-${version}'"${EXEEXT}"
MKOCTFILE_OCT_LINK_DEPS="$MKOCTFILE_OCT_LINK_DEPS "'-bundle_loader ${bindir}/octave-${version}'"${EXEEXT}"
;;
esac

LIBOCTINTERP_LINK_DEPS="$LIBOCTINTERP_LINK_DEPS $LIBOCTAVE_LINK_DEPS"
LIBOCTINTERP_LINK_OPTS="$LIBOCTINTERP_LINK_OPTS $LIBOCTAVE_LINK_OPTS"
Expand Down
6 changes: 3 additions & 3 deletions m4/acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2784,9 +2784,9 @@ AC_DEFUN_ONCE([OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS], [
dnl Contains variables that are defined and undefined at this point,
dnl so use appropriate quoting to defer expansion of
dnl ${abs_top_builddir}, ${bindir}, and ${version}.
DL_LDFLAGS='-bundle -undefined dynamic_lookup -bind_at_load -bundle_loader ${abs_top_builddir}/src/octave'"${EXEEXT} ${LDFLAGS}"
MKOCTFILE_DL_LDFLAGS='-bundle -undefined dynamic_lookup -bind_at_load -bundle_loader ${bindir}/octave-${version}'"${EXEEXT}"
SH_LDFLAGS="-dynamiclib -single_module ${LDFLAGS}"
DL_LDFLAGS="-bundle -undefined dynamic_lookup -bind_at_load"
MKOCTFILE_DL_LDFLAGS="-bundle -undefined dynamic_lookup -bind_at_load"
SH_LDFLAGS="-dynamiclib -single_module"
case $canonical_host_type in
powerpc-*)
CXXPICFLAG=
Expand Down
9 changes: 6 additions & 3 deletions src/mkoctfile.in.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,13 @@ make_vars_map (bool link_stand_alone, bool verbose, bool debug)
replace_prefix (%OCTAVE_CONF_FLIBS%));

vars["OCTAVE_LINK_DEPS"] = get_variable ("OCTAVE_LINK_DEPS",
%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%);
replace_prefix (%OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%));

vars["OCTAVE_LINK_OPTS"] = get_variable ("OCTAVE_LINK_OPTS",
%OCTAVE_CONF_OCTAVE_LINK_OPTS%);

vars["OCT_LINK_DEPS"] = get_variable ("OCT_LINK_DEPS",
%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%);
replace_prefix (%OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%));

vars["OCT_LINK_OPTS"]
= get_variable ("OCT_LINK_OPTS",
Expand Down Expand Up @@ -1364,7 +1364,10 @@ main (int argc, char **sys_argv)
+ pass_on_options + " -o " + octfile + ' ' + objfiles + ' '
+ libfiles + ' ' + ldflags + ' ' + vars["DL_LDFLAGS"] + ' '
+ vars["LDFLAGS"] + ' ' + octave_libs + ' '
+ vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]);
+ vars["OCT_LINK_OPTS"]);

if (! creating_mex_file)
cmd += ' ' + vars["OCT_LINK_DEPS"];

#if defined (OCTAVE_USE_WINDOWS_API) || defined (CROSS)
if (! f77files.empty () && ! vars["FLIBS"].empty ())
Expand Down
1 change: 1 addition & 0 deletions test/mex/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ MKMEXFILELDFLAGS = \
-L$(top_builddir)/libmex/.libs

MKMEXFILE = \
OCT_LINK_DEPS="" \
DL_LDFLAGS="$(DL_LDFLAGS)" \
$(top_builddir)/src/mkoctfile --mex $(MKMEXFILECPPFLAGS) $(MKMEXFILELDFLAGS)

Expand Down

0 comments on commit 535a2f9

Please sign in to comment.