Commit graph

131 commits

Author SHA1 Message Date
jperkin
c64e041f6c mk: Miscellaneous performance improvements.
Inline ${RUN} calls where appropriate.  Call mkdir directly rather than via
a shell when invoked as a single command.  Avoid unnecessary mkdir calls.
2022-11-23 13:30:38 +00:00
adam
39d9d7cca4 cmake.mk: strip only for targets have USE_LANGUAGES 2022-08-12 08:26:01 +00:00
adam
e96ad8cd12 cmake.mk: install stripped binaries 2022-08-05 18:54:43 +00:00
riastradh
a1abd9761c mk: Cross-eyed hacks to support cross-libtool.
For a long time, when cross-building, say from native=amd64 to
target=powerpc, it was necessary to:

1. cross-build a _powerpc_ package called cross-libtool-base-powerpc,
   and then

2. install the powerpc package _natively_ with `pkg_add -m x86_64' to
   override the architecture check that normally forbids this kind of
   shenanigans,

in order to cross-build anything that uses libtool as a tool.

This is partly because libtool doesn't follow the normal GNU
convention of `./configure --build=<native platform> --host=<platform
package will run on> --target=<platform package is configured to
operate on>' -- in this example, build=amd64, host=amd64,
target=powerpc.

Instead, libtool expects to be cross-built itself, even if it's going
to run as a tool.  It's not as bonkers as it sounds at first: libtool
is just a shell script, and it caches various information about the
(cross-building!) toolchain it is built with so it can use that
information later when it is run as a tool itself to cross-compile
other software.

To make this work, we need to create the toolchain wrappers for
libtool _as if_ we were cross-building even if we are building a
native package.  So mk/tools uses a new flag TOOLS_USE_CROSS_COMPILE
instead of USE_CROSS_COMPILE, and libtool internally sets
MACHINE_ARCH=${TARGET_ARCH} (in the example above, powerpc) to make
it look like we're cross-building.  The new TOOLS_CROSS_DESTDIR is an
alias for the (defaulted) CROSS_DESTDIR, which must now be set
unconditionally in mk.conf in order for libtool to know where the
cross-destdir will be; _CROSS_DESTDIR remains empty when building any
native packages (including the native cross-libtool package).

