2
0
David Rose 21 жил өмнө
parent
commit
925765d90a

+ 2 - 1
dtool/Config.pp

@@ -587,10 +587,11 @@
 // $[sources] is the list of .o files.  $[libs] is a space-separated
 // $[sources] is the list of .o files.  $[libs] is a space-separated
 // list of dependent libraries, and $[lpath] is a space-separated list
 // list of dependent libraries, and $[lpath] is a space-separated list
 // of directories in which those libraries can be found.
 // of directories in which those libraries can be found.
-#defer LINK_BIN_C $[cc_ld] -o $[target] $[sources] $[lpath:%=-L%] $[libs:%=-l%]\
+#defer LINK_BIN_C $[cc_ld] -o $[target] $[sources] $[flags] $[lpath:%=-L%] $[libs:%=-l%]\
  $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[frameworks]]
  $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[frameworks]]
 #defer LINK_BIN_C++ $[cxx_ld]\
 #defer LINK_BIN_C++ $[cxx_ld]\
  -o $[target] $[sources]\
  -o $[target] $[sources]\
+ $[flags]\
  $[lpath:%=-L%] $[libs:%=-l%]\
  $[lpath:%=-L%] $[libs:%=-l%]\
  $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[frameworks]]
  $[fpath:%=-Wl,-F%] $[patsubst %,-framework %, $[frameworks]]
 
 

+ 16 - 0
dtool/pptempl/Global.pp

@@ -89,6 +89,8 @@
   #define python_ipath $[wildcard $[PYTHON_IPATH]]
   #define python_ipath $[wildcard $[PYTHON_IPATH]]
   #define python_lpath $[wildcard $[PYTHON_LPATH]]
   #define python_lpath $[wildcard $[PYTHON_LPATH]]
   #define python_fpath $[wildcard $[PYTHON_FPATH]]
   #define python_fpath $[wildcard $[PYTHON_FPATH]]
+  #define python_cflags $[PYTHON_CFLAGS]
+  #define python_lflags $[PYTHON_LFLAGS]
   #define python_libs $[PYTHON_LIBS]
   #define python_libs $[PYTHON_LIBS]
   #define python_framework $[PYTHON_FRAMEWORK]
   #define python_framework $[PYTHON_FRAMEWORK]
 #endif
 #endif
@@ -355,6 +357,20 @@
   $[alt_cflags]
   $[alt_cflags]
 #end get_cflags
 #end get_cflags
 
 
+// This function returns the appropriate lflags for the target, based
+// on the various external packages this particular target claims to
+// require.
+#defun get_lflags
+  // hack to add stl,nspr,python.  should be removed
+  #define alt_lflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lflags] $[nspr_lflags] $[python_lflags]]
+
+  #foreach package $[use_packages]
+    #set alt_lflags $[alt_lflags] $[$[package]_lflags]
+  #end package
+
+  $[alt_lflags]
+#end get_lflags
+
 // This function returns the appropriate include path for the target,
 // This function returns the appropriate include path for the target,
 // based on the various external packages this particular target
 // based on the various external packages this particular target
 // claims to require.  This returns a space-separated set of directory
 // claims to require.  This returns a space-separated set of directory

+ 3 - 0
dtool/pptempl/Template.unix.pp

@@ -100,6 +100,7 @@
 // These are the complete set of extra flags the compiler requires.
 // These are the complete set of extra flags the compiler requires.
 #defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]] 
 #defer cflags $[get_cflags] $[CFLAGS] $[CFLAGS_OPT$[OPTIMIZE]] 
 #defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] 
 #defer c++flags $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] 
+#defer lflags $[get_lflags] $[LFLAGS] $[LFLAGS_OPT$[OPTIMIZE]] 
 
 
 // $[complete_lpath] is rather like $[complete_ipath]: the list of
 // $[complete_lpath] is rather like $[complete_ipath]: the list of
 // directories (from within this tree) we should add to our -L list.
 // directories (from within this tree) we should add to our -L list.
@@ -515,6 +516,7 @@ $[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
 #define sources $($[varname])
 #define sources $($[varname])
 #define cc_ld $[or $[get_ld],$[CC]]
 #define cc_ld $[or $[get_ld],$[CC]]
 #define cxx_ld $[or $[get_ld],$[CXX]]
 #define cxx_ld $[or $[get_ld],$[CXX]]
+#define flags $[lflags]
 $[target] : $[sources] $[static_lib_dependencies]
 $[target] : $[sources] $[static_lib_dependencies]
 #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
 #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
 $[TAB] $[LINK_BIN_C++]
 $[TAB] $[LINK_BIN_C++]
@@ -559,6 +561,7 @@ $[varname] = $[patsubst %,$[%_obj],$[compile_sources]]
 #define sources $($[varname])
 #define sources $($[varname])
 #define cc_ld $[or $[get_ld],$[CC]]
 #define cc_ld $[or $[get_ld],$[CC]]
 #define cxx_ld $[or $[get_ld],$[CXX]]
 #define cxx_ld $[or $[get_ld],$[CXX]]
+#define flags $[lflags]
 $[target] : $[sources] $[static_lib_dependencies]
 $[target] : $[sources] $[static_lib_dependencies]
 #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
 #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
 $[TAB] $[LINK_BIN_C++]
 $[TAB] $[LINK_BIN_C++]