Commit graph

98 commits

Author SHA1 Message Date
jperkin
b5a2d55ae0 mk: Add support for newer C standards.
For now the GCC "c99 == gnu99" override is kept, but gnu99 is now supported as
a specific value for USE_LANGUAGES, so we may want to be specific where
required.

c11 and c17 (and the corresponding gnu11/gnu17 versions) are newly supported.
2022-07-05 17:32:24 +00:00
riastradh
a649e3b771 mk: Use CWRAPPERS_PREPEND for --sysroot.
Looks like maybe the -Wl,-rpath-link business isn't necessary after
all -- will leave this as is until I find evidence otherwise.  (joerg
says it was a workaround for NetBSD toolchain parts that weren't
properly adapted to use sysroot.)

With this, revert cwrappers version dependency to what it was before.
But keep it as TOOL_DEPENDS, not BUILD_DEPENDS.
2022-04-10 19:54:02 +00:00
wiz
b3c710176f mk: add c++20 and gnu++20 2021-12-03 07:40:26 +00:00
rillig
c42fb662dc mk/compiler.mk: check for too late GCC_REQD and USE_LANGUAGES
For USE_LANGUAGES there is already a pkglint warning, but for GCC_REQD it
is missing.  It's better to have this check directly in the
infrastructure since it is more reliable.

This check is disabled by default, to not cause any new breakage.
It should be enabled in bulk builds.
2020-06-02 06:58:13 +00:00
gdt
743636bc54 mk/compiler.mk: Add c++17
We have a new language making its way into pkgsrc: C++17!  Add gnu++17
and c++17 to the list of _CXX_STD_VERSIONS.
2019-07-23 13:57:04 +00:00
ryoon
a73d906dd6 Do not pass -std=c++03 to GCC 4.4
No objection on tech-pkg@.
2019-07-15 16:06:19 +00:00
ryoon
61d8f528cd Fix a typo in flag in comment 2019-06-26 00:22:56 +00:00
rillig
2e8773d102 mk/compiler.mk: replace empty lines with empty comments
This is necessary for "bmake help" to interpret the whole comment as a
single block.
2019-02-22 00:06:46 +00:00
jperkin
71e098497c mk: Add CTF infrastructure support.
Platform support is determined by _OPSYS_SUPPORTS_CTF from mk/platform, the
user enables support by setting PKGSRC_USE_CTF=yes, and packages can
explicitly disable support with CTF_SUPPORTED=no or skip certain files with
CTF_FILES_SKIP.

The path to ctfconvert is configured via TOOLS_PLATFORM.ctfconvert.

If all of the requisite variables are enabled, a compiler-specific debug flag
is passed via the wrappers to ensure we have DWARF information to convert,
_INSTALL_UNSTRIPPED is explicitly defined to avoid binaries being stripped
prior to conversion, and the conversion is performed during the install stage.

It is recommended that users who enable the feature also set STRIP_DEBUG=yes
to reduce the final binary size once the conversion has been performed.

This has been used for the past year in Joyent SmartOS builds.  FreeBSD is
marked as supported but is untested.
2018-11-12 14:22:58 +00:00
rillig
bd80bac9a0 mk/compiler.mk: sort supported compilers alphabetically 2018-08-12 19:36:40 +00:00
jperkin
0a552fe622 mk/compiler.mk: Support gnu++03 and c++03 in USE_LANGUAGES.
These can be used by packages when building with a compiler which defaults
to a newer standard than the source supports (e.g. namespace issues).
2018-01-26 13:14:35 +00:00
gdt
6d81083d0b Improve USE_LANGUAGES explanation
Reference the notion of making compilers visible to the build
environment.  Mention setting --std flags.  Note that the text is
currently aspirtational relative to gcc and C++.

(Comment change only.)
2017-07-04 14:35:55 +00:00
kamil
9e8b293e05 Restore c++ support in ccache.mk
The ccache.mk file was checking for languages "c" and "c++".
New framework for C++ dialects (or revisions) was setting implicitly c++,
translating e.g. c++11 to c++.

