Commit graph

298 commits

Author SHA1 Message Date
joerg
005620851f Add core of the infrastructure support for cross-compilation.
- USE_CROSS_COMPILATION activates it, CROSS_DESTDIR specifies root of
  the target filesystem
- derive _CROSS_DESTDIR from CROSS_DESTDIR or MAKEOBJDIR
- buildlink3.mk prefixes the files to symlink with _CROSS_DESTDIR
- compiler/gcc.mk knows about the target prefix (e.g. i386--netbsdelf)
- PKG_DBDIR is prefixed with _CROSS_DESTDIR
- package-install and bin-install are not called with su
- install and strip are redirected to the tool version
- links for the target specific ar, as, ld, nm, objdump, ranlib and
  strip are added
- compiler wrapper detect if linking is requested or not
- special command sinks for CPP and CC/CXX add the cross-compile magic:
  - modify include dirs to get the target /usr/include
  - modify linker dirs and runpath to use target /usr/lib at link time,
    but keep correct rpath entries

Supported-by: Google SoC 2007
Basic tests by he@ on Sparc. Review from jlam@.
2007-08-02 18:19:31 +00:00
tnn
bd630c4f6f If using X11_TYPE=modular this means we have imake(1) from pkgsrc.
We can't use our own imake to check for builtin packages so disable the
check and always report that no builtin implementation exists.
No objections on tech-pkg@
2007-07-27 17:44:43 +00:00
joerg
1181f7164e Remove remaining traces of BUILDLINK_TRANSFORM.${pkg}. 2007-07-27 13:15:41 +00:00
joerg
de82d7fa12 *blush* One variable was missing for the !modular case. 2007-07-23 15:25:20 +00:00
joerg
a3551a9262 More aggressively conditionalize X11BASE handling. Only one case
is left now and that is hidden by LOCALBASE=X11BASE for modular Xorg.
2007-07-23 13:22:11 +00:00
rillig
fc0688ff52 Added _VARGROUPS. 2007-06-06 09:29:53 +00:00
tron
aef83eee53 Remove special treatment of "DynaLoader.a" completely. It's not necessary
with current libtool version and breaks the build under Darwin 8.x and
NetBSD 4.0_BETA2.
2007-04-09 22:33:26 +00:00
tron
f2c3793d4d Don't handle Perl's "DynaLoader.a" specially under Mac OS X. It is not
necessary and doing so causes build problems.

This fixes PR pkg/35990.
2007-03-12 19:19:45 +00:00
joerg
cb3b0ff71b Absolute never use .x11-buildlink. Some cases get nasty to fix, so
back to this.
2007-01-25 15:37:12 +00:00
rillig
5acfb0b6ca Renamed BUILDLINK_TRANSFORM.* to BUILDLINK_FNAME_TRANSFORM.*, to make
clear that these variables are completely unrelated to
BUILDLINK_TRANSFORM.

Added a legacy check that catches appearances of BUILDLINK_TRANSFORM.*.

XXX: Where should incompatible changes in pkgsrc be documented?
2007-01-17 03:11:18 +00:00
joerg
79c5c99c4d For modular Xorg disable xpkgwedge (will be made a hard error later).
Don't add ${X11BASE}/bin to PATH, don't include mk/x11.buildlink3.mk
when USE_X11BASE is set and don't use BUILDLINK_X11_DIR and related
magic.

OKed by wiz@
2006-12-20 01:04:46 +00:00
martti
e2610fb8c8 Remove trailing tabs. 2006-12-15 13:15:06 +00:00
martti
2cc4216d5e Remove trailing spaces. 2006-12-15 12:46:23 +00:00
rillig
98b52d5edd Added a check for whether X11BASE is set correctly. Currently the error
message is

    Syntax error: word unexpected (expecting ")")

