head 1.10;
access;
symbols
pkgsrc-2023Q4:1.9.0.38
pkgsrc-2023Q4-base:1.9
pkgsrc-2023Q3:1.9.0.36
pkgsrc-2023Q3-base:1.9
pkgsrc-2023Q2:1.9.0.34
pkgsrc-2023Q2-base:1.9
pkgsrc-2023Q1:1.9.0.32
pkgsrc-2023Q1-base:1.9
pkgsrc-2022Q4:1.9.0.30
pkgsrc-2022Q4-base:1.9
pkgsrc-2022Q3:1.9.0.28
pkgsrc-2022Q3-base:1.9
pkgsrc-2022Q2:1.9.0.26
pkgsrc-2022Q2-base:1.9
pkgsrc-2022Q1:1.9.0.24
pkgsrc-2022Q1-base:1.9
pkgsrc-2021Q4:1.9.0.22
pkgsrc-2021Q4-base:1.9
pkgsrc-2021Q3:1.9.0.20
pkgsrc-2021Q3-base:1.9
pkgsrc-2021Q2:1.9.0.18
pkgsrc-2021Q2-base:1.9
pkgsrc-2021Q1:1.9.0.16
pkgsrc-2021Q1-base:1.9
pkgsrc-2020Q4:1.9.0.14
pkgsrc-2020Q4-base:1.9
pkgsrc-2020Q3:1.9.0.12
pkgsrc-2020Q3-base:1.9
pkgsrc-2020Q2:1.9.0.10
pkgsrc-2020Q2-base:1.9
pkgsrc-2020Q1:1.9.0.6
pkgsrc-2020Q1-base:1.9
pkgsrc-2019Q4:1.9.0.8
pkgsrc-2019Q4-base:1.9
pkgsrc-2019Q3:1.9.0.4
pkgsrc-2019Q3-base:1.9
pkgsrc-2019Q2:1.9.0.2
pkgsrc-2019Q2-base:1.9
pkgsrc-2019Q1:1.8.0.36
pkgsrc-2019Q1-base:1.8
pkgsrc-2018Q4:1.8.0.34
pkgsrc-2018Q4-base:1.8
pkgsrc-2018Q3:1.8.0.32
pkgsrc-2018Q3-base:1.8
pkgsrc-2018Q2:1.8.0.30
pkgsrc-2018Q2-base:1.8
pkgsrc-2018Q1:1.8.0.28
pkgsrc-2018Q1-base:1.8
pkgsrc-2017Q4:1.8.0.26
pkgsrc-2017Q4-base:1.8
pkgsrc-2017Q3:1.8.0.24
pkgsrc-2017Q3-base:1.8
pkgsrc-2017Q2:1.8.0.20
pkgsrc-2017Q2-base:1.8
pkgsrc-2017Q1:1.8.0.18
pkgsrc-2017Q1-base:1.8
pkgsrc-2016Q4:1.8.0.16
pkgsrc-2016Q4-base:1.8
pkgsrc-2016Q3:1.8.0.14
pkgsrc-2016Q3-base:1.8
pkgsrc-2016Q2:1.8.0.12
pkgsrc-2016Q2-base:1.8
pkgsrc-2016Q1:1.8.0.10
pkgsrc-2016Q1-base:1.8
pkgsrc-2015Q4:1.8.0.8
pkgsrc-2015Q4-base:1.8
pkgsrc-2015Q3:1.8.0.6
pkgsrc-2015Q3-base:1.8
pkgsrc-2015Q2:1.8.0.4
pkgsrc-2015Q2-base:1.8
pkgsrc-2015Q1:1.8.0.2
pkgsrc-2015Q1-base:1.8
pkgsrc-2014Q4:1.7.0.84
pkgsrc-2014Q4-base:1.7
pkgsrc-2014Q3:1.7.0.82
pkgsrc-2014Q3-base:1.7
pkgsrc-2014Q2:1.7.0.80
pkgsrc-2014Q2-base:1.7
pkgsrc-2014Q1:1.7.0.78
pkgsrc-2014Q1-base:1.7
pkgsrc-2013Q4:1.7.0.76
pkgsrc-2013Q4-base:1.7
pkgsrc-2013Q3:1.7.0.74
pkgsrc-2013Q3-base:1.7
pkgsrc-2013Q2:1.7.0.72
pkgsrc-2013Q2-base:1.7
pkgsrc-2013Q1:1.7.0.70
pkgsrc-2013Q1-base:1.7
pkgsrc-2012Q4:1.7.0.68
pkgsrc-2012Q4-base:1.7
pkgsrc-2012Q3:1.7.0.66
pkgsrc-2012Q3-base:1.7
pkgsrc-2012Q2:1.7.0.64
pkgsrc-2012Q2-base:1.7
pkgsrc-2012Q1:1.7.0.62
pkgsrc-2012Q1-base:1.7
pkgsrc-2011Q4:1.7.0.60
pkgsrc-2011Q4-base:1.7
pkgsrc-2011Q3:1.7.0.58
pkgsrc-2011Q3-base:1.7
pkgsrc-2011Q2:1.7.0.56
pkgsrc-2011Q2-base:1.7
pkgsrc-2011Q1:1.7.0.54
pkgsrc-2011Q1-base:1.7
pkgsrc-2010Q4:1.7.0.52
pkgsrc-2010Q4-base:1.7
pkgsrc-2010Q3:1.7.0.50
pkgsrc-2010Q3-base:1.7
pkgsrc-2010Q2:1.7.0.48
pkgsrc-2010Q2-base:1.7
pkgsrc-2010Q1:1.7.0.46
pkgsrc-2010Q1-base:1.7
pkgsrc-2009Q4:1.7.0.44
pkgsrc-2009Q4-base:1.7
pkgsrc-2009Q3:1.7.0.42
pkgsrc-2009Q3-base:1.7
pkgsrc-2009Q2:1.7.0.40
pkgsrc-2009Q2-base:1.7
pkgsrc-2009Q1:1.7.0.38
pkgsrc-2009Q1-base:1.7
pkgsrc-2008Q4:1.7.0.36
pkgsrc-2008Q4-base:1.7
pkgsrc-2008Q3:1.7.0.34
pkgsrc-2008Q3-base:1.7
cube-native-xorg:1.7.0.32
cube-native-xorg-base:1.7
pkgsrc-2008Q2:1.7.0.30
pkgsrc-2008Q2-base:1.7
cwrapper:1.7.0.28
pkgsrc-2008Q1:1.7.0.26
pkgsrc-2008Q1-base:1.7
pkgsrc-2007Q4:1.7.0.24
pkgsrc-2007Q4-base:1.7
pkgsrc-2007Q3:1.7.0.22
pkgsrc-2007Q3-base:1.7
pkgsrc-2007Q2:1.7.0.20
pkgsrc-2007Q2-base:1.7
pkgsrc-2007Q1:1.7.0.18
pkgsrc-2007Q1-base:1.7
jlam-pkgviews:1.7.0.16
jlam-pkgviews-base:1.7
pkgsrc-2006Q4:1.7.0.14
pkgsrc-2006Q4-base:1.7
pkgsrc-2006Q3:1.7.0.12
pkgsrc-2006Q3-base:1.7
pkgsrc-2006Q2:1.7.0.10
pkgsrc-2006Q2-base:1.7
tv-derecurse-eol:1.6.2.2
pkgsrc-2006Q1:1.7.0.8
pkgsrc-2006Q1-base:1.7
pkgsrc-2005Q4:1.7.0.6
pkgsrc-2005Q4-base:1.7
pkgsrc-2005Q3:1.7.0.4
pkgsrc-2005Q3-base:1.7
pkgsrc-2005Q2:1.7.0.2
pkgsrc-2005Q2-base:1.7
tv-derecurse-merge:1.7
pkgsrc-2005Q1:1.6.0.6
pkgsrc-2005Q1-base:1.6
pkgsrc-2004Q4:1.6.0.4
pkgsrc-2004Q4-base:1.6
tv-derecurse:1.6.0.2
tv-derecurse-base:1.6
pkgsrc-2004Q3:1.5.0.2
pkgsrc-2004Q3-base:1.5
pkgsrc-2004Q2:1.4.0.2
pkgsrc-2004Q2-base:1.4
pkgsrc-2004Q1:1.3.0.2
pkgsrc-2004Q1-base:1.3;
locks; strict;
comment @# @;
1.10
date 2024.01.18.23.38.40; author rillig; state Exp;
branches;
next 1.9;
commitid UUs2mMz8NV0SfZUE;
1.9
date 2019.05.01.10.55.13; author rillig; state Exp;
branches;
next 1.8;
commitid V8aikNl5Bg0BuulB;
1.8
date 2014.12.30.15.13.19; author wiz; state Exp;
branches;
next 1.7;
commitid RRdsYBWaMIUIN44y;
1.7
date 2005.03.24.17.46.01; author tv; state Exp;
branches;
next 1.6;
1.6
date 2004.09.21.15.01.40; author jlam; state Exp;
branches
1.6.2.1;
next 1.5;
1.5
date 2004.07.30.20.52.44; author jlam; state Exp;
branches;
next 1.4;
1.4
date 2004.05.08.23.46.20; author grant; state Exp;
branches;
next 1.3;
1.3
date 2004.02.05.08.50.38; author jlam; state Exp;
branches;
next 1.2;
1.2
date 2004.02.05.07.49.48; author seb; state Exp;
branches;
next 1.1;
1.1
date 2004.01.29.06.03.15; author jlam; state Exp;
branches;
next ;
1.6.2.1
date 2004.11.22.22.48.05; author tv; state Exp;
branches;
next 1.6.2.2;
1.6.2.2
date 2005.05.17.18.29.44; author tv; state Exp;
branches;
next 1.6.2.3;
1.6.2.3
date 2006.06.07.15.25.39; author tv; state dead;
branches;
next ;
desc
@@
1.10
log
@mk/buildlink3: remove documentation about PKG_PHASE
The PKG_PHASE variable was removed with the addition of
mk/bsd.pkg.barrier.mk 1.1 from 2006-07-05.
@
text
@$NetBSD: BUILDLINK3_DG,v 1.9 2019/05/01 10:55:13 rillig Exp $
0 Developer's guide to buildlink3
=================================
This is a tutorial for pkgsrc developers to understand and to use the
buildlink3 framework in pkgsrc. The buildlink3 framework establishes the
principle: only allow the software build process to see what we choose to
allow it to see.
1 libtool
==============================
The buildlink3 framework handles packages that install libtool archive
files for libraries that are also present in the base system. It more
tightly controls where libtool can find libtool archives. This reduces
the number of conflicts between libtool libraries provided by the base
system and those from pkgsrc.
2 buildlink3.mk file structure
==============================
The buildlink3.mk files keep track of how "deep" we are in including
buildlink3.mk files, and only create dependencies on packages encountered
at depth 1. This means that packages that want to add a dependency must
directly include the buildlink3.mk file for that dependency.
3 Troubleshooting
=================
To see the actual command executed by the wrapper scripts, examine the
contents of the ${WRKDIR}/.work.log file. The lines preceded with [*]
are the commands that are intercepted by the wrapper scripts, and the
lines preceded with <.> are the commands that are executed by the
wrapper scripts.
@
1.9
log
@mk/buildlink3: remove references to buildlink2 from the documentation
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.8 2014/12/30 15:13:19 wiz Exp $
d34 5
a38 16
Q1: Where can I see the actual command executed by the wrapper
scripts?
A1: You should examine the contents of the ${WRKDIR}/.work.log file.
The lines preceded with [*] are the commands that are intercepted
by the wrapper scripts, and the lines preceded with <.> are the
commands that are executed by the wrapper scripts.
Q2: Why can't I check the values of variables set by the buildlink3
framework using 'make show-var VARNAME=...'?
A2: Some variables are only defined for a subset of the package build
phases. Try instead:
make show-var PKG_PHASE=wrapper VARNAME=...
@
1.8
log
@Remove pkg_views support, second part: infrastructure.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.7 2005/03/24 17:46:01 tv Exp $
d7 3
a9 1
buildlink3 framework in pkgsrc.
d12 2
a13 2
1 Changes between buildlink2 and buildlink3
===========================================
d15 5
a19 4
The buildlink3 framework is a evolutionary descendant of the
buildlink2 framework that does a better job of adhering to the
fundamental buildlink principle: only allow the software build
process to see what we choose to allow it to see.
d22 2
a23 2
1.1 Better behavior with libtool
================================
d25 4
a28 7
One of the biggest problems in buildlink2 is handling packages that
install libtool archive files for libraries that are also present in
the base system. buildlink3 is significantly better at this as it
more tightly controls where libtool can find libtool archives. One
side effect of this is that we no longer need to create fake libtool
archives to work around cases where the pkgsrc libraries were being
used instead of the system libraries if they shared the same name.
d31 1
a31 16
1.2 New buildlink3.mk file structure
====================================
buildlink3.mk files have two major differences over buildlink2.mk
files. The first, most noticeable difference is that buildlink3.mk
generally don't contain a BUILDLINK_FILES definition. This is
because buildlink3 automatically determines which files to symlink
into ${BUILDLINK_DIR} by examining the PLIST of the installed package.
The second difference is that buildlink3.mk files keep track of how
"deep" we are in including buildlink3.mk files, and only creates
dependencies on packages encountered at depth 1. This means that
packages that want to add a dependency must directly include the
buildlink3.mk file for that dependency.
2 Troubleshooting
@
1.7
log
@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.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.6 2004/09/21 15:01:40 jlam Exp $
a45 13
1.3 Support for pkgviews
========================
When building pkgviews packages, buildlink3 doesn't symlink files
into ${BUILDLINK_DIR} since it can safely refer to only a specific
package's files by passing the appropriate -I
and -L flags
to the compiler, where points to a location in the package's
depot directory. When building "overwrite" packages, buildlink3 will
act and feel very much like buildlink2 but with more advanced wrapper
scripts, and there are provisions for allowing an "overwrite" package
to build against the viewed instance of a depoted package.
@
1.6
log
@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 ).
* 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 ).
* 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.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.5 2004/07/30 20:52:44 jlam Exp $
d62 1
a62 17
Q1: I'm trying to bl3ify a package but I get an error that looks like:
make: don't know how to make _BUILDLINK_USE. Stop
A1: You forgot to change a reference to a buildlink2.mk file into a
buildlink3.mk file.
Q2: Dependencies are added for every single buildlink3.mk file I
include, including for when it's supposed to use the base system
software. What's going on?
A2: You forgot to change USE_BUILDLINK2 to USE_BUILDLINK3 in the
package Makefile.
Q3: Where can I see the actual command executed by the wrapper
d65 1
a65 1
A3: You should examine the contents of the ${WRKDIR}/.work.log file.
d71 1
a71 1
Q4: Why can't I check the values of variables set by the buildlink3
d74 1
a74 1
A4: Some variables are only defined for a subset of the package build
@
1.6.2.1
log
@So that I don't lose all this work, stash the work-in-progress derecursion
cleanup onto the tv-derecurse branch (only branched in pkgsrc/mk).
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.6 2004/09/21 15:01:40 jlam Exp $
d85 9
@
1.6.2.2
log
@sync [all but bsd.pkg.mk] with HEAD
@
text
@d1 1
a1 1
$NetBSD$
d62 17
a78 1
Q1: Where can I see the actual command executed by the wrapper
d81 1
a81 1
A1: You should examine the contents of the ${WRKDIR}/.work.log file.
@
1.6.2.3
log
@EOL the tv-derecurse branch; it has become too outdated. The last live
revision can be fetched at the tv-derecurse-eol tag.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.6.2.2 2005/05/17 18:29:44 tv Exp $
@
1.5
log
@Update documentation for the current state of buildlink3.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.4 2004/05/08 23:46:20 grant Exp $
d31 1
a31 12
1.3 Support for native compilers
================================
The buildlink3 wrapper scripts have better support for using SunPro
and MIPSpro compilers to build pkgsrc software. For the most part,
packages can use any compiler, but some third-party software is
written assuming that it will be compiled using GCC. The buildlink3
wrapper scripts can capture some common GCC options and convert them
into native toolchain equivalents.
1.4 New buildlink3.mk file structure
d46 1
a46 1
1.5 Support for pkgviews
d90 2
a91 2
A4: Some buildlink3 variables are only defined for a subset of a
package build phases. Try instead:
d93 1
a93 1
make show-var PKG_PHASE=buildlink VARNAME=...'
@
1.4
log
@remove a word which shouldn't be there.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.3 2004/02/05 08:50:38 jlam Exp $
d70 1
a70 137
2 Writing buildlink3.mk files
=============================
A package's buildlink3.mk file is included by Makefiles to indicate
the need to compile and link against header files and libraries
provided by the package. A buildlink3.mk file should always provide
enough information to add the correct type of dependency relationship
and include any other buildlink3.mk files that it needs to find
headers and libraries that it needs in turn.
2.1 Simple packages
===================
To generate an initial buildlink3.mk file for further editting, Rene
Hexel's pkgtools/createbuildlink package is highly recommended. For
most packages, the following command will generate a good starting
point for buildlink3.mk files:
cd pkgsrc/category/pkgdir; createbuildlink -3 > buildlink3.mk
The following real-life example buildlink3.mk is taken from
graphics/tiff:
------------8<------------8<------------8<------------8<------------
# $NetBSD: BUILDLINK3_DG,v 1.3 2004/02/05 08:50:38 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
TIFF_BUILDLINK3_MK:= ${TIFF_BUILDLINK3_MK}+
.if !empty(BUILDLINK_DEPTH:M+)
BUILDLINK_DEPENDS+= tiff
.endif
.if !empty(TIFF_BUILDLINK3_MK:M+)
BUILDLINK_PACKAGES+= tiff
BUILDLINK_DEPENDS.tiff+= tiff>=3.5.4
BUILDLINK_PKGSRCDIR.tiff?= ../../graphics/tiff
. include "../../devel/zlib/buildlink3.mk"
. include "../../graphics/jpeg/buildlink3.mk"
.endif # TIFF_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
------------8<------------8<------------8<------------8<------------
The header and footer manipulate BUILDLINK_DEPTH, which is common
across all buildlink3.mk files and is used to track at what depth we
are in including buildlink3.mk files.
The first section controls if the dependency on tiff is added.
BUILDLINK_DEPENDS is the global list of packages for which
dependencies are added by buildlink3. The tiff package is only
appended to this list if the buildlink3.mk is included directly by a
package Makefile.
The second section is protected from multiple inclusion and control
how the dependency on tiff is added. Several important variables
are set in the section:
(1) BUILDLINK_PACKAGES is the global list of packages for which
buildlink3.mk files have been included. It must _always_ be
appended to within a buildlink3.mk;
(2) BUILDLINK_DEPENDS.tiff is the actual dependency recorded in the
installed package; this should always be set using += to ensure
that we're appending to any pre-existing list of values.
(3) BUILDLINK_PKGSRCDIR.tiff is the location of the tiff pkgsrc
directory;
(4) BUILDLINK_DEPMETHOD.tiff (not shown above) controls whether we
use BUILD_DEPENDS or DEPENDS to add the dependency on tiff. The
build dependency is selected by setting BUILDLINK_DEPMETHOD.tiff
to "build". By default, the full dependency is used.
(5) BUILDLINK_INCDIRS.tiff and BUILDLINK_LIBDIRS.tiff (not shown
above) are lists of subdirectories of ${BUILDLINK_PREFIX.tiff} to
add the header and library search paths. These default to
"include" and "lib" respectively.
(6) BUILDLINK_CPPFLAGS.tiff is the list of preprocessor flags to add
CPPFLAGS, which are passed on to the configure and build phases.
-I should be avoided and instead be added using
BUILDLINK_INCDIRS.tiff as above.
Any buildlink3.mk for tiff's dependencies are also included at this
point. Including these buildlink3.mk files means that the headers
and libraries for these dependencies are also symlinked into
${BUILDLINK_DIR} whenever the tiff buildlink3.mk file is included.
There are several considerations that arise when figuring out how
to set BUILDLINK_DEPENDS. correctly:
(1) If the package has a pre-existing buildlink2.mk file, then
match the BUILDLINK_DEPENDS. lines between the
buildlink2.mk file and the newly-created buildlink3.mk file.
(2) If there is no pre-existing buildlink2.mk file, then set
BUILDLINK_DEPENDS.foo to the first version of the package that
had the last change in the major number of a shared library or
that had a major API change.
2.1 Packages that coincide with base system software
====================================================
Some packages in pkgsrc install headers and libraries that coincide
with headers and libraries present in the base system. The best
recommendation for writing buildlink3.mk files for these packages is
to use graphics/MesaLib/buildlink3.mk as a template.
3 bl3ifying a package
=====================
The process of "bl3ifying" a package, or converting a package to use
the buildlink3 framework, is surprisingly easy. The things to keep in
mind are:
(1) Set USE_BUILDLINK3=yes.
(2) Change references to buildlink2.mk files into buildlink3.mk
files.
(3) Ensure that the build always calls the wrapper scripts instead of
the actual toolchain. Some are tricky, e.g. openssl, cdrecord,
ocaml, and the only way to know for sure is the check .work.log
to see if the wrappers are being invoked.
(4) Don't override PREFIX from within the package Makefile, e.g.
Java VMs, standalone shells, etc., because the code to symlink
files into ${BUILDLINK_DIR} looks for files relative to
"pkg_info -qp ".
4 Troubleshooting
@
1.3
log
@Touch up the grammar a bit in the last commit.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.2 2004/02/05 07:49:48 seb Exp $
d47 1
a47 1
generally don't have contain a BUILDLINK_FILES definition. This is
d95 1
a95 1
# $NetBSD: BUILDLINK3_DG,v 1.2 2004/02/05 07:49:48 seb Exp $
@
1.2
log
@Mention that some buildlink3 variables are not defined at all times.
Approved by jlam@@.
@
text
@d1 1
a1 1
$NetBSD: BUILDLINK3_DG,v 1.1 2004/01/29 06:03:15 jlam Exp $
d95 1
a95 1
# $NetBSD: BUILDLINK3_DG,v 1.1 2004/01/29 06:03:15 jlam Exp $
a232 2
Q4: Why variables set by the buildlink3 framework can't be seen with
'make show-var VARNAME=....'?
d234 7
a240 2
A4: Some buildlink3 variable are only defined for a subset of a package
build phases. Try 'make PKG_PHASE=buildlink VARNAME=...' instead.
@
1.1
log
@Commit the buildlink3 developer's guide and the pkgviews user's guide until
they're polished enough to be included into Packages.txt.
@
text
@d1 1
a1 1
$NetBSD$
d95 1
a95 1
# $NetBSD: buildlink3.mk,v 1.3 2004/01/05 11:05:46 jlam Exp $
d232 6
@