compiler.mk set this c++ after including ccache.mk, so c++ was undefined
and ccache was ignored.

This helps to build large projects like LLVM+Clang+LLDB with ccache.

Sponsored by <The NetBSD Foundation>
2017-06-10 11:32:32 +00:00
jperkin
c657f15637 Consolidate setting of SSP flags now that multiple compilers support it. 2017-05-18 08:14:08 +00:00
jperkin
6004c83509 Add support to USE_LANGUAGES for C++ standards from c++0x to gnu++14.
This allows packages to specify the version of the standard that they
require, and the infrastructure then distils that down in a similar way
to GCC_REQD to the newest standard, avoiding clashes with different -std
requirements based on CXXFLAGS.

Broad concensus on tech-pkg and tested in bulk builds.
2017-05-03 08:34:23 +00:00
joerg
8c3ea2e438 Prepend the ABI flags to allow interested programs like qemu to
overwrite them on demand. This allows building ROM images and the like
with a special target ABI. Discussed a while ago with jperkin.
2016-11-10 20:59:43 +00:00
joerg
5c41f332c4 Pass down ABI flags for cwrappers too. 2014-12-09 23:43:29 +00:00
marino
7f074928a4 compiler.mk: Fix Ada packages when PKGSRC_COMPILER=clang
Only one compiler is used when "ada" is listed in LANGUAGES, and that
is the one built by the lang/gcc-aux source package.  When PKGSRC_COMPILER
is defined as anything else other than "gcc", the Ada packages fail to
build.  This can be seen when clang is used with CLANGBASE=${LOCALBASE}.

This straight-forward fix is to override the user specification of
PKGSRC_COMPILER when Ada is specified and define it as "gcc" in all cases.
Tested on NetBSD 6.1 amd64 with CLANGBASE=${LOCALBASE}
2013-07-07 09:06:23 +00:00
marino
b37304e0ba compiler.mk, gcc.mk: Implement DRAGONFLY_CCVER
DragonFly has two compilers in base, GCC 4.4.7 and GCC 4.7.2.
The way one switches between them for userland programs is to set
CCVER in the environment.

However, to set this via make.conf is tricky.  I've been using the
low level "ALL_ENV+= CCVER=gcc47", but this trick fails to properly
identify the compiler which results in _GCC_VERSION being incorrectly
defined.

Additionally, there are some prominent packages that do not build on
gcc 4.7 and the fix is either not fully understood or would require a
large amount of work to implement.  In these cases, it is desireable
to specify the package be built on gcc 4.4 regardless of CCVER setting.

To address these issues, a new directive is added: DRAGONFLY_CCVER.
It is only effective if OPSYS equals "DragonFly", and it will properly
set CCVER and properly define _GCC_VERSION.  It will also allow a
per package specification of a particular compiler in the pkg makefile.
2012-12-12 20:49:01 +00:00
jperkin
d0e2c023a0 _LINKER_ABI_FLAG.* is not set anywhere in pkgsrc, remove to avoid confusion. 2012-08-09 12:32:41 +00:00
jperkin
c6c9a7bd28 Ensure the Fortran wrappers specify the correct ABI if necessary. Fixes a
bunch of packages on Solaris when ABI=32 with 64-bit compilers.
2012-08-09 12:16:24 +00:00
marino
1a21fb3999 compiler.mk/gcc.mk: Add support for USE_LANGUAGES+= ada
All recent packages featuring Ada code have a hard dependency on the
lang/gnat-aux compiler package.  The valid values for USE_LANGUAGES
are c, c99, c++, fortran, fortran77, java, objc, so specifying a
specific compiler was necessary up into now.

One problem with lang/gnat-aux is that it is installed at ${LOCALBASE}
where the lang/gccXX compilers are installed at ${LOCALBASE}/gccXX.
The latter compilers have no possibility of sharing conflicting files
unlike lang/gnat-aux.  Rather than fundamentally update the GCC 4.6-based
lang/gnat-aux to avoid these conflicts, a new Ada-capable compiler
based on GCC 4.7 was created with the intent of being supported by
mk/compiler.mk and mk/compiler/gcc.mk.

