summaryrefslogtreecommitdiff
path: root/lang/icc
diff options
context:
space:
mode:
authorAlexander Leidinger <netchild@FreeBSD.org>2002-09-17 12:10:46 +0000
committerAlexander Leidinger <netchild@FreeBSD.org>2002-09-17 12:10:46 +0000
commit9d47e3f9b5b2722771b9c9154e275f2d79f9f58e (patch)
tree2bd9e420d1aa1b144a3b363491e21e3eb0cf73f5 /lang/icc
parentTrack exim-4.xx now that ports/mail/exim is for exim-4.xx. (diff)
- C++ support: fix to work also on -current, work around broken exception
handling when generating shared objects with binutils/ld 2.12.[0,1], link in the icc C++ ABI definitions not those of gcc - remove libcprts (STL): it has unresolvable glibc dependencies in both, dynamic and static, versions, therefore is not usable and entirely unneeded when libstlport is used instead - add libimf (Intel's optimized math functions library), while there's no measurable speed improvement (at least for the functions tested) in comparison to FreeBSD's libm beyond the "normal" icc vs. gcc boost icc occasionally produces code depending on libimf when told to optimize for Pentium 4 - replace the ld-script with a wrapper written in C as (c)sh is a bit limited and long winded for that purpose - minor stuff and cleanup Submitted by: marius@alchemy.franken.de
Notes
Notes: svn path=/head/; revision=66502
Diffstat (limited to 'lang/icc')
-rw-r--r--lang/icc/Makefile33
-rw-r--r--lang/icc/files/cxa_atexit.c24
-rw-r--r--lang/icc/files/cxa_finalize.c38
-rw-r--r--lang/icc/files/errno_location.c37
-rw-r--r--lang/icc/files/ld128
-rw-r--r--lang/icc/files/ld.c404
-rw-r--r--lang/icc/files/patch-icc38
-rw-r--r--lang/icc/files/patch-icpc41
-rw-r--r--lang/icc/files/patch-include38
-rw-r--r--lang/icc/files/stderr.c2
-rw-r--r--lang/icc/pkg-plist8
11 files changed, 635 insertions, 156 deletions
diff --git a/lang/icc/Makefile b/lang/icc/Makefile
index 4ac9fc1660af..3e911bc2a152 100644
--- a/lang/icc/Makefile
+++ b/lang/icc/Makefile
@@ -7,7 +7,7 @@
PORTNAME= icc
PORTVERSION= 6.0.159
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= lang linux devel
MASTER_SITES=
DISTNAME= l_cc_pu_6.0.159
@@ -26,7 +26,6 @@ ONLY_FOR_ARCHS= i386
USE_LINUX= yes
USE_REINPLACE= yes
NO_WRKSUBDIR= yes
-NO_BUILD= yes
NO_FILTER_SHLIBS= yes
MAN1= icc.1
@@ -72,26 +71,26 @@ post-patch:
# Correct some paths and patch some files
.for i in ia32/bin/icc ia32/bin/icc.cfg ia32/bin/iccvars.csh \
ia32/bin/iccvars.sh ia32/bin/icpc ia32/bin/icpc.cfg docs/csupport
- @${REINPLACE_CMD} -i "" -e 's@export -n IA32ROOT; unset IA32ROOT;@@g; s@-a "<INSTALLDIR>/compiler60/ia32/bin/icc" @@g; s@-a "<INSTALLDIR>/compiler60/ia32/bin/icpc" @@g; s@\<INSTALLDIR\>@${PREFIX}/intel@g; s@-tp p6@@; s@man -w@manpath -q@g; s:\<INSTALLTIMECOMBOPACKAGEID\>:${DISTNAME}:g' \
+ @${REINPLACE_CMD} -i "" -e 's:@@PREFIX@@:${PREFIX}:g; s@man -w@manpath -q@g; s:\<INSTALLTIMECOMBOPACKAGEID\>:${DISTNAME}:g' \
${WRKSRC}/opt/intel/compiler60/${i}
@${CHMOD} 755 ${WRKSRC}/opt/intel/compiler60/${i}
.endfor
# Remove unneeded files
-.for i in cwchar.orig yvals.h.orig algorithm bitset complex deque fstream \
- fstream.h functional hash_map hash_set iomanip iomanip.h ios iosfwd \
- iostream iostream.h istream iterator limits list locale map mathf.h \
+.for i in cfloat.orig cwchar.orig yvals.h.orig algorithm bitset complex deque \
+ fstream fstream.h functional hash_map hash_set iomanip iomanip.h ios \
+ iosfwd iostream iostream.h istream iterator limits list locale map \
memory numeric ostream queue set slist sstream stack stdexcept stl.h \
stream.h streambuf string strstream strstream.h utility valarray \
vector xcomplex xdebug xhash xiosbase xlocale xlocinfo xlocinfo.h \
xlocmes xlocmon xlocnum xloctime xmemory xstring xtree xutility ymath.h
@${RM} ${WRKSRC}/opt/intel/compiler60/ia32/include/${i}
.endfor
-.for i in crtxi.o crtxn.o icrt.link libcprts.so libcprts.so.1 libimf.a \
- libunwind.so libunwind.so.1
+.for i in libcprts.a libcprts.so libcprts.so.1 libunwind.so libunwind.so.1
@${RM} -rf ${WRKSRC}/opt/intel/compiler60/ia32/lib/${i}
.endfor
@${RM} ${WRKSRC}/opt/intel/compiler60/ia32/bin/uninstall \
- ${WRKSRC}/opt/intel/compiler60/ia32/bin/icc.orig
+ ${WRKSRC}/opt/intel/compiler60/ia32/bin/icc.orig \
+ ${WRKSRC}/opt/intel/compiler60/ia32/bin/icpc.orig
.if defined(NOPORTDOCS)
@${RM} -rf ${WRKSRC}/opt/intel/compiler60/docs
.endif
@@ -100,19 +99,21 @@ post-patch:
@${ECHO} -e "\n-Ulinux\n-U__linux__\n-U__linux\n\n-D__FreeBSD__=${ICCCFGVAL}\n-D__ELF__=1\n" >>${WRKSRC}/opt/intel/compiler60/ia32/bin/${i}
@${CHMOD} a-x,g-w ${WRKSRC}/opt/intel/compiler60/ia32/bin/${i}
.endfor
-# C++ hack for ipcp
+# C++ hack for icpc
@${ECHO} -e "\n-I${PREFIX}/include/stlport\n-Qoption,ld,-CPLUSPLUS\n" >>${WRKSRC}/opt/intel/compiler60/ia32/bin/icpc.cfg
@cd ${WRKSRC}/opt/intel/compiler60/ia32/bin/ && ${LN} -s icc.cfg iccbin.cfg && ${LN} -s icpc.cfg icpcbin.cfg
# \n-Qlocation,ld,/usr/bin\n\n-sox-\n
-# Fix (some) unresolved references in libcprts, libcxa and libunwind
- @cd ${WRKSRC} && ${CC} -c ${FILESDIR}/*.c && \
+
+do-build:
+# Fix unresolved references in libcxa.a, libimf.a and libunwind.a
+ @cd ${WRKSRC} && ${CC} ${CFLAGS} -c ${FILESDIR}/cxa_atexit.c \
+ ${FILESDIR}/cxa_finalize.c ${FILESDIR}/errno_location.c \
+ ${FILESDIR}/stderr.c && \
${AR} q opt/intel/compiler60/ia32/lib/libcxa.a *.o
# Some magic to be able to link
- @${SED} 's:@@PREFIX@@:${PREFIX}:g' ${FILESDIR}/ld >${WRKSRC}/opt/intel/compiler60/ia32/bin/ld
+ @${CC} ${CFLAGS} -o ${WRKSRC}/opt/intel/compiler60/ia32/bin/ld ${FILESDIR}/ld.c
+ @${STRIP_CMD} ${WRKSRC}/opt/intel/compiler60/ia32/bin/ld
@${CHMOD} 755 ${WRKSRC}/opt/intel/compiler60/ia32/bin/ld
- @${MKDIR} ${WRKSRC}/opt/intel/compiler60/ia32/bin/real
-# Do not use the linux ld if it exists
- @${LN} -s /usr/bin/ld ${WRKSRC}/opt/intel/compiler60/ia32/bin/real
do-install:
@cd ${WRKSRC}/opt && ${TAR} -cf - . | \
diff --git a/lang/icc/files/cxa_atexit.c b/lang/icc/files/cxa_atexit.c
index 2d9ce3d9160e..d9dd1d0a1700 100644
--- a/lang/icc/files/cxa_atexit.c
+++ b/lang/icc/files/cxa_atexit.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 2002 Marius Strobl
* All rights reserved.
*
@@ -28,11 +28,25 @@
#include <stdlib.h>
-void *__dso_handle = NULL;
-
+/*
+ * The __cxa_atexit() function and friends are needed for full (IA64) C++ ABI
+ * compatibility but FreeBSD doesn't have implemented them, yet. In addition
+ * to the classic atexit() it is not only used to register functions to be
+ * called at program exit but also to call them (C++ destructors in that case)
+ * when a shared object is unloaded. For the later to work the dynamic linker
+ * assigns a unique dynamic shared object handle to every shared object while
+ * a handle of NULL represents a main program. When __cxa_finalize() is called
+ * with a specific (non-NULL) handle as an argument all functions registered
+ * via __cxa_atexit() and having the same handle are called.
+ * The best we can do here to emulate that behaviour until FreeBSD supports
+ * this is to register the functions via atexit(). While this certainly is a
+ * bad hack it seems to work, even the current dynamic linker is assigning
+ * the handles. I didn't see a function getting registered with an argument
+ * so far.
+ */
int
-__cxa_atexit(void (*fn)(), void *arg, void *d)
+__cxa_atexit(void (*fn)(), void *arg, void *handle)
{
- return (atexit(fn));
+ return (handle ? atexit(fn) : 0);
}
diff --git a/lang/icc/files/cxa_finalize.c b/lang/icc/files/cxa_finalize.c
new file mode 100644
index 000000000000..5865a2f7138f
--- /dev/null
+++ b/lang/icc/files/cxa_finalize.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2002 Marius Strobl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+void
+__cxa_finalize(void *handle)
+{
+
+ /*
+ * As we dared to register the functions via atexit() this job will
+ * be done by exit().
+ */
+ return;
+}
diff --git a/lang/icc/files/errno_location.c b/lang/icc/files/errno_location.c
new file mode 100644
index 000000000000..ba9f3d8b48bc
--- /dev/null
+++ b/lang/icc/files/errno_location.c
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2000 Andrew Gallatin and David O'Brien
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * copied over from: FreeBSD: ports/lang/compaq-cc/files/errno_location.c,v 1.1 2000/12/08 13:27:29 obrien Exp
+ *
+ * $FreeBSD$
+ */
+
+#include <errno.h>
+
+int *
+__errno_location(void)
+{
+ return &errno;
+}
diff --git a/lang/icc/files/ld b/lang/icc/files/ld
deleted file mode 100644
index d25901783095..000000000000
--- a/lang/icc/files/ld
+++ /dev/null
@@ -1,128 +0,0 @@
-#! /bin/sh
-# icc custom ld script; fiddles with the ld commandline. This is done
-# by shifting through the entire argument list. If we like the arg, we
-# append it to the end of the arglist via 'set'. If not, we don't
-# append anything, and the arg is shifted out of existence.
-
-# Written by Dan Nelson <dnelson@allantgroup.com> with some modifications
-# by Alexander Leidinger <netchild@FreeBSD.org>.
-# C++ support by Marius Strobl <marius@alchemy.franken.de>.
-
-PREFIX=@@PREFIX@@
-
-i=0
-argc=$#
-while [ $i -lt $argc ] ; do
- val=$1
- shift
- if [ "$val" == "-CPLUSPLUS" ] ; then
- cplusplus=1
- elif [ "$val" == "-BOOTSTRAPSTLPORT" ] ; then
- bootstrapstlport=1
- else
- set -- "$@" "$val"
- fi
- i=$(($i+1))
-done
-
-i=0
-argc=$#
-# prepend "-m elf_i386" to the commandline
-set -- "$@" -m elf_i386
-while [ $i -lt $argc ] ; do
- val=$1
- shift
- case $val in
- # there was also "-lirc", but in a test -lirc works here
- -limf|\
- ${PREFIX}/intel/compiler60/ia32/lib/icrt.link|\
- -Qy\
- )
- # libs that have Linux lib dependencies
- # possibly unneeded .link file?
- # obsolete flag
- unset val
- ;;
- -lcprts|-lunwind)
- # only needed when compiling c++ source, depend on libc_r
- if [ ! "$cplusplus" ] ; then
- unset val
- fi
- ;;
- -lc)
- if [ "$cplusplus" ] ; then
- if [ "$bootstrapstlport" ] ; then
- val=-lc_r
- else
- unset val
- set -- "$@" -lc_r -lstlport_icc
- fi
- fi
- ;;
- /lib/ld-linux.so.2)
- # switch it
- val=/usr/libexec/ld-elf.so.1
- ;;
- -L/usr/lib)
- # remove this, and replace with FreeBSD's lib paths
- unset val
- set -- "$@" -L/usr/libexec/elf -L/usr/libexec -L/usr/lib \
- -L${PREFIX}/lib
- ;;
- ${PREFIX}/intel/compiler60/ia32/lib/crtxi.o)
- # switch it
- val=/usr/lib/crtbegin.o
- ;;
- ${PREFIX}/intel/compiler60/ia32/lib/crtxn.o)
- # switch it good
- val=/usr/lib/crtend.o
- ;;
- -Bdynamic)
- # Force libcprts, libcxa and libunwind to static linkage,
- # since the dynamic versions have linux glibc
- # dependencies. This might not fully work, as when it
- # does call libc stuff it could fail. I haven't been able
- # to make it happen though.
- # ibcprts and libunwind are only needed when compiling c++
- # source, else we remove the superfluous -Bdynamic.
- case $1 in
- -lcxa)
- val=-Bstatic
- ;;
- -lcprts|-lunwind)
- if [ "$cplusplus" ] ; then
- val=-Bstatic
- else
- unset val
- fi
- ;;
- *)
- ;;
- esac
- ;;
- -Bstatic)
- # remove superfluous -Bstatic not followed by a library
- case $1 in
- -limf|-lirc)
- unset val
- ;;
- -lcprts|-lunwind)
- if [ ! "$cplusplus" ] ; then
- unset val
- fi
- ;;
- *)
- ;;
- esac
- ;;
- *)
- ;;
- esac
- # append our new $val to the end of argv, if it still exists.
- if [ ${#val} -gt 0 ] ; then
- set -- "$@" "$val"
- fi
- i=$(($i+1))
-done
-# run FreeBSD's ld with our new args
-exec ${PREFIX}/intel/compiler60/ia32/bin/real/ld "$@"
diff --git a/lang/icc/files/ld.c b/lang/icc/files/ld.c
new file mode 100644
index 000000000000..8bcf90797140
--- /dev/null
+++ b/lang/icc/files/ld.c
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2002 Marius Strobl
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Wrapper for Intel(R) C/C++ Compiler for Linux to allow linking of native
+ * FreeBSD binaries.
+ * Based on a shell-script written by Dan Nelson <dnelson@allantgroup.com>
+ * with some modifications by Alexander Leidinger <netchild@FreeBSD.org>.
+ *
+ * $FreeBSD$
+ */
+
+/* Uses code marked: */
+
+/* OpenBSD: mailwrapper.c,v 1.6 1999/12/17 05:06:28 mickey Exp */
+/* NetBSD: mailwrapper.c,v 1.3 1999/05/29 18:18:15 christos Exp */
+/* FreeBSD: src/usr.sbin/mailwrapper/mailwrapper.c,v 1.8 2002/07/11 18:27:55 alfred Exp */
+
+/*
+ * Copyright (c) 1998
+ * Perry E. Metzger. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * This product includes software developed for the NetBSD Project
+ * by Perry E. Metzger.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#if defined (__FreeBSD__) && __FreeBSD__ >= 2
+ #include <osreldate.h>
+#else
+ #error "Won't work here."
+#endif
+
+#define PATH_LD "/usr/bin/ld"
+
+struct arglist {
+ size_t argc, maxc;
+ char **argv;
+};
+
+static void initarg(struct arglist *al);
+static void addarg(struct arglist *al, const char *arg, int copy);
+static void freearg(struct arglist *al, int copy);
+int main(int argc, char *argv[], char *envp[]);
+
+static void
+initarg(struct arglist *al)
+{
+
+ al->argc = 0;
+ al->maxc = 10;
+ if ((al->argv = malloc(al->maxc * sizeof(char *))) == NULL)
+ err(1, NULL);
+}
+
+static void
+addarg(struct arglist *al, const char *arg, int copy)
+{
+ char **argv2;
+
+ if (al->argc == al->maxc) {
+ al->maxc <<= 1;
+
+ if ((argv2 = realloc(al->argv,
+ al->maxc * sizeof(char *))) == NULL) {
+ if (al->argv)
+ free(al->argv);
+ al->argv = NULL;
+ err(1, NULL);
+ } else {
+ al->argv = argv2;
+ }
+ }
+ if (copy) {
+ if ((al->argv[al->argc++] = strdup(arg)) == NULL)
+ err(1, NULL);
+ } else {
+ al->argv[al->argc++] = (char *)arg;
+ }
+}
+
+static
+void freearg(struct arglist *al, int copy)
+{
+ size_t i;
+
+ if (copy)
+ for (i = 0; i < al->argc; i++)
+ free(al->argv[i]);
+ free(al->argv);
+}
+
+int
+main(int argc, char *argv[], char *envp[])
+{
+ size_t i;
+ int bootstrap, cpp, dynamic, shared, stlinserted;
+ char *prefix;
+ struct arglist al;
+
+ if (argc == 1)
+ errx(1, "no input files");
+
+ if ((prefix = getenv("PREFIX")) == NULL)
+ errx(1, "can't get PREFIX");
+
+ initarg(&al);
+ bootstrap = cpp = dynamic = shared = stlinserted = 0;
+
+#ifdef DEBUG
+ printf("input: ");
+#endif
+
+#define ARGCMP(x) !strcmp(argv[i], (x))
+#define ARGCMPB(x, y) (strlen(x) + strlen(y) == strlen(argv[i]) && \
+ !strncmp(argv[i], (x), strlen(x)) && \
+ !strncmp(argv[i] + strlen(x), (y), strlen(y)))
+
+ /*
+ * XXX This doesn't deal with whitespace but a) the output of the
+ * compiler should be fixed and b) the real linker is also picky
+ * about whitespace.
+ */
+ for (i = 0; i < argc; i++) {
+#ifdef DEBUG
+ printf("%s ", argv[i]);
+#endif
+
+ if (ARGCMP("-CPLUSPLUS")) {
+ cpp++;
+ continue;
+ }
+
+ if (ARGCMP("-BOOTSTRAPSTLPORT")) {
+ bootstrap++;
+ continue;
+ }
+
+ if (ARGCMP("-shared")) {
+ shared++;
+ continue;
+ }
+
+ /*
+ * If the compiler was called with -static we shouldn't see
+ * "--dynamic-linker" here.
+ * Note: According to ld(1) this is "--dynamic-linker" but
+ * ICC passes "-dynamic-linker" to it.
+ */
+ if (ARGCMP("--dynamic-linker") || ARGCMP("-dynamic-linker")) {
+ dynamic++;
+ continue;
+ }
+
+ /*
+ * Just link libstlport_icc* once when compiling the stlport
+ * tests.
+ */
+ if (!strncmp(argv[i], "-lstlport_icc",
+ strlen("-lstlport_icc"))) {
+ stlinserted++;
+ continue;
+ }
+ }
+
+#ifdef DEBUG
+ printf("\ncpp: %s bootstrap: %s dynamic: %s shared: %s\n",
+ cpp ? "YES" : "NO", bootstrap ? "YES" : "NO",
+ dynamic ? "YES" : "NO", shared ? "YES" : "NO");
+#endif
+
+ if (bootstrap && !cpp)
+ errx(1, "-BOOTSTRAPSTLPORT is only valid in combination with "
+ "-CPLUSPLUS");
+
+ for (i = 0; i < argc; i++) {
+ if (ARGCMP("-CPLUSPLUS") || ARGCMP("-BOOTSTRAPSTLPORT"))
+ continue;
+
+ /* prepend "-melf_i386" to the commandline */
+ if (i == 0) {
+ addarg(&al, argv[0], 1);
+ addarg(&al, "-melf_i386", 1);
+ continue;
+ }
+
+ /*
+ * "-u ___pseudo_link" triggers linking of additional objects
+ * from libcxa which seem to bloat the binaries, i.e. they
+ * perfectly work without it. Intel Support promised to look
+ * up what this servers for...
+ */
+ if (ARGCMP("-u") || ARGCMP("___pseudo_link"))
+ continue;
+
+ /* Don't add obsolete flag "-Qy". */
+ if (ARGCMP("-Qy"))
+ continue;
+
+ /*
+ * Because of a nasty behaviour (bug?) of binutils/ld 2.12.[0,1]
+ * we must not statically link libcxa and libunwind to shared
+ * objects, e.g. our STL replacement. Doing so causes broken
+ * exception handling amongst some other strange reactions.
+ * This perfectly worked with binutils/ld 2.11.2.
+ */
+ if (cpp && shared && (ARGCMP("-lcxa") || ARGCMP("-lunwind")))
+ continue;
+
+ /* Libunwind is only needed when compiling C++ source. */
+ if (!cpp && ARGCMP("-lunwind"))
+ continue;
+
+ /*
+ * Replace libcprts with libstlport_icc. The Dinkumware STL
+ * shipping with ICC has unresolvable glibc dependencies
+ * in both, the static and the dynamic, versions.
+ */
+ if (ARGCMP("-lcprts")) {
+ if (cpp && !bootstrap && !stlinserted) {
+ addarg(&al,
+ dynamic ? "-Bdynamic" : "-Bstatic", 1);
+ addarg(&al, "-lstlport_icc", 1);
+ stlinserted++;
+ }
+ continue;
+ }
+
+ /*
+ * Libcxa and libunwind depend on libc_r when compiling C++
+ * source.
+ */
+ if (cpp && ARGCMP("-lc")) {
+ if (al.argc > 0 &&
+ strncmp(al.argv[al.argc - 1], "-B", strlen("-B")))
+ addarg(&al,
+ dynamic ? "-Bdynamic" : "-Bstatic", 1);
+#if __FreeBSD_version < 500016
+ addarg(&al, "-lc_r", 1);
+#else
+ addarg(&al, "-lc", 1);
+ addarg(&al, dynamic ? "-Bdynamic" : "-Bstatic", 1);
+ addarg(&al, "-lc_r", 1);
+#endif
+ continue;
+ }
+
+ /* Switch Linux stuff to FreeBSD counterparts. */
+ if (ARGCMP("/lib/ld-linux.so.2")) {
+ addarg(&al, "/usr/libexec/ld-elf.so.1", 1);
+ continue;
+ }
+ if (ARGCMP("-L/usr/lib")) {
+ char *temp;
+
+ if ((temp = (char *) malloc(strlen("-L") +
+ strlen(prefix) + strlen("/lib") + 1)) == NULL)
+ err(1, NULL);
+
+ addarg(&al, "-L/usr/libexec/elf", 1);
+ addarg(&al, "-L/usr/libexec", 1);
+ addarg(&al, "-L/usr/lib", 1);
+ snprintf(temp, strlen("-L") + strlen(prefix) +
+ strlen("/lib") + 1, "-L%s/lib", prefix);
+ addarg(&al, temp, 1);
+ free(temp);
+ continue;
+ }
+
+ /*
+ * Link and map files for C++ exception handling, C++ ABI stuff.
+ */
+ if (!cpp &&
+ (ARGCMP("--version-script") ||
+ ARGCMPB(prefix, "/intel/compiler60/ia32/lib/icrt.link") ||
+ ARGCMPB(prefix,
+ "/intel/compiler60/ia32/lib/icrt.internal.map") ||
+ ARGCMPB(prefix, "/intel/compiler60/ia32/lib/crtxi.o") ||
+ ARGCMPB(prefix, "/intel/compiler60/ia32/lib/crtxn.o"))) {
+ continue;
+ }
+
+ /*
+ * Force libcxa and libunwind to static linkage, since the
+ * dynamic versions have glibc dependencies.
+ * Don't add superfluous -Bdynamic.
+ */
+ if (ARGCMP("-Bdynamic") && i <= argc + 1) {
+ if (!shared && (!strcmp(argv[i + 1], "-lcxa") ||
+ (cpp && !strcmp(argv[i + 1], "-lunwind")))) {
+ addarg(&al, "-Bstatic", 1);
+ continue;
+ }
+
+ if (!strcmp(argv[i + 1], "-lcprts") ||
+ !strcmp(argv[i + 1], "-lcxa") ||
+ !strcmp(argv[i + 1], "-lunwind"))
+ continue;
+ }
+
+ /* Don't add superfluous -Bstatic. */
+ if (ARGCMP("-Bstatic") && i <= argc + 1 &&
+ (!strcmp(argv[i + 1], "-lcprts") ||
+ (!cpp && !strcmp(argv[i + 1], "-lunwind"))))
+ continue;
+
+ /*
+ * Sanity check if every lib is prepended by a linkage option,
+ * add if missing.
+ */
+ if (!strncmp(argv[i], "-l", strlen("-l")) && al.argc > 0 &&
+ strncmp(al.argv[al.argc - 1], "-B", strlen("-B"))) {
+ if (!strcmp(argv[i], "-lcxa") ||
+ !strcmp(argv[i], "-limf") ||
+ !strcmp(argv[i], "-lirc") ||
+ !strcmp(argv[i], "-lunwind"))
+ addarg(&al, "-Bstatic", 1);
+ else
+ addarg(&al,
+ dynamic ? "-Bdynamic" : "-Bstatic", 1);
+
+ addarg(&al, argv[i], 1);
+ continue;
+ }
+
+ /* default */
+ addarg(&al, argv[i], 1);
+ }
+
+#undef ARGCMP
+#undef ARGCMPB
+
+ /* Still something to do ? */
+ if (al.argc == 1)
+ errx(1, "no input files");
+
+#ifdef DEBUG
+ printf("output: ");
+
+ for (i = 0; i < al.argc; i++)
+ printf("%s ", al.argv[i]);
+
+ printf("\n");
+#endif
+
+ addarg(&al, NULL, 0);
+
+ /* Launch the real linker */
+ if (execve(PATH_LD, al.argv, envp) == -1)
+ err(1, "execing %s", PATH_LD);
+
+ freearg(&al, 1);
+
+ exit (1);
+}
diff --git a/lang/icc/files/patch-icc b/lang/icc/files/patch-icc
index a6aeaf03bb9c..53426d19cbe0 100644
--- a/lang/icc/files/patch-icc
+++ b/lang/icc/files/patch-icc
@@ -1,9 +1,39 @@
--- opt/intel/compiler60/ia32/bin/icc.orig Tue Aug 6 04:34:18 2002
+++ opt/intel/compiler60/ia32/bin/icc Tue Aug 6 04:46:51 2002
-@@ -23,6 +23,21 @@
+@@ -1,29 +1,44 @@
+ #!/bin/sh
+-INTEL_LICENSE_FILE=<INSTALLDIR>/licenses;
++PREFIX=@@PREFIX@@
++export PREFIX;
++INTEL_LICENSE_FILE=${PREFIX}/intel/licenses;
+ export INTEL_LICENSE_FILE;
+
+ if [ -z LD_LIBRARY_PATH ]
+ then
+- LD_LIBRARY_PATH=<INSTALLDIR>/compiler60/ia32/lib;
++ LD_LIBRARY_PATH=${PREFIX}/intel/compiler60/ia32/lib;
+ else
+- LD_LIBRARY_PATH=<INSTALLDIR>/compiler60/ia32/lib:$LD_LIBRARY_PATH
++ LD_LIBRARY_PATH=${PREFIX}/intel/compiler60/ia32/lib:$LD_LIBRARY_PATH
+ fi
+ export LD_LIBRARY_PATH;
+
+ if [ -z PATH ]
+ then
+- PATH=<INSTALLDIR>/compiler60/ia32/bin;
++ PATH=${PREFIX}/intel/compiler60/ia32/bin;
+ else
+- PATH=<INSTALLDIR>/compiler60/ia32/bin:$PATH;
++ PATH=${PREFIX}/intel/compiler60/ia32/bin:$PATH;
+ fi
+ export PATH;
+
+-export -n IA32ROOT; unset IA32ROOT;
+-
if [ $# != 0 ]
then
+- exec -a "<INSTALLDIR>/compiler60/ia32/bin/icc" <INSTALLDIR>/compiler60/ia32/bin/iccbin "$@";
+ i=0
+ argc=$#
+ while [ $i -lt $argc ] ; do
@@ -19,6 +49,8 @@
+ set -- "$@" "$val1"
+ i=$(($i+1))
+ done
- exec -a "<INSTALLDIR>/compiler60/ia32/bin/icc" <INSTALLDIR>/compiler60/ia32/bin/iccbin "$@";
++ exec ${PREFIX}/intel/compiler60/ia32/bin/iccbin "$@";
else
- exec -a "<INSTALLDIR>/compiler60/ia32/bin/icc" <INSTALLDIR>/compiler60/ia32/bin/iccbin;
+- exec -a "<INSTALLDIR>/compiler60/ia32/bin/icc" <INSTALLDIR>/compiler60/ia32/bin/iccbin;
++ exec ${PREFIX}/intel/compiler60/ia32/bin/iccbin;
+ fi
diff --git a/lang/icc/files/patch-icpc b/lang/icc/files/patch-icpc
new file mode 100644
index 000000000000..03e4dd7c1c95
--- /dev/null
+++ b/lang/icc/files/patch-icpc
@@ -0,0 +1,41 @@
+--- opt/intel/compiler60/ia32/bin/icpc.orig Fri Sep 6 02:18:03 2002
++++ opt/intel/compiler60/ia32/bin/icpc Tue Sep 10 18:32:59 2002
+@@ -1,29 +1,29 @@
+ #!/bin/sh
+
+-INTEL_LICENSE_FILE=<INSTALLDIR>/licenses;
++PREFIX=@@PREFIX@@
++export PREFIX;
++INTEL_LICENSE_FILE=${PREFIX}/intel/licenses;
+ export INTEL_LICENSE_FILE;
+
+ if [ -z LD_LIBRARY_PATH ]
+ then
+- LD_LIBRARY_PATH=<INSTALLDIR>/compiler60/ia32/lib;
++ LD_LIBRARY_PATH=${PREFIX}/intel/compiler60/ia32/lib;
+ else
+- LD_LIBRARY_PATH=<INSTALLDIR>/compiler60/ia32/lib:$LD_LIBRARY_PATH
++ LD_LIBRARY_PATH=${PREFIX}/intel/compiler60/ia32/lib:$LD_LIBRARY_PATH
+ fi
+ export LD_LIBRARY_PATH;
+
+ if [ -z PATH ]
+ then
+- PATH=<INSTALLDIR>/compiler60/ia32/bin;
++ PATH=${PREFIX}/intel/compiler60/ia32/bin;
+ else
+- PATH=<INSTALLDIR>/compiler60/ia32/bin:$PATH;
++ PATH=${PREFIX}/intel/compiler60/ia32/bin:$PATH;
+ fi
+ export PATH;
+
+-export -n IA32ROOT; unset IA32ROOT;
+-
+ if [ $# != 0 ]
+ then
+- exec -a "<INSTALLDIR>/compiler60/ia32/bin/icpc" <INSTALLDIR>/compiler60/ia32/bin/icpcbin "$@";
++ exec ${PREFIX}/intel/compiler60/ia32/bin/icpcbin "$@";
+ else
+- exec -a "<INSTALLDIR>/compiler60/ia32/bin/icpc" <INSTALLDIR>/compiler60/ia32/bin/icpcbin;
++ exec ${PREFIX}/intel/compiler60/ia32/bin/icpcbin;
+ fi
diff --git a/lang/icc/files/patch-include b/lang/icc/files/patch-include
index c1b54eb722c0..35613dd41e4b 100644
--- a/lang/icc/files/patch-include
+++ b/lang/icc/files/patch-include
@@ -52,3 +52,41 @@
using ::wmemchr; using ::wmemcmp; using ::wmemcpy;
using ::wmemmove; using ::wmemset;
// using ::wcsftime;
+--- opt/intel/compiler60/ia32/include/cfloat.orig Thu Sep 12 07:08:29 2002
++++ opt/intel/compiler60/ia32/include/cfloat Thu Sep 12 08:01:57 2002
+@@ -6,35 +6,6 @@
+
+ #include <float.h>
+
+- #if __EDG__
+-_C_STD_BEGIN
+- /* TYPE DEFINITIONS */
+-typedef struct
+- { /* parameters for a floating-point type */
+- int _Ddig, _Dmdig, _Dmax10e, _Dmaxe, _Dmin10e, _Dmine;
+- union
+- { /* union of short array and all floats */
+- unsigned short _Us[8];
+- float _Float;
+- double _Double;
+- long double _Long_double;
+- } _Deps, _Dmax, _Dmin;
+- } _Dvals;
+-
+- /* DECLARATIONS */
+-_C_LIB_DECL
+-extern const _Dvals _Ldbl;
+-_END_C_LIB_DECL
+-_C_STD_END
+-
+-#undef LDBL_EPSILON /* redefine macros that use gcc extension */
+-#undef LDBL_MAX
+-#undef LDBL_MIN
+-
+-#define LDBL_EPSILON _CSTD _Ldbl._Deps._Long_double
+-#define LDBL_MAX _CSTD _Ldbl._Dmax._Long_double
+-#define LDBL_MIN _CSTD _Ldbl._Dmin._Long_double
+- #endif /* __EDG__ */
+ #endif /* _CFLOAT_ */
+
+ /*
diff --git a/lang/icc/files/stderr.c b/lang/icc/files/stderr.c
index aeb5013d10b4..9e463e445318 100644
--- a/lang/icc/files/stderr.c
+++ b/lang/icc/files/stderr.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 2002 Marius Strobl
* All rights reserved.
*
diff --git a/lang/icc/pkg-plist b/lang/icc/pkg-plist
index c4efb3e16172..be76595d413d 100644
--- a/lang/icc/pkg-plist
+++ b/lang/icc/pkg-plist
@@ -678,8 +678,6 @@
%%PORTDOCS%%intel/compiler60/docs/ref/webhelp4.js
%%PORTDOCS%%@dirrm intel/compiler60/docs/ref
%%PORTDOCS%%@dirrm intel/compiler60/docs
-intel/compiler60/ia32/bin/real/ld
-@dirrm intel/compiler60/ia32/bin/real
intel/compiler60/ia32/bin/Errormatch.txt
intel/compiler60/ia32/bin/INTEL
intel/compiler60/ia32/bin/icc
@@ -729,6 +727,7 @@ intel/compiler60/ia32/include/exception
intel/compiler60/ia32/include/fvec.h
intel/compiler60/ia32/include/iso646.h
intel/compiler60/ia32/include/ivec.h
+intel/compiler60/ia32/include/mathf.h
intel/compiler60/ia32/include/mmintrin.h
intel/compiler60/ia32/include/new
intel/compiler60/ia32/include/new.h
@@ -746,13 +745,16 @@ intel/compiler60/ia32/include/xmtx.h
intel/compiler60/ia32/include/xstddef
intel/compiler60/ia32/include/yvals.h
@dirrm intel/compiler60/ia32/include
+intel/compiler60/ia32/lib/crtxi.o
+intel/compiler60/ia32/lib/crtxn.o
intel/compiler60/ia32/lib/icrt.internal.map
-intel/compiler60/ia32/lib/libcprts.a
+intel/compiler60/ia32/lib/icrt.link
intel/compiler60/ia32/lib/libcxa.a
intel/compiler60/ia32/lib/libcxa.so
intel/compiler60/ia32/lib/libcxa.so.1
intel/compiler60/ia32/lib/libguide.a
intel/compiler60/ia32/lib/libguide.so
+intel/compiler60/ia32/lib/libimf.a
intel/compiler60/ia32/lib/libirc.a
intel/compiler60/ia32/lib/libircmt.a
intel/compiler60/ia32/lib/libompstub.a