Commit graph

28 commits

Author SHA1 Message Date
tv
91b28b7d9a In line with the unconditional inclusion in bsd.pkg.mk, bsd.buildlink3.mk
must always bee included too.
2005-04-07 16:56:00 +00:00
tv
fe3c1321bf USE_BUILDLINK3 is no longer optional (and cannot be turned off). Per mail
to tech-pkg:

=====

* USE_BUILDLINK3=YES will be unconditional.  (In fact, USE_BUILDLINK3 will
  be ignored altogether by mk/; but see below.)

* NO_BUILDLINK and NO_WRAPPER will be ignored by mk/.  If a build happens,
  these phases will happen.

* The existing NO_BUILD will imply the previous NO_BUILDLINK and NO_WRAPPER.
  If no build happens, those phases are not needed.

* NO_TOOLS will be ignored by mk/.  The tools phase, which provides much
  more than just the C compiler, will always happen regardless of package.
  This will make metapackage builds only slightly slower, in trade for far
  less user error.
2005-03-24 17:46:00 +00:00
grant
6f23238a15 fix previous to work with pkgsrc bmake, and add a comment explaining
why it must be done this way.
2005-03-08 00:52:31 +00:00
agc
8fb629087b Also echo the wrapper stages if PKG_VERBOSE is defined, not just when
PKG_DEBUG_LEVEL > 1.
2005-03-06 22:27:12 +00:00
grant
fab0a1b153 add wrappers to transform arguments for AIX's ld(1), notably, if we
are dynamically linking, the -brtl flag must be passed to the linker
so that the runtime linker is used.

tested on AIX 4.3 and 5.1 by garbled@.
2005-02-19 04:19:59 +00:00
grant
94c992087d properly detect icc 8.1, which needs a different argument to
statically link the Intel provided libraries.
2005-02-16 10:59:03 +00:00
grant
9fd9fe5331 add support for icc, the Intel C++ Compiler (Linux).
icc is a high performance compiler suite for Linux/i386 and ia64, and
is free for non-commercial use. see:

	http://www.intel.com/software/products/compilers/clin/

for more information.

tested with icc version 8.0 and 8.1 on Slackware 10/i386.
2005-02-15 07:43:43 +00:00
jlam
e9eb68750b The libtool wrapper should always do the compiler wrapper transformations,
so move the setting for _WRAP_ARG_PP.LIBTOOL out of conditional areas of
bsd.wrapper.mk and set it globally in bsd.buildlink3.mk with the rest of
the libtool wrapper variables.
2005-02-15 03:18:50 +00:00
jlam
a4719cbfa5 Teach the libtool wrapper about the same types of transformations that
the compiler wrapper already knows to do.  This should protect
"-install_name ..." from wrapper transformations within the libtool
wrapper on Darwin and fixes PR pkg/29215.

Software that properly use libtool don't pass an explicit "-install_name
..." because libtool always generates its own such argument when
building the (Darwin) shared library.  However, not every piece of
software, including the ones like lang/tcl that pkgsrc converted to
use libtool, will use libtool in the documented fashion.  Longer term,
those packages should be fixed properly, but we will still need the
libtool wrapper to avoid transforming arguments that the compiler
wrapper itself doesn't transform, e.g. for MIPSpro and -LANG:*.
2005-02-14 21:33:08 +00:00
jlam
5977984da2 Split out the argument pre-processing logic into its own script
arg-pp-main, and allow for wrapper-specific hooks to extend the
pre-processing through _WRAP_ARG_PP.<wrappee>.  Move the Darwin
GCC-related preprocessing into arg-pp-darwin-gcc, and create a
arg-pp-mipspro-cc that understands -LANG:<feature> and -LIST:<feature>
so that they're not confused with the usual -Ldir options.
2005-01-18 17:25:13 +00:00
jlam
03469252ea Really skip the transformations for imake. This shows the danger in
having variables that take a "yes" value to turn off behavior.
2005-01-11 18:08:20 +00:00
jlam
bde2c8d1b9 Fix error in previous that turned off all transformations in all
wrappers.  "Oops".  We now do transformations by default, and turn
them off explicitly for wrappers that don't want them, e.g. IMAKE.
2005-01-10 17:16:35 +00:00
jlam
fe94a16933 Avoid the silly optimization in the make logic and push it into the
shell script instead.  We can't avoid invoking sed at least once since
we need to protect the arguments against shell expansion, but we avoid
invoking sed for transformations unless there actually are transformations
to perform.  The code is simpler, more straightforward, and logically
correct now.