The Ada packages will be effectively migrated from lang/gnat-aux to the
new lang/gcc-aux compiler, but lang/gcc-aux will remain as a standalone
package as it is the only GCC 4.6-based compiler that builds on
DragonFly and serves it as a world and kernel compile option.

In addition to the current language wrappers, lang/gcc-aux adds
wrappers for "ada" (unique to gcc-aux, hardlinked to gcc driver),
and the gnat, gnatmake, gnatbind, gnatlink, gnatchop, gnatprep,
and gnatls programs.  Supporting all of these allows the wrapper
system to be used with Ada packages; currently wrappers are mostly
disabled on them.

The lang/gcc47 implicitly adds support for the "objc-c++" language by
adding it to the USE_LANGUAGES list, but it wasn't really supported.
An attempt was made to better support objc-c++, but this new enumeration
probably still needs work or needs to be removed completely.

Logic for Ada support:
1) All lang/gccXX compilers have version numbers ranging from 2.8.1 to 9.
2) lang/gcc-aux uses the release date as its version number in the form of
   YYYYMMDD with a minimum value of 20120614, so there is no version
   overlap.
3) When at least one element of USE_LANGUAGES is "ada", the value of
   20120614 is added to the set of GCC_REQD which selects lang/gcc-aux.
4) The _NEED_NEWER_GCC check is disabled.  It fails and isn't relevant;
   unless a package sets GCC_REQD over 20120614, the only way to select
   lang/gcc-aux is to specify the Ada language and only one compiler
   known to gcc.mk can support it.
2012-07-08 19:57:10 +00:00
jperkin
a558677b69 Ensure the Solaris native linker is used by default, avoids conflicts
where GNU ld is picked up first via $PATH.
2012-06-27 13:36:08 +00:00
sbd
a3a8f22dec Move USE_PKGSRC_GCC from compler.mk to compler/gcc.mk and make it a yes/no
check.