Finally, we need to make the resulting package be a native package,
with MACHINE_ARCH set to the one that it will be installed on (in the
example above, amd64), so I added an indirection _BUILD_DEFS.${var}
to replace var on its own in the build definitions that get baked
into the package, shown by `pkg_info -B'.  Setting
_BUILD_DEFS.MACHINE_ARCH=${NATIVE_MACHINE_ARCH} ensures that this
mutant hybrid cross-built libtool still produces a native package.

All of this logic is gated on setting USE_CROSS_COMPILE in mk.conf or
LIBTOOL_CROSS_COMPILE in the package makefile, so it should be safe
for non-cross-builds -- when USE_CROSS_COMPILE=no and you're not
building cross-libtool, everything is as before.
2022-04-04 11:23:06 +00:00
gutteridge
2682c22633 replace-interpreter.mk: update a comment 2021-11-09 17:39:42 +00:00
gdt
f73ec6dfa2 mk/configure/cmake: Add comments about cmake
Explain that we should probably use cmake's RPATH support instead of
turning it off and passing it via LDFLAGS, but that this change seems
somewhat risky.

(This is a comment-only change.)
2021-10-20 23:42:13 +00:00
mef
d9cb952c25 (replace-interpreter.mk) Add REPLACE_R, tks rillig@ and greg@ 2021-09-09 21:59:36 +00:00
jperkin
ace9774189 mk: Enforce arm64 host CPU for Darwin/aarch64.
Fixes builds inside an x86_64 chroot where packages add x86-specific flags
based on the output of uname even though we're building for aarch64.  CMake
provides the CMAKE_APPLE_SILICON_PROCESSOR variable for this situation.
2021-07-17 06:34:20 +00:00
schmonz
0b38123be9 Add CMAKE_INSTALL_NAME_DIR, a package-settable variable containing the
destination directory to install shlibs. It's used on macOS by
install_name_tool(1). The default is ${PREFIX}/lib.
2020-08-12 14:10:11 +00:00
ryoon
c963102a49 mk/configure: Replace SET(CMAKE_MODULE_PATH... like 'set' too.
This will break print/scribus-qt4.
It uses CMAKE_MODULE_PATH as not a directory list.
It is wrong assumption.
2020-06-13 15:11:11 +00:00
rillig
2539de7edb mk/configure/replace-interpreter.mk: clean up show-all-interp variables 2020-06-07 06:10:36 +00:00
rillig
11dbf836d6 mk/configure: fix configure options check for custom CONFIGURE_SCRIPT
Seen in cross/arm-none-eabi-gdb.
2020-05-23 12:11:33 +00:00
rillig
4c58410ecc mk/configure: fix check for unknown configure options 2020-05-22 15:21:15 +00:00
rillig
dde6099996 mk/configure: remove outdated documentation 2020-05-21 21:05:51 +00:00
rillig
ecee64e6c9 mk/configure: add variable GNU_CONFIGURE_QUIET
This allows bulk builds or other setups to see interesting error
messages, without them being hidden in the noise of "checking ...".
2020-05-21 20:50:54 +00:00
rillig
6c80597618 mk/configure/gnu-configure.mk: disable built-in option check
The rewritten check for unknown configure options already checks for
options that are not defined anywhere.  After that, the configure scripts
don't need to check for these options anymore since all remaining options
are known to the package, in at least one of its configure scripts.
2020-05-21 15:29:25 +00:00
rillig
cc8614f669 mk/configure: completely rewrite check for unknown configure options
The previous implementation could not reliably detect outdated configure
options.  This was apparent in devel/gettext-tools, where the option
--with-included-libcroco had become unknown between May 2019 and May
2020, but the check was not run.

The behavior is the same in the pkgsrc default configuration.  Only if
GNU_CONFIGURE_STRICT=yes, the new check is activated and will make
packages fail that previously succeeded to build.  Since that variable is
not widely known, there won't be much sudden breakage, if any.
2020-05-21 13:42:10 +00:00
rillig
1126482bd5 mk/configure/replace-interpreter.mk: silently skip broken symlinks
Like directories, they probably come from shell globs.

Seen in misc/byobu.
2020-05-18 06:06:34 +00:00
rillig
bd18226445 mk/configure/cmake.mk: allow no-op SUBST block
For example, graphics/openjpeg on SunOS doesn't need it.
2020-05-12 17:36:20 +00:00
rillig
8e20d19199 mk/configure/pkg-config-override.mk: ignore no-op SUBST blocks
There are many .pc files that don't have a "Libs:" line.  That is totally
ok, therefore just skip these files.
2020-05-04 18:06:56 +00:00
rillig
cb79642b88 mk/configure/replace-localedir.mk: allow SUBST to be a no-op
Since the SUBST_FILES of this class are generated by running find(1) in
WRKSRC, there may be files that are unaffected by the substitution.
2020-03-30 22:57:18 +00:00
rillig
62a0adf4a6 replace-interpreter: make documentation more precise
There are several places in pkgsrc where the files to be patched are
listed individually instead of just saying util/*/*.sh. This is
unnecessarily detailed. Encourage package authors to use filename
patterns more often.

An example is REPLACE_PYTHON in lang/clang, which currently fails because
some of the listed files don't exist anymore.
2020-03-24 04:40:34 +00:00
rillig
a739837b20 mk/configure/replace-interpreter.mk: add missing empty line
The optional /usr/bin/env is independent from sh. It applies to all
languages.
2020-03-22 21:31:21 +00:00
rillig
0867698634 mk/configure: fix configure-env to cd to the correct directory
The previous "cd ${d}" had been a left-over from the .for loop around
CONFIGURE_DIRS.
2020-02-23 20:24:46 +00:00
rillig
2275f2d46a mk/configure: add configure-env target
This allows easy inspection of the realistic environment in which the
configure scripts are run.

The code is copied from the similar build-env target.

This might help to find the cause for pkg/54894, where "gcc -dumpversion"
is said to output 0 as the version number.
2020-02-09 20:33:38 +00:00
rillig
3e003dd7ca mk/configure: add more keywords for bmake help 2019-10-06 09:44:41 +00:00
rillig
0ff5dc4a46 mk: use a single form for headings in the documentation comments 2019-09-02 02:23:02 +00:00
rillig
b88d952e81 mk: allow "bmake clean depends" as shortcut
When "bmake clean depends" was called for a package where the various
cookie files already existed, these would enable different rules than a
clean package directory.

Since "bmake clean" deletes all the cookie files before "bmake depends"
starts, in these combined command lines the cookie files must be treated
as absent.
2019-05-07 19:36:43 +00:00
rillig
bc4f604de5 mk/configure: assist in finding unrecognized configure options
Instead of giving instructions, just to the work automatically as far as
it can be automated.
2019-05-04 15:16:50 +00:00
rillig
7ea001aa3f mk/configure: document how to fix GNU_CONFIGURE_STRICT failures 2019-05-04 08:43:06 +00:00
rillig
2c90b6c046 mk/configure: when there are multiple CONFIGURE_DIRS, print current dir
This helps to find out which of the several configure scripts has
problems, for example when checking for unknown command line options
using GNU_CONFIGURE_STRICT.
2019-04-28 13:18:18 +00:00
rillig
c3f5e8d4d1 mk/configure: mention CONFIGURE_DIRS in show-all-configure 2019-04-28 11:25:32 +00:00
rillig
21c0a41a76 mk: fix pkglint warnings about ambiguous variables
When a Makefile fragment contains $0, this means a Makefile variable, not
a shell or AWK variable.

The bug in ccc.mk survived unnoticed for almost 15 years. The bug in
gnu-configure.mk for MirBSD got only half as old.
2019-04-20 16:32:42 +00:00
rillig
fc81f83e6e mk/configure: allow strict option checking for GNU configure scripts
When a GNU configure script is run with unknown --enable, --disable,
--with or --without options, it doesn't fail but just prints a warning.
This hides outdated package definitions that may still pass options that
have been removed already.

See https://mail-index.netbsd.org/pkgsrc-users/2019/04/02/msg028272.html
for a recent case.

The default behavior doesn't change. After a period of testing this new
check, the check is expected to become enabled by default so that future
problems like this are prevented.
2019-04-03 19:10:26 +00:00
bsiegert
ce19293462 replace-interpreter.mk: support REPLACE_PERL6.
This is basically the same as REPLACE_PERL, except that there is a default
for ${PERL6} inline if it is not otherwise defined.
2019-02-18 14:10:37 +00:00
rillig
858c6cfd69 mk/misc: make configuration for show-all targets more configurable
Up to now, there was a central list of variable name patterns that
defined whether a variable was printed as a sorted list, as a list or as
a single value.

Now each variable group decides on its own which of the variables are
printed in which way, using the usual glob patterns. This is more
flexible since different files sometimes differ in their naming
conventions.

Two variable groups are added: license (for everything related to
LICENSE) and go (for lang/go).
2018-11-30 18:38:19 +00:00
adam
8e731eb460 Print a message if REPLACE_INTERPRETER does not change anything (similar to SUBST_) 2018-04-17 09:31:41 +00:00
chuck
a655dc59c4 add support for CMAKE_PKGSRC_BUILD_FLAGS
CMAKE_PKGSRC_BUILD_FLAGS
     If set to yes, disable compiler optimization flags associated
     with the CMAKE_BUILD_TYPE setting (for pkgsrc these come in from
     the user via variables like CFLAGS).  The default is yes, but you can
     set it to no for pkgsrc packages that do not use a compiler to avoid
     cmake "Manually-specified variables were not used by the project"
     warnings associated with this variable.
2018-04-08 19:11:27 +00:00
rillig
0e0d2af856 mk/configure/replace-interpreter.mk: document variables for show-all 2018-03-11 15:07:45 +00:00
rillig
ea32a33dbd mk/configure/replace-interpreter: add "make help" keywords 2018-03-11 14:59:14 +00:00
wiz
190c209fdf mk/configure/cmake.mk: Fix typos in comments. 2017-12-27 18:56:27 +00:00
jperkin
00697eb0c6 Update libtool packages to 2.4.6.
Changes since 2.4.2 are too numerous to mention, with over 4,700 lines
in the ChangeLog file.  However, this release does at least fix a large
number of build failures on SmartOS, and doesn't appear to cause any
obvious regressions in bulk builds performed by Joerg and myself.

Some pkgsrc cleanups while here, including merging the MirBSD patches
correctly.  It couldn't be made much clearer how to properly integrate
patches here to ensure they are not lost.  Next time you might not be so
fortunate!
2017-03-06 16:14:07 +00:00
kamil
5e0738fca8 Add support for overloading CMAKE_INSTALL_PREFIX
By default CMAKE_INSTALL_PREFIX points to PREFIX, but some software requres
custom subprefix. At least blender and brlcad are in this category.

To set new prefix it's sufficient to set CMAKE_INSTALL_PREFIX in a package,
for example (in brlcad):

CMAKE_INSTALL_PREFIX=${PREFIX}/brlcad

Reviewed by <joerg> and <jperkin>.
2016-10-21 11:13:35 +00:00
jperkin
9bd8757b52 Remove overrides for OPENAL_INCLUDE_DIR and OPENGL_INCLUDE_DIR. These
conflict with pkgsrc versions of those packages, and do not interact well
with the wrappers anyway as cmake will perform simple file-based tests for
headers but the compiler will be unable to find them.
2016-02-24 15:24:56 +00:00
joerg
ee75c51786 Add a new override mechanism for depcomp, similar to the existing
overrides for libtool. This allows us to easily get the fixed version
from our libtool in place without having to hunt down for the specific
bugs in random places. Disable the override explicitly in clisp, which
installs a copy without explicitly depending on libtool at run time.
2016-02-23 15:19:23 +00:00
joerg
81428e7010 Drop _LIBTOOL and _SHLIBTOOL and make LIBTOOL and SHLIBTOOL point to the
wrapped version by full path. This fixes some cases where the wrappers
have been bypassed. lang/lua52 triggered the investigation as it failed
to link against libreadline, which should have been translated to
libedit. Tested by jperkin and myself with full bulk builds.
2015-05-04 19:23:19 +00:00
obache
e0b1a878dc Introduce CMAKE_USE_GNU_INSTALL_DIRS,
If set to yes, set GNU standard installation directories with pkgsrc
configured settings for cmake GNUInstallDirs module.
The default is yes.
2014-09-06 01:50:38 +00:00
wiz
785572fa7f Add CMAKE_PREFIX_PATH variable that can be used by packages that install
their files in non-standard locations (e.g., qt5).
From Niclas Rosenvik.
2014-08-23 19:26:07 +00:00
obache
5dccb01f08 Prevent to update timestamp of configure script with pkgsrc specific override.
It may be triger of unwanted rebuild.
2014-08-23 03:00:18 +00:00
wiz
2466e284ca iRename SUBST_CLASS to _pkgconfig (adding a '_') to avoid conflicts
with packager-chosen prefixes (as with portaudio-devel recently).
2014-07-21 12:10:40 +00:00