which is not helpful at all.
2006-11-17 09:19:37 +00:00
rillig
9855d392a6 Fixed two scripts so that they also run when "set -u" is in effect. 2006-11-09 02:07:59 +00:00
joerg
ca28d631e8 Special case LOCALBASE before X11BASE, as they can be identical in
the case of modular Xorg and the latter is more specific.
2006-11-05 14:39:11 +00:00
schwarz
94201593d3 ensure that -I and -L paths are correctly rewritten even if ${LOCALBASE}
contains ${X11BASE} (e.g. ${LOCALBASE} being /usr/local and ${X11BASE} being
/usr)
2006-09-10 19:49:53 +00:00
tron
5311471179 Fix PR pkg/34139 in a diffent way:
Setting "WRAPPER_SKIP_TRANSFORM" to "yes" isn't enough because "imake"
will invoke the C compiler which might be a wrapper script which always
fails because the package didn't use "USE_LANGUAGES+= c".

The "imake-check" script now simply uses the original command path before
"bsd.pkg.mk" modified and will therefore avoid using any wrappers.
2006-09-10 16:39:31 +00:00
hira
0dbc81e89e Call imake(1) with `WRAPPER_SKIP_TRANSFORM=yes'. The arguments
should not be transformed by wrapper.  This fixes PR pkg/34139.
Reviewed by tron@.
2006-09-03 13:07:59 +00:00
dmcmahill
e141f363dc Add missing $NetBSD$ 2006-08-28 13:27:41 +00:00
jlam
76a1020667 Drop .ORDER declarations since pkgsrc doesn't support "make -j ...". 2006-08-09 15:31:01 +00:00
jlam
77b719dae8 Modify the barrier so that we always invoke the recursive make process
when passing through the barrier.  This ensures the PATH (passed via
PKGSRC_MAKE_ENV) is correctly set for all phases after the barrier.

This fixes a bug in "interactive" pkgsrc use, where if you have no
work directory and type "make build && make install", then the "install"
step does not have a PATH set to include all the wrapper and tools
directories.
2006-07-22 16:31:35 +00:00
wiz
41f2051ba0 Fix typo in comment. 2006-07-10 17:10:18 +00:00
jlam
d25e37d084 Always add dependencies for packages pulled in indirectly buildlink3 that
are build dependencies.  This should fix PR pkg/33940.  Thanks to Joerg
for the debugging hint.
2006-07-10 17:06:26 +00:00
jlam
c16221a4db Change the format of BUILDLINK_ORDER to contain depth information as well,
and add a new helper target and script, "show-buildlink3", that outputs
a listing of the buildlink3.mk files included as well as the depth at
which they are included.

For example, "make show-buildlink3" in fonts/Xft2 displays:

	zlib
	fontconfig
	    iconv
	    zlib
	    freetype2
	    expat
	freetype2
	Xrender
	    renderproto
2006-07-08 23:10:35 +00:00
jlam
356f5e8af5 Rename <phase>_COOKIE variables to _COOKIE.<phase>. These are private
variables so there are no user-visible changes.  This change just makes
it a little easier to write for loops.
2006-07-07 21:24:27 +00:00
jlam
b8d23232b8 Flatten out recursive makes into a single re-invocation of make by
introducing the concept of a "barrier".  We separate the user-invokable
targets into ones that must happen before the barrier, and ones that
must happen after the barrier.  The ones that happen after the barrier
are run in a sub-make process.  In this case, the targets that must
be run after the barrier are from the "wrapper" step and beyond.  We
rewrite the various "flow" targets, e.g. wrapper, configure, build,
etc., so that they of the right form to use the barrier target.

This now completely removes the concept of PKG_PHASE from pkgsrc.  It
is replaced with the concept of "before" and "after" the barrier, and
this state can be checked by testing for the existence of the barrier
cookie file.  Because we've removed most of the recursive makes, there
is now nowhere to hook the PKG_ERROR_HANDLER.* commands, so remove
them for now.

As part of this commit, put back the logic that conditionalized the
sources for the various cookie files.  Because the sources are all
"phony" targets, they were always run, regardless of whether or not
the cookie file already existed.  Now, if a cookie file exists, then
that entire phase associated with that cookie file is skipped.

Lastly, fix a thinko in configure/bsd.configure.mk where setting
NO_CONFIGURE in a package Makefile would manage to skip the "wrapper"
step altogether.  Fix this by correctly noting "wrapper" and not
"patch" as the preceding step to "configure".
2006-07-05 22:21:02 +00:00
rillig
98b01c2c50 pkglint says, the :Q operator should not be used in double quotes.
The code here only worked due to many conincidences: Let's assume a
variable has the value "a b" and is used with the :Q operator, which
results in "a\ b" (a, backslash, space, b). When used in double quotes,
the shell command looks like:

    echo "a\ b"

which, depending on the shell, may output the backslash literally or
not. In the case of this file, the ":Q" string was not passed to
echo(1), but to sed(1). sed(1) in turn interprets (backslash, space) in
the replacement text as equivalent to (space), and that's where the
backslash finally disappears. So it's only to this coincident that the
code worked although it was not correct.
2006-06-09 06:02:33 +00:00
jlam
c82571cd2d Use ERROR_MSG for an error message. 2006-06-07 17:35:49 +00:00
jlam
fd7633a630 Remove PKG_PHASEs that no longer exist from the various *_PHASE_* lists. 2006-06-06 06:44:01 +00:00
joerg
ef19a5e7db Band-aid for dependency handling due to the stricter rules from the
dependency cookie. We now want all dependencies in the default phase,
since depends is run before/outside real-extract. This can be seen
e.g. by textproc/troffcvt, which has a build dependency in a build
dependency. Discussed and tested with seb@.
2006-06-04 21:04:45 +00:00
reed
a36ea4e941 If USE_ABI_DEPENDS=no, do not add the BUILDLINK_ABI_DEPENDS.$pkg
to BUILD_DEPENDS. (I posted about this to pkgsrc-users on April 14.)
2006-05-06 03:28:44 +00:00
jlam
28856457ab If we can't find the package with pkg_info when computing BUILDLINK_PREFIX,
make the resulting error message more useful for debugging purposes
by including the name of the variable in a null statement that is part
of the command executed.
2006-04-14 16:59:04 +00:00
tron
346770d72d Correct typo in example Makefile snippet. 2006-04-10 12:25:43 +00:00
reed
5abef9be14 Over 1200 files touched but no revisions bumped :)
RECOMMENDED is removed. It becomes ABI_DEPENDS.

BUILDLINK_RECOMMENDED.foo becomes BUILDLINK_ABI_DEPENDS.foo.

BUILDLINK_DEPENDS.foo becomes BUILDLINK_API_DEPENDS.foo.

BUILDLINK_DEPENDS does not change.

IGNORE_RECOMMENDED (which defaulted to "no") becomes USE_ABI_DEPENDS
which defaults to "yes".

Added to obsolete.mk checking for IGNORE_RECOMMENDED.

I did not manually go through and fix any aesthetic tab/spacing issues.

I have tested the above patch on DragonFly building and packaging
subversion and pkglint and their many dependencies.

I have also tested USE_ABI_DEPENDS=no on my NetBSD workstation (where I
have used IGNORE_RECOMMENDED for a long time). I have been an active user
of IGNORE_RECOMMENDED since it was available.

As suggested, I removed the documentation sentences suggesting bumping for
"security" issues.

As discussed on tech-pkg.

I will commit to revbump, pkglint, pkg_install, createbuildlink separately.

Note that if you use wip, it will fail!  I will commit to pkgsrc-wip
later (within day).
2006-04-06 06:21:32 +00:00
hira
ed44db6a86 Fix build of the packages which pass .la files to libtool by relative
path.  This allows to use symbolic linked path as WRKOBJDIR and should
fix PR pkg/31337.
2005-12-09 16:16:41 +00:00
jlam
35be7aab3b If we need imake, then also pull in any other tools that imake needs to
work.
2005-08-10 16:28:59 +00:00
jlam
ca47ca0ada Hardcode a workaround for perl's DynaLoader.a which is definitely a
PIC code archive, but libtool isn't smart enough to realize it.  Munge
the name within cmd-sink-libtool into something that will make libtool
recognize it as a PIC code archive.  We unmunge it in arg-pp-main so
non-libtool wrappers see the right thing.  This let's us use libtool
to link applications with an embedded Perl interpreter.

I feel so dirty...
2005-08-05 19:46:41 +00:00
jlam
40b99e5f80 Tools that are marked with ":pkgsrc" are needed very early on, probably
too early for pkgsrc to adequately cope.  In this case, imake-check.mk
was marking "imake" as a tool that was used to perform some tests.
This was causing xpkgwedge to be unnecessarily marked as a build
dependency since using imake in pkgsrc pretty much requires xpkgwedge.
However, in the case where we are running the "imake checks", we don't
need xpkgwedge around.

Solve this issue by marking all the tools in imake-check.mk with
":pkgsrc", and modify the xpkgwedge dependency test to not care about
"imake:pkgsrc".
2005-07-19 23:01:55 +00:00
jlam
bf9129c41e Drop distinction between PKGSRC_USE_TOOLS and USE_TOOLS by making
PKGSRC_USE_TOOLS go away.  There is now only a single USE_TOOLS variable
that specifies all of the tools we need to build/run the package.
2005-07-15 18:27:48 +00:00
jlam
4149dcc90e We were writing the wrong directory path for the location to the
uninstalled libtool archive in the case where we build it into some
place other than the current directory.  Older versions of libtool
didn't allow you to build a *.la file anywhere other than the current
directory, and libtool-fix-la made use of this assumption in libtool's
behavior.  More recent versions of libtool *do* let you build a *.la
file anywhere you'd like, so instead of blindly assuming it's the
current directory, use the path to the argument of the -o option.
This embeds the proper directory path into the uninstalled libtool
archive.

This has no impact on packages that just build libtool archives into
the current directory.  The packages that *are* impacted are the ones
that:

   (1) pkgsrc converted to use libtool, and,
   (2) build shared libraries that are linked into other things
       as part of the build, and,
   (3) builds the libtool archives in some place other than the
       current directory.
2005-06-22 21:08:37 +00:00
jlam
809759a4de Allow for explicit PREFER.<pkg> settings to override PREFER_NATIVE and
PREFER_PKGSRC.
2005-06-20 05:44:17 +00:00
jlam
b9ac1b57c0 Avoid generating a blank line as the first command of a target as that
isn't understood by some make programs, e.g. /usr/ccs/bin/make.
2005-06-15 17:54:59 +00:00
jlam
08c60ab83d Coalesce the common makefile code in the builtin.mk file that inspect
the X11 distribution using imake into mk/buildlink3/imake-check.mk.
imake-check.mk calls out to a helper shell script mk/buildlink3/imake-check
that generates the required Imakefiles and runs imake.  Remove the
now extraneous builtin-imake.mk files as the builtin.mk files can now
contain the name of the imake symbol to check.
2005-06-03 19:12:49 +00:00
jlam
95fd1f6ec9 Massive cleanup of buildlink3.mk and builtin.mk files in pkgsrc.
Several changes are involved since they are all interrelated.  These
changes affect about 1000 files.

The first major change is rewriting bsd.builtin.mk as well as all of
the builtin.mk files to follow the new example in bsd.builtin.mk.
The loop to include all of the builtin.mk files needed by the package
is moved from bsd.builtin.mk and into bsd.buildlink3.mk.  bsd.builtin.mk
is now included by each of the individual builtin.mk files and provides
some common logic for all of the builtin.mk files.  Currently, this
includes the computation for whether the native or pkgsrc version of
the package is preferred.  This causes USE_BUILTIN.* to be correctly
set when one builtin.mk file includes another.

The second major change is teach the builtin.mk files to consider
files under ${LOCALBASE} to be from pkgsrc-controlled packages.  Most
of the builtin.mk files test for the presence of built-in software by
checking for the existence of certain files, e.g. <pthread.h>, and we
now assume that if that file is under ${LOCALBASE}, then it must be
from pkgsrc.  This modification is a nod toward LOCALBASE=/usr.  The
exceptions to this new check are the X11 distribution packages, which
are handled specially as noted below.

The third major change is providing builtin.mk and version.mk files
for each of the X11 distribution packages in pkgsrc.  The builtin.mk
file can detect whether the native X11 distribution is the same as
the one provided by pkgsrc, and the version.mk file computes the
version of the X11 distribution package, whether it's built-in or not.

The fourth major change is that the buildlink3.mk files for X11 packages
that install parts which are part of X11 distribution packages, e.g.
Xpm, Xcursor, etc., now use imake to query the X11 distribution for
whether the software is already provided by the X11 distribution.
This is more accurate than grepping for a symbol name in the imake
config files.  Using imake required sprinkling various builtin-imake.mk
helper files into pkgsrc directories.  These files are used as input
to imake since imake can't use stdin for that purpose.

The fifth major change is in how packages note that they use X11.
Instead of setting USE_X11, package Makefiles should now include
x11.buildlink3.mk instead.  This causes the X11 package buildlink3
and builtin logic to be executed at the correct place for buildlink3.mk
and builtin.mk files that previously set USE_X11, and fixes packages
that relied on buildlink3.mk files to implicitly note that X11 is
needed.  Package buildlink3.mk should also include x11.buildlink3.mk
when linking against the package libraries requires also linking
against the X11 libraries.  Where it was obvious, redundant inclusions
of x11.buildlink3.mk have been removed.
2005-06-01 18:02:37 +00:00
xtraeme
b433ad3e49 Add BUILTIN_PACKAGES, this will contain all builtin dependencies used
in packages, e.g on my NetBSD system:

$ cd pkgsrc/graphics/gimp && make show-var VARNAME=BUILTIN_PACKAGES
bzip2 heimdal openssl db1 gettext iconv zlib pthread
$

Ok'ed by jlam.
2005-05-24 15:41:05 +00:00
jlam
80f5031e99 Add a new file find-libs.mk that can be included by builtin.mk files
to detect the presence of libraries in the base system.

The input variable is BUILDLINK_FIND_LIBS, which is a list of library
names, e.g. ncurses, iconv, etc., that will be sought in the base
system.  BUILDLINK_LIB_FOUND.<lib> is set to "yes" or "no" depending
on the result of the search.

An example use is:

BUILDLINK_FIND_LIBS:= intl iconv
.include "../../mk/buildlink3/find-libs.mk"
# ${BUILDLINK_LIB_FOUND.intl} and ${BUILDLINK_LIB_FOUND.iconv} are now
# either "yes" or "no".
2005-05-24 03:44:04 +00:00
jlam
0dbd0c0762 Rename MAKE_VARS to MAKEVARS so that it more closely resembles
"MAKEFLAGS".  Both "MAKEVARS" and "MAKEFLAGS" affect the package-level
make process, not the software's own make process.
2005-05-11 22:08:18 +00:00
jlam
03e9337879 Teach bsd.pkg.mk to create a phase-specific "makevars.mk" file that
caches variable definitions that were computed by make.  These variables
are specified by listing them in MAKE_VARS, e.g.,

	.if !defined(FOO)
	FOO!=	very_time_consuming_command
	.endif
	MAKE_VARS+=	FOO

bsd.pkg.mk will include only the one generated during the most recent
phase.  A particular phase's makevars.mk file consists of variable
definitions that are a superset of all of the ones produced in previous
phases of the build.

The caching is useful because bsd.pkg.mk invokes make recursively,
which in the example above has the potential to run the very time-consuming
command each time unless we cause FOO to be defined for the sub-make
processes.  We don't cache via MAKE_FLAGS because MAKE_FLAGS isn't
consistently applied to every invocation of make, and also because
MAKE_FLAGS can overflow the maximum length of a make variable very
quickly if we add many values to it.

One important and desirable property of variables cached via MAKE_VARS
is that they only apply to the current package, and not to any
dependencies whose builds may have been triggered by the current
package.

The makevars.mk files are generated by new targets fetch-vars,
extract-vars, patch-vars, etc., and these targets are built during
the corresponding real-* target to ensure that they are being invoked
with PKG_PHASE set to the proper value.

Also, remove the variables cache file that bsd.wrapper.mk was generating
since the new makevars.mk files provide the same functionality at a
higher level.  Change all WRAPPER_VARS definitions that were used by
the old wrapper-phase cache file into MAKE_VARS definitions.
2005-05-09 05:06:55 +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