head	1.4;
access;
symbols
	RELEASE_4_6_2:1.2
	RELEASE_4_6_1:1.2
	RELEASE_4_6_0:1.2;
locks; strict;
comment	@# @;


1.4
date	2002.09.17.12.10.46;	author netchild;	state dead;
branches;
next	1.3;

1.3
date	2002.08.20.10.01.58;	author netchild;	state Exp;
branches;
next	1.2;

1.2
date	2002.05.14.13.46.23;	author netchild;	state Exp;
branches;
next	1.1;

1.1
date	2002.05.14.13.17.05;	author netchild;	state Exp;
branches;
next	;


desc
@@


1.4
log
@- 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
@
text
@#! /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 "$@@"
@


1.3
log
@- add category: devel
- use reinplace command where appropriate
- gzip man page
- clarify download instructions (1)
- fix typo in a comment (2)
- preparation for successfull C++ compiles (2, minor changes by me)

Even if I bumped the port revision for the C++ parts, there's no need to
update yet, wait until I commit the icc-stlport.

Requested by:	mi (1)
Submitted by:	Marius Strobl <marius@@alchemy.franken.de> (2)
@
text
@@


1.2
log
@Oops, last commit was an old version, this one is at least able to link
build the LAME port with
  make CC=icc CFLAGS="-tpp6 -DNDEBUG"

No port revision bump because of the short timeframe...
@
text
@d9 1
d15 15
d36 2
a37 2
	# there was also "-lirc", but it a test with -lirc works here
	-limf|-lcprts|-lunwind|\
d46 16
d69 2
a70 1
		set -- "$@@" -L/usr/libexec/elf -L/usr/libexec -L/usr/lib
d81 36
a116 7
		# Force libcxa to static linkage, since the dynamic
		# version has a linux glibc dependency.  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.
		if [ "$1" == "-lcxa" ] ; then
			val=-Bstatic
		fi
@


1.1
log
@Wrapper script for ld, needed to link native binaries.
@
text
@d20 2
a21 1
	-limf|-lirc|-lcprts|-lunwind|\
d63 1
a63 1
 let i=i+1
@