At the same time cleanup GCC_REQD.
2012-04-13 03:03:36 +00:00
obache
6e1df85eb5 Revert unwanted part (uncompleted msc support) from last commit. 2010-11-17 08:40:22 +00:00
obache
69751f66c2 Replaced with ASCII char `-'. 2010-11-17 08:38:15 +00:00
ahoka
5d1d297d1f Add support for clang. 2010-09-23 22:26:06 +00:00
asau
00e9b1c1b3 Implement "fortran77" as alias for "fortran". 2010-07-30 07:58:58 +00:00
markd
1d907d5432 Add g95 support to the compiler framework, based on the existing f2c
support.
2009-07-08 21:17:16 +00:00
joerg
9377afae3f Rename GCC_USE_SYMLINKS to COMPILER_USE_SYMLINKS, implement it for the
other compiler drivers and enable it by default. Saves at least a
percent of build time even for trivial packages like lang/lua.
2009-05-30 18:16:26 +00:00
wiz
105c17b263 Grammar fix in error message. 2008-10-20 20:44:49 +00:00
ahoka
214839f848 Sanitise the error message of the fail-wrapper:
- Use PGKSRC-WARNING to note it's coming from pkgsrc and not always fatal.
 - Describe more precisely what's happening when you get this warning.

Hopefuly this will stop the misundersanding of the error message I could
see quite often amongst users.
2008-10-20 18:33:50 +00:00
rillig
f17ed773f1 Added a keyword for "bmake help". 2008-02-13 09:00:52 +00:00
rillig
66736dde43 Replaced _PKG_SILENT and _PKG_DEBUG with RUN. 2008-02-07 21:36:13 +00:00
rillig
b2e71313c3 Made the .include lines simpler. 2007-10-17 10:43:36 +00:00
rillig
1fcdecd105 Added variable descriptions. 2007-09-20 17:28:48 +00:00
reed
edb3562456 For Portable C Compiler.
Add beginning of PKGSRC_COMPILER=pcc support.
Based on "sunpro".

Please help improve this. I have not tested with C++ or fortan.
2007-09-18 01:51:10 +00:00
rillig
ac3ee7770d There was one ">" too much, so the fail-wrapper warning was printed
multiple times.
2007-06-09 18:44:37 +00:00
rillig
4e653a34ec Changed the wording of the warning messages when a compiler-fail-wrapper
is run. As a new feature, an error message is printed when the wrapper
is called, so that there is a better trace to it than a completely empty
output.

See also: http://mail-index.netbsd.org/tech-pkg/2007/06/08/0017.html
2007-06-08 20:48:16 +00:00
tnn
409fd2c40a add support for the HP-UX C/aC++ compilers 2007-04-17 11:05:33 +00:00
seb
2f32439d15 If 'c99' is in USE_LANGUAGES also add 'c'.
I bet 'c99' support in USE_LANGUAGES was only tested on -current. On -current
there is no g77 command so mk/compiler/gcc.mk includes mk/compiler/f2c.mk which
adds 'c' to USE_LANGUAGES ;)
2006-12-03 08:34:45 +00:00
jschauma
721b60b433 Instead of setting compiler flags in each package if it uses C99,
allow USE_LANGUAGES+=c99 and let gcc and mipspro do the right thing.
May need to be reviewed/added for other compilers.
ok rillig@
2006-12-02 22:32:59 +00:00
markd
4beda37608 Allow CPP to be set to something not on the PATH (as used to work in
pre wrapper days).  Especially useful for Solaris where cpp tends to
live in /usr/css/lib/cpp.
2006-11-16 02:42:13 +00:00
joerg
03cba20b8e Make the language warning a bit less forceful, since it is often a false
warning.
2006-07-27 20:07:06 +00:00
rillig
15c11119af The C compiler is also used for Objective C, so the c-fail-wrapper is
only created if none of these languages is mentioned in USE_LANGUAGE.
2006-07-22 05:01:17 +00:00
rillig
1e90e68755 Up to now, the language "c" has always been enabled, no matter if the
package said USE_LANGUAGES=#none or USE_LANGUAGES=fortran. Added a
c-fail-wrapper that works like the other fail-wrappers. The default
value for USE_LANGUAGES is still "c". Some problems are expected with
packages that say USE_LANGUAGES+=c++ or with packages containing GNU
configure scripts and setting USE_LANGUAGES=c++, as those scripts always
need a working C compiler.
2006-07-20 16:44:01 +00:00
rillig
94d9cf1b3a Reordered the variables in the interface comment so that all
user-settable variables come first.
2006-07-02 23:09:19 +00:00
jlam
8c10d39139 Introduce the capability to gather all the warnings and errors that
are generated for a target and output them all at once at the conclusion
of the target's invocation.  The implementation is in bsd.pkg.error.mk,
which defines a macro target "error-check" that will print out any
non-empty warning and error files in ${WARNING_DIR} and ${ERROR_DIR}
and exit appropriately if there were errors.

Convert some targets that were just long sequences of ${ERROR_MSG} or
${WARNING_MSG} within a single shell statement to use the new delayed
error output via error-check.

Modify the compiler "fail" wrappers for C++ and Fortran to be less
verbose during invocation.  Instead collect the warnings and only
print them at the end of the completed phase, e.g. after "configure"
and/or "build" completes.
2006-06-09 13:59:06 +00:00
jlam
bc093b5ba2 Fix a problem that occurs if compiler.mk is included in a package's
Makefile, which means it occurs before bsd.tools.mk is included and
thus misses the definition of TOOLS_DIR.  We now create a new subdirectory
of ${WRKDIR} to house the wrappers instead of re-using ${TOOLS_DIR}.
Problem noted by Roland Illig on tech-pkg:

	http://mail-index.netbsd.org/tech-pkg/2006/05/12/0011.html
2006-05-12 21:37:08 +00:00
jlam
48b11c8c11 Make build failures due to the previous commit less mysterious by using
a wrapper script that emits a hint of what went wrong.
2006-05-11 22:13:19 +00:00