diff --git a/dtool/Config.Irix.pp b/dtool/Config.Irix.pp index fc5deb0807..8da9e2f877 100644 --- a/dtool/Config.Irix.pp +++ b/dtool/Config.Irix.pp @@ -136,3 +136,4 @@ // The dynamic library file extension (usually .so .dll or .dylib): #define DYNAMIC_LIB_EXT .so +#define BUNDLE_EXT diff --git a/dtool/Config.Linux.pp b/dtool/Config.Linux.pp index fbd841e275..5dc7acf90b 100644 --- a/dtool/Config.Linux.pp +++ b/dtool/Config.Linux.pp @@ -142,3 +142,4 @@ // The dynamic library file extension (usually .so .dll or .dylib): #define DYNAMIC_LIB_EXT .so +#define BUNDLE_EXT diff --git a/dtool/Config.Win32.pp b/dtool/Config.Win32.pp index 1082cecb36..e3221d3252 100644 --- a/dtool/Config.Win32.pp +++ b/dtool/Config.Win32.pp @@ -139,5 +139,6 @@ // The dynamic library file extension (usually .so .dll or .dylib): #define DYNAMIC_LIB_EXT .dll +#define BUNDLE_EXT diff --git a/dtool/Config.osx.pp b/dtool/Config.osx.pp index fec57133bc..99115ae8a9 100644 --- a/dtool/Config.osx.pp +++ b/dtool/Config.osx.pp @@ -176,3 +176,4 @@ // The dynamic library file extension (usually .so .dll or .dylib): #define DYNAMIC_LIB_EXT .dylib +#define BUNDLE_EXT .so diff --git a/dtool/Config.pp b/dtool/Config.pp index 4ed8180bf7..233b3c3d55 100644 --- a/dtool/Config.pp +++ b/dtool/Config.pp @@ -881,9 +881,11 @@ #if $[eq $[PLATFORM], osx] #defer SHARED_LIB_C $[cc_ld] -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]] #defer SHARED_LIB_C++ $[cxx_ld] -dynamic -dynamiclib -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]] + #defer BUNDLE_LIB_C++ $[cxx_ld] -bundle -o $[target] -install_name $[notdir $[target]] $[sources] $[lpath:%=-L%] $[libs:%=-l%] $[patsubst %,-framework %, $[frameworks]] #else #defer SHARED_LIB_C $[cc_ld] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] #defer SHARED_LIB_C++ $[cxx_ld] -shared -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%] + #define BUNDLE_LIB_C++ #endif // How to install a data file or executable file. $[local] is the diff --git a/dtool/pptempl/Template.unix.pp b/dtool/pptempl/Template.unix.pp index 04c332641e..efda1da89c 100644 --- a/dtool/pptempl/Template.unix.pp +++ b/dtool/pptempl/Template.unix.pp @@ -41,6 +41,10 @@ // list of binaries that are to be built only when specifically asked // for. #define lib_targets $[active_target(metalib_target lib_target ss_lib_target noinst_lib_target):%=$[ODIR]/lib%$[DYNAMIC_LIB_EXT]] + #define bundle_targets + #if $[BUNDLE_EXT] + #define bundle_targets $[active_target(metalib_target):%=$[ODIR]/lib%$[BUNDLE_EXT]] + #endif #define static_lib_targets $[active_target(static_lib_target):%=$[ODIR]/lib%.a] #define bin_targets $[active_target(bin_target noinst_bin_target sed_bin_target):%=$[ODIR]/%] @@ -188,7 +192,7 @@ #define all_targets \ Makefile \ $[if $[dep_sources],$[DEPENDENCY_CACHE_FILENAME]] \ - $[sort $[lib_targets] $[static_lib_targets] $[bin_targets]] + $[sort $[lib_targets] $[bundle_targets] $[static_lib_targets] $[bin_targets]] all : $[all_targets] // The 'test' rule makes all the test_bin_targets. @@ -200,8 +204,8 @@ clean : clean-igate $[TAB] rm -f $[patsubst %,$[%_obj],$[compile_sources]] #endif #end metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target -#if $[lib_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] -$[TAB] rm -f $[lib_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] +#if $[lib_targets] $[bundle_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] +$[TAB] rm -f $[lib_targets] $[bundle_targets] $[static_lib_targets] $[bin_targets] $[test_bin_targets] #endif #if $[yxx_st_sources] $[lxx_st_sources] $[TAB] rm -f $[patsubst %.yxx,%.cxx %.h,$[yxx_st_sources]] $[patsubst %.lxx,%.cxx,$[lxx_st_sources]] @@ -345,12 +349,20 @@ $[TAB] $[SHARED_LIB_C++] $[TAB] $[SHARED_LIB_C] #endif + #if $[BUNDLE_EXT] + // Also generate the bundles (on OSX only). + #define target $[ODIR]/lib$[TARGET]$[BUNDLE_EXT] + +$[target] : $[sources] $[static_lib_dependencies] +$[TAB] $[BUNDLE_LIB_C++] + #endif // BUNDLE_EXT #endif // Here are the rules to install and uninstall the library and // everything that goes along with it. #define installed_files \ $[install_lib_dir]/lib$[TARGET]$[DYNAMIC_LIB_EXT] \ + $[if $[BUNDLE_EXT],$[install_lib_dir]/lib$[TARGET]$[BUNDLE_EXT]] \ $[INSTALL_SCRIPTS:%=$[install_bin_dir]/%] \ $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \ $[INSTALL_DATA:%=$[install_data_dir]/%] \