This fixes problems with using a non-GCC compiler with packages that
haven't been converted to use buildlink3, noted in PR pkg/28896.
2005-01-10 03:40:25 +00:00
grant
748314ae90 add handling for some required -Wl, transformations for packages that
assume Apple gcc on Darwin. thanks, Johnny :)

this allows perl to build with xlc.
2004-12-05 09:29:26 +00:00
jlam
28e0cb9288 Remove the trailing whitespace in the values of the toolchain variables
(CC, LD, CXX, etc.) if the default values have no arguments.  Now,
CC == "cc" and not "cc ".
2004-11-30 15:07:26 +00:00
jlam
eb9034727a Modify the way that the toolchain variables, e.g. CC, CPP, CXX, LD, etc.,
are handled.  The idea now is to simply remove the paths in the values
of these variables, leaving behind only the basename plus any arguments,
e.g.:

	CC= /usr/local/bin/gcc       becomes   CC= gcc
	CPP= /usr/local/bin/gcc -E   becomes   CPP= gcc -E

The wrapper scripts are generated for every unique executable mentioned
by the toolchain variables, so for the example above, only a "gcc"
wrapper script is generated for ${CC} and ${CPP}.  PKG_{CC,CPP,CXX,etc.}
are the paths to the executables wrapped by the wrapper scripts.

Note that it's now possible to set "CC" to something more than just the
path to the compiler, e.g.

	CC= cc -ffast-math -funroll-loops -fomit-frame-pointer

and the full value of ${CC} will be passed through via CONFIGURE_ENV
and MAKE_ENV.
2004-11-30 14:50:37 +00:00
grant
919cb8bddb add framework support for Tru64 and the Compaq C compiler.
patches provided by Tobias Nygren <tnn at netilium dot org> with
minor changes by me.
2004-11-20 04:37:08 +00:00
jlam
92eea4d8e0 Insert the default values for WRAPPER_DEBUG and WRAPPER_UPDATE_CACHE as
defaults within the wrapper script.  This avoids requiring those two
variables to be defined in the shell environment for the correct defaults
to take effect.
2004-11-12 16:27:57 +00:00
tv
e2231831d1 Oy. For some reason, when doing :O:u, -L and -R options are stripped
completely (they say "cached" but never come out the other side).  So
revert previous, hopefully to find a resolution later....
2004-10-14 20:22:21 +00:00
tv
4b8e5d9b9a Big speedup hack: Sort and uniqify ${_WRAP_TRANSFORM_CMDS}. Eliminates
many (hundreds, in some packages) multiple identical transformations.
2004-10-14 20:00:30 +00:00
tv
61fabf5361 Move -D_ALL_SOURCE for Interix, required for nearly every compilation, from
the funky CPPFLAGS assignment into the new wrapper framework.
2004-10-09 03:49:13 +00:00
grant
b761a1f885 add initial support for IBM's XL C/C++ compiler. tested with version
6.0 on Mac OS X 10.3.5.

to use XL C, set PKGSRC_COMPILER=xlc in mk.conf. XLCBASE defaults to
/opt/ibmcmp/vacpp/6.0 (the default installation location on OS X),
this can be overridden in mk.conf too.

this is a work in progress - some simple packages can be built, but
there are still lots of issues that need to be worked through.
2004-10-06 09:49:53 +00:00
jlam
f2cb35cf1e Add a scan script that checks for "-v" on the command-line, and prevents
the wrappers from adding extra flags to the command-line if "-v"
exists.  This makes "g++ -v" return the same error code for both the
wrapper and the real executable and fixes the problem with the
libtool-base build not correctly detecting the C++ compiler and thus
not adding the CXX configuration tag to the final libtool script.

Downgrade LIBTOOL_REQD to 1.5.10 since the newest version isn't needed
with this change.
2004-10-04 20:28:29 +00:00
jlam
430f3b2ae5 Move some wrapper definitions into a separate file wrapper-defs.mk that is
included by bsd.prefs.mk.  This allows the following variables to be used
before bsd.wrapper.mk is included:

	WRAPPER_DIR		WRAPPER_SRCDIR
	WRAPPER_BINDIR		WRAPPER_SHELL
	WRAPPER_TMPDIR
2004-09-27 12:05:53 +00:00
jlam
a92d5feb00 Make _WRAPPEES into a public variable so that we can more easily create
wrapper scripts in package-land.
2004-09-26 21:38:03 +00:00
jlam
2044bc930d Add Dan Winship's workaround to allow building on Darwin. This is only a
temporary fix until I can find time to do this better.
2004-09-25 20:38:21 +00:00
jlam
19036ca486 Move @_WRAP_TRANSFORM_SED@ from the logic script into wrapper.sh so that
it can be customized per wrappee.  This fixes the imake wrapper script to
not do any transformations to -I... options.
2004-09-23 03:59:01 +00:00
jlam
1d55af8fb2 Initial commit of a new wrapper script framework that encapsulates
the non-buildlink-related code and moves it out of mk/buildlink3 into
mk/wrapper.  The buildlink3 code is modified to simply hook its
transformations into the wrapper script framework.

