diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2015-01-07 00:57:04 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2015-01-07 00:57:04 +0000 |
commit | 6178d37a3c19d38f78eccde67f42de14ad7e7694 (patch) | |
tree | 63876b1ac43efa8d29c4bcc22156f0fbafd8604a /devel/ccache | |
parent | b37db99ba958b1b000788e28c638a76647e2158f (diff) | |
download | ports-6178d37a3c19d38f78eccde67f42de14ad7e7694.tar.gz ports-6178d37a3c19d38f78eccde67f42de14ad7e7694.zip |
Notes
Diffstat (limited to 'devel/ccache')
-rw-r--r-- | devel/ccache/Makefile | 18 | ||||
-rw-r--r-- | devel/ccache/distinfo | 4 | ||||
-rw-r--r-- | devel/ccache/files/extra-patch-colors | 199 | ||||
-rw-r--r-- | devel/ccache/files/patch-ccache.c | 52 | ||||
-rw-r--r-- | devel/ccache/files/pkg-message-clang | 4 | ||||
-rw-r--r-- | devel/ccache/files/world-ccache.in | 6 |
6 files changed, 35 insertions, 248 deletions
diff --git a/devel/ccache/Makefile b/devel/ccache/Makefile index 8a771e6b3f3d..32ec0ef7fd20 100644 --- a/devel/ccache/Makefile +++ b/devel/ccache/Makefile @@ -2,11 +2,11 @@ # $FreeBSD$ PORTNAME= ccache -PORTVERSION= 3.1.10 -PORTREVISION= 1 +PORTVERSION= 3.2.1 +PORTREVISION= 0 CATEGORIES= devel MASTER_SITES= http://www.samba.org/ftp/ccache/ \ - LOCAL/ehaupt + LOCAL/bdrewery MAINTAINER= bdrewery@FreeBSD.org COMMENT= Tool to minimize the compile time of C/C++ programs @@ -21,31 +21,25 @@ SUB_FILES= ${HOWTO} world-ccache pkg-message ccache-update-links.sh PORTDOCS= ccache-howto-freebsd.txt MANUAL.html -OPTIONS_DEFINE= CLANGLINK LLVMLINK STATIC DOCS TINDERBOX COLORS -OPTIONS_DEFAULT=COLORS +OPTIONS_DEFINE= CLANGLINK LLVMLINK STATIC DOCS TINDERBOX -COLORS_DESC= Support compiler colors CLANGLINK_DESC= Create clang compiler links if clang is installed LLVMLINK_DESC= Create llvm compiler links if llvm is installed TINDERBOX_DESC= Create tarball for tinderbox usage -COLORS_EXTRA_PATCHES= ${FILESDIR}/extra-patch-colors -COLORS_USES= compiler +USES= compiler OPTIONS_SUB= yes STATIC_LDFLAGS= -static .include <bsd.port.options.mk> -.include <bsd.port.pre.mk> -.if ${PORT_OPTIONS:MCOLORS} . if ${COMPILER_TYPE} == clang CPPFLAGS+= -DCC_IS_CLANG . elif ${COMPILER_TYPE} == gcc CPPFLAGS+= -DCC_IS_GCC . endif -.endif PLIST_SUB+= CCLINKDIR="${CCLINKDIR}" @@ -104,4 +98,4 @@ post-install: @${CAT} ${FILESDIR}/pkg-message-clang >> ${PKGMESSAGE} .endif -.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/devel/ccache/distinfo b/devel/ccache/distinfo index 4797b898556a..6e619ae6efe5 100644 --- a/devel/ccache/distinfo +++ b/devel/ccache/distinfo @@ -1,2 +1,2 @@ -SHA256 (ccache-3.1.10.tar.gz) = ea37a21529c4d5c700d8dd1533c1d5f61e1e06e4c54c95ff30d5f1830b51fd3b -SIZE (ccache-3.1.10.tar.gz) = 354544 +SHA256 (ccache-3.2.1.tar.gz) = f8709a83daaeb9be22fe35c42e7862a8699b50de181ba3e28c89c092014ccb55 +SIZE (ccache-3.2.1.tar.gz) = 432423 diff --git a/devel/ccache/files/extra-patch-colors b/devel/ccache/files/extra-patch-colors deleted file mode 100644 index 63e94b9074df..000000000000 --- a/devel/ccache/files/extra-patch-colors +++ /dev/null @@ -1,199 +0,0 @@ -CC_IS_CLANG and CC_IS_GCC added by me. Adapated from 3.2 patch. - bdrewery - -Original author: - -From cacb14929748ae93eacefcfa194aa93689d217eb Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz> -Date: Fri, 29 Nov 2013 12:14:03 +0100 -Subject: [PATCH] support compiler color diagnostics if possible - -Clang and GCC (starting with 4.9) support color output if possible, -but since ccache redirects stderr to a file, they detect the output -is not a terminal and do not enable colors. Try to detect if colors -would be used and force colors explicitly. - -Caveats: -- Compiles with and without colors are considered different from each - other (so they are "duplicated"). -- GCC decided to roll its own name for the option, so it's necessary - to guess which compiler is actually used. - ---- ccache.c.orig 2014-03-02 00:16:33.335546870 -0600 -+++ ccache.c 2014-03-02 00:16:35.888546332 -0600 -@@ -849,14 +849,42 @@ hash_compiler(struct mdfour *hash, struc - if (!hash_multicommand_output(hash, compilercheck, orig_args->argv[0])) { - fatal("Failure running compiler check command: %s", compilercheck); - } - } - } - - /* -+ * Note that these compiler checks are unreliable, so nothing should hard-depend on them. -+ */ -+ -+static bool compiler_is_clang() -+{ -+ const char* name = strrchr( orig_args->argv[ 0 ], '/' ); -+ name = name ? name + 1 : orig_args->argv[ 0 ]; -+#ifdef CC_IS_CLANG -+ if (strcmp(name, "cc") == 0 || strcmp(name, "CC") == 0 || -+ strcmp(name, "c++") == 0) -+ return true; -+#endif -+ return strstr( name, "clang" ) != NULL; -+} -+ -+static bool compiler_is_gcc() -+{ -+ const char* name = strrchr(orig_args->argv[ 0 ], '/' ); -+#ifdef CC_IS_GCC -+ if (strcmp(name, "cc") == 0 || strcmp(name, "CC") == 0 || -+ strcmp(name, "c++") == 0) -+ return true; -+#endif -+ name = name ? name + 1 : orig_args->argv[ 0 ]; -+ return strstr(name, "gcc") != NULL || strstr(name, "g++") != NULL; -+} -+ -+/* - * Update a hash sum with information common for the direct and preprocessor - * modes. - */ - static void - calculate_common_hash(struct args *args, struct mdfour *hash) - { - struct stat st; -@@ -913,14 +941,23 @@ calculate_common_hash(struct args *args, - stats_update(STATS_BADEXTRAFILE); - failed(); - } - q = NULL; - } - free(p); - } -+ -+ /* Possibly hash GCC_COLORS (for color diagnostics). */ -+ if (compiler_is_gcc()) { -+ const char* gcc_colors = getenv("GCC_COLORS"); -+ if (gcc_colors != NULL) { -+ hash_delimiter(hash,"gcccolors"); -+ hash_string(hash, gcc_colors); -+ } -+ } - } - - /* - * Update a hash sum with information specific to the direct and preprocessor - * modes and calculate the object hash. Returns the object hash on success, - * otherwise NULL. Caller frees. - */ -@@ -1273,14 +1310,21 @@ find_compiler(int argc, char **argv) - - bool - is_precompiled_header(const char *path) - { - return str_eq(get_extension(path), ".gch"); - } - -+static bool color_output_possible() -+{ -+ const char* term_env = getenv("TERM"); -+ -+ return isatty(STDERR_FILENO) && term_env && strcasecmp(term_env, "DUMB") != 0; -+} -+ - /* - * Process the compiler options into options suitable for passing to the - * preprocessor and the real compiler. The preprocessor options don't include - * -E; this is added later. Returns true on success, otherwise false. - */ - bool - cc_process_args(struct args *orig_args, struct args **preprocessor_args, -@@ -1301,14 +1345,15 @@ cc_process_args(struct args *orig_args, - bool dependency_filename_specified = false; - /* is the dependency makefile target name specified with -MT or -MQ? */ - bool dependency_target_specified = false; - struct args *stripped_args = NULL, *dep_args = NULL; - int argc = orig_args->argc; - char **argv = orig_args->argv; - bool result = true; -+ bool found_color_diagnostics = false; - - stripped_args = args_init(0, NULL); - dep_args = args_init(0, NULL); - - args_add(stripped_args, argv[0]); - - for (i = 1; i < argc; i++) { -@@ -1551,14 +1596,34 @@ cc_process_args(struct args *orig_args, - - /* Input charset needs to be handled specially. */ - if (str_startswith(argv[i], "-finput-charset=")) { - input_charset = argv[i]; - continue; - } - -+ if (str_eq(argv[i], "-fcolor-diagnostics") -+ || str_eq(argv[i], "-fno-color-diagnostics") -+ || str_eq(argv[i], "-fdiagnostics-color") -+ || str_eq(argv[i], "-fdiagnostics-color=always") -+ || str_eq(argv[i], "-fno-diagnostics-color") -+ || str_eq(argv[i], "-fdiagnostics-color=never")) { -+ args_add(stripped_args, argv[i]); -+ found_color_diagnostics = true; -+ continue; -+ } -+ if (str_eq(argv[i], "-fdiagnostics-color=auto")) { -+ if (color_output_possible()) { -+ /* Output is redirected, so color output must be forced. */ -+ args_add(stripped_args, "-fdiagnostics-color=always"); -+ cc_log("Automatically forcing colors"); -+ } -+ found_color_diagnostics = true; -+ continue; -+ } -+ - /* - * Options taking an argument that that we may want to rewrite - * to relative paths to get better hit rate. A secondary effect - * is that paths in the standard error output produced by the - * compiler will be normalized. - */ - if (compopt_takes_path(argv[i])) { -@@ -1765,14 +1830,36 @@ cc_process_args(struct args *orig_args, - cc_log("Not a regular file: %s", output_obj); - stats_update(STATS_DEVICE); - result = false; - goto out; - } - - /* -+ * Since output is redirected, compilers will not color their output by default, -+ * so force it explicitly if it would be otherwise done. -+ */ -+ if (!found_color_diagnostics && color_output_possible()) { -+ if (compiler_is_clang()) { -+ args_add(stripped_args, "-fcolor-diagnostics"); -+ cc_log("Automatically enabling colors"); -+ } else if (compiler_is_gcc()) { -+ /* -+ * GCC has it since 4.9, but that'd require detecting what GCC -+ * version is used for the actual compile. However it requires -+ * also GCC_COLORS to be set (and not empty), so use that -+ * for detecting if GCC would use colors. -+ */ -+ if (getenv("GCC_COLORS") != NULL && getenv("GCC_COLORS")[ 0 ] != '\0') { -+ args_add(stripped_args, "-fdiagnostics-color"); -+ cc_log("Automatically enabling colors"); -+ } -+ } -+ } -+ -+ /* - * Some options shouldn't be passed to the real compiler when it compiles - * preprocessed code: - * - * -finput-charset=XXX (otherwise conversion happens twice) - * -x XXX (otherwise the wrong language is selected) - */ - *preprocessor_args = args_copy(stripped_args); diff --git a/devel/ccache/files/patch-ccache.c b/devel/ccache/files/patch-ccache.c index 7b1b188b0674..b319899163a9 100644 --- a/devel/ccache/files/patch-ccache.c +++ b/devel/ccache/files/patch-ccache.c @@ -1,30 +1,28 @@ -$FreeBSD$ +Determine whether cc(1) is clang or gcc at compile-time. -Disable compiling preprocessed code on CURRENT with default clang. Avoids -needing to define CCACHE_CPP2 to build with clang. Performance hit but -much safer until upstream fixes the build issue. - ---- ./ccache.c.orig 2013-05-08 14:22:16.891630019 -0500 -+++ ./ccache.c 2013-05-08 14:27:18.488628070 -0500 -@@ -31,6 +31,9 @@ - #include "hashutil.h" - #include "language.h" - #include "manifest.h" -+#if defined(__FreeBSD__) -+#include <sys/param.h> +--- ccache.c.orig 2015-01-06 18:24:47.738295980 -0600 ++++ ccache.c 2015-01-06 18:25:58.685291460 -0600 +@@ -1116,6 +1116,11 @@ compiler_is_clang(struct args *args) + { + char* name = basename(args->argv[0]); + bool is = strstr(name, "clang"); ++#ifdef CC_IS_CLANG ++ if (strcmp(name, "cc") == 0 || strcmp(name, "CC") == 0 || ++ strcmp(name, "c++") == 0) ++ is = true; +#endif - - static const char VERSION_TEXT[] = - MYNAME " version %s\n" -@@ -2260,7 +2263,11 @@ - base_dir = NULL; - } - -+#if __FreeBSD_version >= 1000024 -+ compile_preprocessed_source_code = false; -+#else - compile_preprocessed_source_code = !getenv("CCACHE_CPP2"); + free(name); + return is; + } +@@ -1125,6 +1130,11 @@ compiler_is_gcc(struct args *args) + { + char* name = basename(args->argv[0]); + bool is = strstr(name, "gcc") || strstr(name, "g++"); ++#ifdef CC_IS_GCC ++ if (strcmp(name, "cc") == 0 || strcmp(name, "CC") == 0 || ++ strcmp(name, "c++") == 0) ++ is = true; +#endif - - /* make sure the cache dir exists */ - if (create_dir(cache_dir) != 0) { + free(name); + return is; + } diff --git a/devel/ccache/files/pkg-message-clang b/devel/ccache/files/pkg-message-clang index eed5a090ca37..c41fe4aa40a4 100644 --- a/devel/ccache/files/pkg-message-clang +++ b/devel/ccache/files/pkg-message-clang @@ -2,9 +2,5 @@ You've chosen to create symlinks to the clang compiler binaries if they exist. While it's known to be safe to build world with clang/ccache, it is not fully supported yet. You have been warned. -You should define CCACHE_CPP2=1 in your /etc/make.conf until bug 8460 is fixed. - See: https://bugzilla.samba.org/show_bug.cgi?id=8460 - https://bugzilla.samba.org/show_bug.cgi?id=8118 - diff --git a/devel/ccache/files/world-ccache.in b/devel/ccache/files/world-ccache.in index bdbc8893837f..9803d12b8298 100644 --- a/devel/ccache/files/world-ccache.in +++ b/devel/ccache/files/world-ccache.in @@ -1,10 +1,8 @@ #!/bin/sh [ "${0##*/}" = "ccache" ] && -printf "Please, use one of the compiler links in\n%%PREFIX%%/%%CCLINKDIR%%/world\nto invoke ccache\n" >&2 && -exit 1 - -[ "${COMPILER_TYPE}" = "clang" ] && export CCACHE_CPP2=1 + printf "Please, use one of the compiler links in\n%%PREFIX%%/%%CCLINKDIR%%/world\nto invoke ccache\n" >&2 && + exit 1 unset CCACHE_PATH export CCACHE_COMPILERCHECK=content |