The wrapper script framework has some new features:

* Support automatically passing "ABI" flags to the compiler and linker
  depending on the value of ${ABI}.  Currently supports the SunPro
  compiler with ${ABI} == 64 and the MIPSPro compiler with ${ABI} as
  any of 32, n32, o32, and 64.

* making UnixWare GCC accept -rpath options and silently converting
  them into an appropriate LD_RUN_PATH

* Add cmd-sink-interix-gcc and cmd-sink-interix-ld that errors out
  when it sees -fpic/-fPIC and -shared/-Bshareable, respectively
  (requested by <tv>).

* Much improved debugging output.  It's possible to output the wrapper
  work log in-line with normal output by setting WRAPPER_LOG to
  "stderr".

Important differences in behaviour from the old buildlink3 code include:

* Only move the -l options to the end of the command line, leaving the
  -L options in-place.

* Extend the autodetection of the libtool mode to detect "compile" and
  "uninstall".

* Fix problem noted in both PR pkg/24760 and PR pkg/25500, where
  -L/usr/lib/* was being mangled improperly.

* Remove the top-level "buildlink" target; instead, make buildlinking
  occur as part of the "wrapper" target.

* mangle and sub-mangle are only meant to transform directories in
  -I, -L, and rpath options, so remove the lines in
  buildlink3/gen-transform.sh that transformed bare directories.

* Add the ability for the libtool wrapper to be called just to unwrap
  an existing libtool archive by running:

	libtool --mode=unwrap -o libfoo.la

  The old --fix-la syntax no longer works.


20040818
========
* Initial release of a new wrapper script framework that encapsulates
  the non-buildlink-related code and moves it out of mk/buildlink3.
  These features include:

   * making MIPSpro accept GCC options
   * making MIPSpro "ucode" accept GCC options
   * making SunPro accept GCC options
   * making "ld" accept -Wl,* options and silently removing the "-Wl,"
   * (NEW) making UnixWare GCC accept -rpath options and silently
     converting them into an appropriate LD_RUN_PATH

  One major benefit of this is that the buildlink3 code is now much
  tighter and easier to understand since it concerns itself solely
  with buildlink-related details.  I haven't yet optimized the wrapper
  cache, so the new wrapper scripts may take slightly longer to execute
  than the old buildlink3 wrapper scripts, but I'll be improving this
  over time.


20040821
========
* Move the inclusion of $cmd_sink outside of the main loop in wrapper.sh
  so that the $cmd_sink script can be used to globally scan and process
  the arguments.  Move the LD_RUN_PATH code to a cmd-sink-unixware-gcc
  script.  Garbage-collect the now unused export_vars-related code.

* Add cmd-sink-aix-xlc for AIX xlc that munges -Wl,-R* into an
  appropriate -blibpath option.

* Add cmd-sink-interix-gcc and cmd-sink-interix-ld that errors out
  when it sees -fpic/-fPIC and -shared/-Bshareable, respectively
  (requested by <tv>).

* Move the code that converts full paths to shared libraries into the
  "-Ldir -llib" equivalents from the buildlink3 code into wrapper/logic.
  Remove the same from bsd.buildlink3.mk and gen-transform.sh.

* Move the code that checks for absolute rpaths from the buildlink3
  code into wrapper/arg-source.  Remove the same from bsd.buildlink3.mk
  and gen-transform.sh.

* Only move the -l options to the end of the command line, leaving the
  -L options in-place.

* Add more debugging code.


20040824
========
* Fix quoting problems after arguments are transformed.  Remove the
  hack that was inserted that magically made almost everything work
  because we do it the right way now.

* Move the inclusion of $logic outside of the main loop in wrapper.sh
  so that the $logic script doesn't have to worry about underflowing
  the argument buffer.

* Encapsulate the loop in wrapper.sh that fills the argument buffer
  entirely within the arg-source script.

* Move from the logic script into the arg-source script the
  transformations that merge or split arguments.

* Fix bug where skipargs was effectively being ignored if it was more
  than 1.

* Handle the whitespace in transformations in the logic script that
  turn one library option into multiple library options, e.g.
  "-lreadline" -> "-ledit -ltermcap".

* Allow you to specify an environment variable WRAPPER_SKIP_TRANSFORM
  for whether you wish to skip the transformation step in the logic
  script.  This is intended for testing purposes.

* Added check_prog() and init_lib() functions to the shell code library
  to make it more reusable outside of the wrapper framework.

* Allow the msg_log() function to output to "stdout" or "stderr".  If
  you want to have all of the logging appear on the screen, then you
  can now set WRAPPER_LOG=stderr.

* Make some of the script components not overridable on a per-wrapper
  basis.

* Add a gen-transform.sh script that generates transformation sedfiles.
  The "transform" script is used to transform arguments, while the
  "untransform" script is used to unwrap files.  Move the no-rpath
  logic from buildlink3/gen-transform.sh into wrapper/gen-transform.sh
  since it's not buildlink3-specific.

* Check for a non-empty blibpath before adding the option in
  cmd-sink-aix-xlc.

* Extend the autodetection of the libtool mode to detect "compile" and
  "uninstall".

* Add a cmd-sink-libtool script that doesn't pass linker options to
  libtool unless we're in "link" mode.

* Set _USE_RPATH to "yes" for UnixWare so that the wrappers will see the
  rpath options and convert them to a LD_RUN_PATH definition.

* Add more debugging code.


20040826
========
* Rewrite buildlink3/gen-transform.sh to produce more precise sed commands.
  Drop some unused commands from the mini-language, and add a few more
  that are more restrictive in their scope.

* Fix problem where repeated options weren't properly handled by some
  of sed commands.  It's not enough that they're "global replace",
  since some patterns match separator characters before and after each
  option.  We must repeat those patterns twice to catch all instances
  correctly.

* Fix problem noted in both PR pkg/24760 and PR pkg/25500, where
  -L/usr/lib/* was being mangled improperly.

* Remove the top-level "buildlink" target; instead, make buildlinking
  occur as part of the "wrapper" target.

* Add more debugging code.


20040828
========
* Added a head_queue function to shell-lib that returns the head of the
  named queue without popping it off the front of the queue.

* Strip consecutive, repeated library options from the command line when
  we read it in the logic script.

* Be more careful about not underflowing the argument buffer.


20040906
========
* shell-lib was moved into pkgsrc/mk/scripts; correct references to that
  file in the wrapper code.

* Use opt-sub instead of sub-mangle when protecting -I/usr/include/*
  and -L/usr/lib/* from buildlink transformations.  This avoids adding
  lines that look like "-I-I..." in the transformation sedfiles.

* mangle and sub-mangle are only meant to transform directories in
  -I, -L, and rpath options, so remove the lines in
  buildlink3/gen-transform.sh that transformed bare directories.

* Fix bug in strip-slashdot where the "." wasn't backquoted and thus
  matched all characters instead of only the "." character.

* Change the libtool wrapper to use a modified buildcmd script that
  doesn't rearrange any of the arguments.  This should fix spurious
  problems where libtool doesn't understand how to parse the command
  line when the -l options are moved to the end of the argument list.

* Fix bug in the logic script where the $cachearg and $cachedarg
  weren't being properly set at all times, which caused the cache to
  contain the wrong transformed argument.


20040907
========
* Support automatically passing "ABI" flags to the compiler and linker
  depending on the value of ${ABI}.  Currently supports the SunPro
  compiler with ${ABI} == 64 and the MIPSPro compiler with ${ABI} as
  any of 32, n32, o32, and 64.

* Move back the code that splits absolute paths to shared libraries
  from arg-source back into logic.  This allows us to correctly skip
  splitting those paths based on the previous option.  Also add a
  sanity check that the library name in the split argument doesn't
  contain a "/" since shell globs are not as precise as REs.

* Don't transform the path given after --dynamic-linker (used by GNU
  ld for ELF linkage).

* Add the ability for the libtool wrapper to be called just to unwrap
  an existing libtool archive by running:

	libtool --mode=unwrap -o libfoo.la


20040914
========
* Add a loop in libtool-fix-la to ensure that all of the options listed
  in the dependency_libs lines of *.lai files are processed.  This fixes
  a buildlink3 leakage bug.

* Merge the gen-transform.sh scripts between buildlink3 and wrapper and
  place them all in wrapper.  This makes sense since the commands simply
  allow for many types of transformations, which buildlink3 takes
  advantage of, but there is nothing inherently buildlink-ish about
  those commands.

* Don't directly manipulate SUBST_SED.unwrap.  Instead, create the
  value of SUBST_SED.unwrap by combining several other variables
  (currently just _UNWRAP_SED) to ensure that the correct ordering is
  preserved.

* Correct some confusing debugging messages.
2004-09-21 15:01:38 +00:00