summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Ballier <aballier@gentoo.org>2007-05-26 13:08:14 +0000
committerAlexis Ballier <aballier@gentoo.org>2007-05-26 13:08:14 +0000
commit197f6cae8911e68c70b1a634af54880cd806e255 (patch)
tree7d232c65fc45834ce2b6cbbaf168f9bfac0f2a5b /dev-lang/ocaml
parentamd64 stable, bug 176144 (diff)
downloadgentoo-2-197f6cae8911e68c70b1a634af54880cd806e255.tar.gz
gentoo-2-197f6cae8911e68c70b1a634af54880cd806e255.tar.bz2
gentoo-2-197f6cae8911e68c70b1a634af54880cd806e255.zip
New upstream release
(Portage version: 2.1.2.7)
Diffstat (limited to 'dev-lang/ocaml')
-rw-r--r--dev-lang/ocaml/ChangeLog11
-rw-r--r--dev-lang/ocaml/files/digest-ocaml-3.10.03
-rw-r--r--dev-lang/ocaml/files/ocaml-3.10.0-automagic.patch51
-rw-r--r--dev-lang/ocaml/files/ocaml-3.10.0-call-ld-with-proper-ldflags.patch30
-rw-r--r--dev-lang/ocaml/files/ocaml-3.10.0-configure.patch133
-rw-r--r--dev-lang/ocaml/files/ocaml-3.10.0-exec-stack-fixes.patch312
-rw-r--r--dev-lang/ocaml/ocaml-3.10.0.ebuild148
7 files changed, 687 insertions, 1 deletions
diff --git a/dev-lang/ocaml/ChangeLog b/dev-lang/ocaml/ChangeLog
index 573b18e2d686..7ff60166d0cc 100644
--- a/dev-lang/ocaml/ChangeLog
+++ b/dev-lang/ocaml/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for dev-lang/ocaml
# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/ocaml/ChangeLog,v 1.111 2007/05/15 22:29:52 jer Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/ocaml/ChangeLog,v 1.112 2007/05/26 13:08:14 aballier Exp $
+
+*ocaml-3.10.0 (26 May 2007)
+
+ 26 May 2007; Alexis Ballier <aballier@gentoo.org>
+ +files/ocaml-3.10.0-automagic.patch,
+ +files/ocaml-3.10.0-call-ld-with-proper-ldflags.patch,
+ +files/ocaml-3.10.0-configure.patch,
+ +files/ocaml-3.10.0-exec-stack-fixes.patch, +ocaml-3.10.0.ebuild:
+ New upstream release
15 May 2007; Jeroen Roovers <jer@gentoo.org> ocaml-3.09.3-r1.ebuild:
Marked ~hppa (bug #178256).
diff --git a/dev-lang/ocaml/files/digest-ocaml-3.10.0 b/dev-lang/ocaml/files/digest-ocaml-3.10.0
new file mode 100644
index 000000000000..53cf44344e2e
--- /dev/null
+++ b/dev-lang/ocaml/files/digest-ocaml-3.10.0
@@ -0,0 +1,3 @@
+MD5 5ec0b860730925f738d91ca96d692406 ocaml-3.10.0.tar.gz 3402010
+RMD160 40032fb06a3ae76838a56bad51119e5b30a099fd ocaml-3.10.0.tar.gz 3402010
+SHA256 daa56c4ebc21640be84e124fc5fefe091d0048d412b7e2b1e68bc2f56ff74314 ocaml-3.10.0.tar.gz 3402010
diff --git a/dev-lang/ocaml/files/ocaml-3.10.0-automagic.patch b/dev-lang/ocaml/files/ocaml-3.10.0-automagic.patch
new file mode 100644
index 000000000000..0aa90973793a
--- /dev/null
+++ b/dev-lang/ocaml/files/ocaml-3.10.0-automagic.patch
@@ -0,0 +1,51 @@
+Index: ocaml-3.10.0/configure
+===================================================================
+--- ocaml-3.10.0.orig/configure
++++ ocaml-3.10.0/configure
+@@ -31,6 +31,8 @@ x11_include_dir=''
+ x11_lib_dir=''
+ tk_wanted=yes
+ pthread_wanted=yes
++graph_wanted=yes
++dbm_wanted=yes
+ tk_defs=''
+ tk_libs=''
+ tk_x11=yes
+@@ -87,6 +89,10 @@ while : ; do
+ ;; # Ignored for backward compatibility
+ -no-pthread*|--no-pthread*)
+ pthread_wanted=no;;
++ -no-dbm|--no-dbm)
++ dbm_wanted=no;;
++ -no-graph|--no-graph)
++ graph_wanted=no;;
+ -no-tk|--no-tk)
+ tk_wanted=no;;
+ -tkdefs*|--tkdefs*)
+@@ -1233,7 +1239,7 @@ do
+ done
+
+
+-if test "$x11_include" = "not found" || test "$x11_link" = "not found"
++if test "$x11_include" = "not found" || test "$x11_link" = "not found" || test "$graph_wanted" = "no"
+ then
+ echo "X11 not found, the \"graph\" library will not be supported."
+ x11_include=""
+@@ -1281,7 +1287,7 @@ for dir in /usr/include /usr/include/db1
+ break
+ fi
+ done
+-if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then
++if test "$dbm_include" = "not found" || test "$dbm_link" = "not found" || test "$dbm_wanted" = "no"; then
+ echo "NDBM not found, the \"dbm\" library will not be supported."
+ else
+ echo "NDBM found (in $dbm_include)"
+@@ -1546,7 +1552,7 @@ echo " $otherlibraries"
+ echo "Configuration for the \"num\" library:"
+ echo " target architecture ...... $bng_arch (asm level $bng_asm_level)"
+
+-if test "$x11_include" != "not found" && test "$x11_lib" != "not found"; then
++if test "$x11_include" != "not found" && test "$x11_lib" != "not found" && test "$graph_wanted" != "no"; then
+ echo "Configuration for the \"graph\" library:"
+ echo " options for compiling .... $x11_include"
+ echo " options for linking ...... $x11_link"
diff --git a/dev-lang/ocaml/files/ocaml-3.10.0-call-ld-with-proper-ldflags.patch b/dev-lang/ocaml/files/ocaml-3.10.0-call-ld-with-proper-ldflags.patch
new file mode 100644
index 000000000000..29d94aafb118
--- /dev/null
+++ b/dev-lang/ocaml/files/ocaml-3.10.0-call-ld-with-proper-ldflags.patch
@@ -0,0 +1,30 @@
+As we now support LDFLAGS in NATIVECCLINKOPTS
+it can happen that -Wl,--foo,--bar option is in that variable
+As ocaml happens to call ld with NATIVECCLINKOPTS
+we have to "translate" it so that ld doesn't bail out with unrecognized option
+Initial patch from Julien Cristau : http://caml.inria.fr/mantis/view.php?id=4142
+Modified a bit to catch comma separated options
+Index: ocaml-3.10.0/Makefile
+===================================================================
+--- ocaml-3.10.0.orig/Makefile
++++ ocaml-3.10.0/Makefile
+@@ -316,6 +316,8 @@ partialclean::
+ rm -f ocaml toplevel/toplevellib.cma
+
+ # The configuration file
++comma = ,
++Wl = -Wl,
+
+ utils/config.ml: utils/config.mlp config/Makefile
+ @rm -f utils/config.ml
+@@ -326,8 +328,8 @@ utils/config.ml: utils/config.mlp config
+ -e 's|%%BYTELINK%%|$(BYTECC) $(BYTECCLINKOPTS)|' \
+ -e 's|%%NATIVECC%%|$(NATIVECC) $(NATIVECCCOMPOPTS)|' \
+ -e 's|%%NATIVELINK%%|$(NATIVECC) $(NATIVECCLINKOPTS)|' \
+- -e 's|%%PARTIALLD%%|$(PARTIALLD) $(NATIVECCLINKOPTS)|' \
+- -e 's|%%PACKLD%%|$(PARTIALLD) $(NATIVECCLINKOPTS) -o |' \
++ -e 's|%%PARTIALLD%%|$(PARTIALLD) $(subst $(comma), ,$(subst $(Wl),,$(NATIVECCLINKOPTS)))|' \
++ -e 's|%%PACKLD%%|$(PARTIALLD) $(subst $(comma), ,$(subst $(Wl),,$(NATIVECCLINKOPTS))) -o |' \
+ -e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \
+ -e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \
+ -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
diff --git a/dev-lang/ocaml/files/ocaml-3.10.0-configure.patch b/dev-lang/ocaml/files/ocaml-3.10.0-configure.patch
new file mode 100644
index 000000000000..d96d3f5beed1
--- /dev/null
+++ b/dev-lang/ocaml/files/ocaml-3.10.0-configure.patch
@@ -0,0 +1,133 @@
+Index: ocaml-3.10.0/configure
+===================================================================
+--- ocaml-3.10.0.orig/configure
++++ ocaml-3.10.0/configure
+@@ -233,75 +233,75 @@ esac
+ # Configure the bytecode compiler
+
+ bytecc="$cc"
+-bytecccompopts=""
+-bytecclinkopts=""
++bytecccompopts="${CFLAGS}"
++bytecclinkopts="${LDFLAGS}"
+ ostype="Unix"
+ exe=""
+
+ case "$bytecc,$host" in
+ cc,*-*-nextstep*)
+ # GNU C extensions disabled, but __GNUC__ still defined!
+- bytecccompopts="-fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
+- bytecclinkopts="-posix";;
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
++ bytecclinkopts="$bytecclinkopts -posix";;
+ *,*-*-rhapsody*)
+ # Almost the same as NeXTStep
+- bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
+ mathlib="";;
+ *,*-*-darwin*)
+- bytecccompopts="-fno-defer-pop -no-cpp-precomp $gcc_warnings"
++ bytecccompopts="$bytecccompopts -fno-defer-pop -no-cpp-precomp $gcc_warnings"
+ mathlib=""
+ # Tell gcc that we can use 32-bit code addresses for threaded code
+ # even if we compile in 64-bit mode
+ echo "#define ARCH_CODE32" >> m.h;;
+ *,*-*-beos*)
+- bytecccompopts="-fno-defer-pop $gcc_warnings"
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings"
+ # No -lm library
+ mathlib="";;
+ gcc,alpha*-*-osf*)
+- bytecccompopts="-fno-defer-pop $gcc_warnings"
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings"
+ if cc="$bytecc" sh ./hasgot -mieee; then
+ bytecccompopts="-mieee $bytecccompopts";
+ fi
+ # Put code and static data in lower 4GB
+- bytecclinkopts="-Wl,-T,12000000 -Wl,-D,14000000"
++ bytecclinkopts="$bytecclinkopts -Wl,-T,12000000 -Wl,-D,14000000"
+ # Tell gcc that we can use 32-bit code addresses for threaded code
+ echo "#define ARCH_CODE32" >> m.h;;
+ cc,alpha*-*-osf*)
+- bytecccompopts="-std1 -ieee";;
++ bytecccompopts="$bytecccompopts -std1 -ieee";;
+ gcc,alpha*-*-linux*)
+ if cc="$bytecc" sh ./hasgot -mieee; then
+ bytecccompopts="-mieee $bytecccompopts";
+ fi;;
+ cc,mips-*-irix6*)
+ # Add -n32 flag to ensure compatibility with native-code compiler
+- bytecccompopts="-n32"
++ bytecccompopts="$bytecccompopts -n32"
+ # Turn off warning "unused library"
+- bytecclinkopts="-n32 -Wl,-woff,84";;
++ bytecclinkopts="$bytecclinkopts -n32 -Wl,-woff,84";;
+ cc*,mips-*-irix6*)
+ # (For those who want to force "cc -64")
+ # Turn off warning "unused library"
+- bytecclinkopts="-Wl,-woff,84";;
++ bytecclinkopts="$bytecclinkopts -Wl,-woff,84";;
+ *,alpha*-*-unicos*)
+ # For the Cray T3E
+- bytecccompopts="-DUMK";;
++ bytecccompopts="$bytecccompopts -DUMK";;
+ gcc*,powerpc-*-aix*)
+ # Avoid name-space pollution by requiring Unix98-conformant includes
+- bytecccompopts="-fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
+ *,powerpc-*-aix*)
+- bytecccompopts="-D_XOPEN_SOURCE=500";;
++ bytecccompopts="$bytecccompopts -D_XOPEN_SOURCE=500";;
+ gcc*,*-*-cygwin*)
+- bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings -U_WIN32"
+ exe=".exe"
+ ostype="Cygwin";;
+ gcc*,x86_64-*-linux*)
+- bytecccompopts="-fno-defer-pop $gcc_warnings"
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings"
+ # Tell gcc that we can use 32-bit code addresses for threaded code
+ # unless we are compiled for a shared library (-fPIC option)
+ echo "#ifndef __PIC__" >> m.h
+ echo "# define ARCH_CODE32" >> m.h
+ echo "#endif" >> m.h;;
+ gcc*)
+- bytecccompopts="-fno-defer-pop $gcc_warnings";;
++ bytecccompopts="$bytecccompopts -fno-defer-pop $gcc_warnings";;
+ esac
+
+ # Configure compiler to use in further tests
+@@ -616,22 +616,22 @@ else
+ nativecc="$ccoption"
+ fi
+
+-nativecccompopts=''
+-nativecclinkopts=''
++nativecccompopts="${CFLAGS}"
++nativecclinkopts="${LDFLAGS}"
+ nativeccrpath="$byteccrpath"
+
+ case "$arch,$nativecc,$system,$host_type" in
+- alpha,cc*,digital,*) nativecccompopts=-std1;;
+- mips,cc*,irix,*) nativecccompopts=-n32
+- nativecclinkopts="-n32 -Wl,-woff,84";;
+- *,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
+- nativecclinkopts="-posix";;
++ alpha,cc*,digital,*) nativecccompopts="$nativecccompopts -std1";;
++ mips,cc*,irix,*) nativecccompopts="$nativecccompopts -n32"
++ nativecclinkopts="$nativecclinkopts -n32 -Wl,-woff,84";;
++ *,*,nextstep,*) nativecccompopts="$nativecccompopts $gcc_warnings -U__GNUC__ -posix"
++ nativecclinkopts="$nativecclinkopts -posix";;
+ *,*,rhapsody,*darwin[1-5].*)
+- nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
+- *,*,rhapsody,*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
++ nativecccompopts="$nativecccompopts $gcc_warnings -DSHRINKED_GNUC";;
++ *,*,rhapsody,*) nativecccompopts="$nativecccompopts $gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
+ if $arch64; then partialld="ld -r -arch ppc64"; fi;;
+- *,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
+- *,gcc*,*,*) nativecccompopts="$gcc_warnings";;
++ *,gcc*,cygwin,*) nativecccompopts="$nativecccompopts $gcc_warnings -U_WIN32";;
++ *,gcc*,*,*) nativecccompopts="$nativecccompopts $gcc_warnings";;
+ esac
+
+ asflags=''
diff --git a/dev-lang/ocaml/files/ocaml-3.10.0-exec-stack-fixes.patch b/dev-lang/ocaml/files/ocaml-3.10.0-exec-stack-fixes.patch
new file mode 100644
index 000000000000..8b4b894befc0
--- /dev/null
+++ b/dev-lang/ocaml/files/ocaml-3.10.0-exec-stack-fixes.patch
@@ -0,0 +1,312 @@
+Index: ocaml-3.10.0/asmcomp/alpha/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/alpha/emit.mlp
++++ ocaml-3.10.0/asmcomp/alpha/emit.mlp
+@@ -811,6 +811,11 @@ let data l =
+ ` .data\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -843,6 +848,7 @@ let begin_assembly() =
+ `{emit_symbol lbl_begin}:\n`
+
+ let end_assembly () =
++ nx_stack();
+ let lbl_end = Compilenv.make_symbol (Some "code_end") in
+ ` .text\n`;
+ ` .globl {emit_symbol lbl_end}\n`;
+Index: ocaml-3.10.0/asmrun/alpha.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/alpha.S
++++ ocaml-3.10.0/asmrun/alpha.S
+@@ -438,3 +438,7 @@ caml_system__frametable:
+ .word -1 /* negative frame size => use callback link */
+ .word 0 /* no roots here */
+ .align 3
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+Index: ocaml-3.10.0/asmrun/amd64.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/amd64.S
++++ ocaml-3.10.0/asmrun/amd64.S
+@@ -366,3 +366,7 @@ caml_negf_mask:
+ .align 16
+ caml_absf_mask:
+ .quad 0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+Index: ocaml-3.10.0/asmrun/arm.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/arm.S
++++ ocaml-3.10.0/asmrun/arm.S
+@@ -337,3 +337,7 @@ caml_system__frametable:
+ .short -1 /* negative frame size => use callback link */
+ .short 0 /* no roots */
+ .align 2
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
+Index: ocaml-3.10.0/asmrun/hppa.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/hppa.S
++++ ocaml-3.10.0/asmrun/hppa.S
+@@ -532,3 +532,8 @@ G(caml_system__frametable):
+ .long L104 + 3 /* return address into callback */
+ .short -1 /* negative frame size => use callback link */
+ .short 0 /* no roots */
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
+Index: ocaml-3.10.0/asmrun/i386.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/i386.S
++++ ocaml-3.10.0/asmrun/i386.S
+@@ -416,3 +416,8 @@ Lmcount$stub:
+ hlt ; hlt ; hlt ; hlt ; hlt
+ .subsections_via_symbols
+ #endif
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
+Index: ocaml-3.10.0/asmrun/ia64.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/ia64.S
++++ ocaml-3.10.0/asmrun/ia64.S
+@@ -528,3 +528,8 @@ caml_system__frametable:
+
+ .common caml_saved_bsp#, 8, 8
+ .common caml_saved_rnat#, 8, 8
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
+Index: ocaml-3.10.0/asmrun/m68k.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/m68k.S
++++ ocaml-3.10.0/asmrun/m68k.S
+@@ -242,3 +242,8 @@ _caml_system__frametable:
+ .long L107 | return address into callback
+ .word -1 | negative frame size => use callback link
+ .word 0 | no roots here
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
+Index: ocaml-3.10.0/asmrun/power-elf.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/power-elf.S
++++ ocaml-3.10.0/asmrun/power-elf.S
+@@ -419,3 +419,7 @@ caml_system__frametable:
+ .short -1 /* negative size count => use callback link */
+ .short 0 /* no roots here */
+
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
+Index: ocaml-3.10.0/asmrun/sparc.S
+===================================================================
+--- ocaml-3.10.0.orig/asmrun/sparc.S
++++ ocaml-3.10.0/asmrun/sparc.S
+@@ -405,3 +405,8 @@ Caml_system__frametable:
+ .type Caml_raise_exception, #function
+ .type Caml_system__frametable, #object
+ #endif
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
+Index: ocaml-3.10.0/asmcomp/amd64/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/amd64/emit.mlp
++++ ocaml-3.10.0/asmcomp/amd64/emit.mlp
+@@ -676,6 +676,13 @@ let data l =
+ ` .data\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
++
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -689,6 +696,7 @@ let begin_assembly() =
+ `{emit_symbol lbl_begin}:\n`
+
+ let end_assembly() =
++ nx_stack();
+ let lbl_end = Compilenv.make_symbol (Some "code_end") in
+ ` .text\n`;
+ ` .globl {emit_symbol lbl_end}\n`;
+Index: ocaml-3.10.0/asmcomp/arm/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/arm/emit.mlp
++++ ocaml-3.10.0/asmcomp/arm/emit.mlp
+@@ -642,6 +642,13 @@ let data l =
+ ` .data\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
++
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -661,6 +668,7 @@ let begin_assembly() =
+ `{emit_symbol lbl_begin}:\n`
+
+ let end_assembly () =
++ nx_stack();
+ let lbl_end = Compilenv.make_symbol (Some "code_end") in
+ ` .text\n`;
+ ` .global {emit_symbol lbl_end}\n`;
+Index: ocaml-3.10.0/asmcomp/hppa/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/hppa/emit.mlp
++++ ocaml-3.10.0/asmcomp/hppa/emit.mlp
+@@ -994,6 +994,12 @@ let data l =
+ ` .data\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -1022,6 +1028,7 @@ let begin_assembly() =
+
+
+ let end_assembly() =
++ nx_stack();
+ ` .code\n`;
+ let lbl_end = Compilenv.make_symbol (Some "code_end") in
+ declare_global lbl_end;
+Index: ocaml-3.10.0/asmcomp/i386/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/i386/emit.mlp
++++ ocaml-3.10.0/asmcomp/i386/emit.mlp
+@@ -947,6 +947,11 @@ let data l =
+ ` .data\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -960,6 +965,7 @@ let begin_assembly() =
+ `{emit_symbol lbl_begin}:\n`
+
+ let end_assembly() =
++ nx_stack();
+ let lbl_end = Compilenv.make_symbol (Some "code_end") in
+ ` .text\n`;
+ ` .globl {emit_symbol lbl_end}\n`;
+Index: ocaml-3.10.0/asmcomp/ia64/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/ia64/emit.mlp
++++ ocaml-3.10.0/asmcomp/ia64/emit.mlp
+@@ -1306,6 +1306,11 @@ let data l =
+ ` .align 8\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -1315,6 +1320,7 @@ let begin_assembly() =
+ emit_define_symbol (Compilenv.make_symbol (Some "code_begin"))
+
+ let end_assembly () =
++ nx_stack();
+ ` .data\n`;
+ emit_define_symbol (Compilenv.make_symbol (Some "data_end"));
+ ` .text\n`;
+Index: ocaml-3.10.0/asmcomp/power/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/power/emit.mlp
++++ ocaml-3.10.0/asmcomp/power/emit.mlp
+@@ -916,6 +916,12 @@ let data l =
+ emit_string data_space;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -932,6 +938,7 @@ let begin_assembly() =
+ `{emit_symbol lbl_begin}:\n`
+
+ let end_assembly() =
++ nx_stack();
+ if pic_externals then
+ (* Emit the pointers to external functions *)
+ StringSet.iter emit_external !external_functions;
+Index: ocaml-3.10.0/asmcomp/sparc/emit.mlp
+===================================================================
+--- ocaml-3.10.0.orig/asmcomp/sparc/emit.mlp
++++ ocaml-3.10.0/asmcomp/sparc/emit.mlp
+@@ -741,6 +741,12 @@ let data l =
+ ` .data\n`;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "linux" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -754,6 +760,7 @@ let begin_assembly() =
+ `{emit_symbol lbl_begin}:\n`
+
+ let end_assembly() =
++ nx_stack();
+ ` .text\n`;
+ let lbl_end = Compilenv.make_symbol (Some "code_end") in
+ ` .global {emit_symbol lbl_end}\n`;
diff --git a/dev-lang/ocaml/ocaml-3.10.0.ebuild b/dev-lang/ocaml/ocaml-3.10.0.ebuild
new file mode 100644
index 000000000000..a5f4843e41e8
--- /dev/null
+++ b/dev-lang/ocaml/ocaml-3.10.0.ebuild
@@ -0,0 +1,148 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/ocaml/ocaml-3.10.0.ebuild,v 1.1 2007/05/26 13:08:14 aballier Exp $
+
+inherit flag-o-matic eutils multilib pax-utils versionator toolchain-funcs
+
+DESCRIPTION="fast modern type-inferring functional programming language descended from the ML (Meta Language) family"
+HOMEPAGE="http://www.ocaml.org/"
+SRC_URI="http://caml.inria.fr/distrib/ocaml-$( get_version_component_range 1-2)/${P}.tar.gz"
+
+LICENSE="QPL-1.0 LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE="gdbm ncurses tk latex X"
+
+DEPEND="tk? ( >=dev-lang/tk-3.3.3 )
+ ncurses? ( sys-libs/ncurses )
+ X? ( x11-libs/libX11 x11-proto/xproto )
+ gdbm? ( sys-libs/gdbm )"
+
+QA_EXECSTACK="/usr/lib/ocaml/compiler-*"
+
+pkg_setup() {
+ # dev-lang/ocaml fails with -fPIC errors due to a "relocation R_X86_64_32S" on AMD64/hardened
+ if use amd64 && gcc-specs-pie ; then
+ echo
+ eerror "${CATEGORY}/${PF} is currently broken on this platform with specfiles injecting -PIE."
+ eerror "Please switch to your \"${CHOST}-$(gcc-fullversion)-hardenednopie\" specfile via gcc-config!"
+ die "Current specfile (${CHOST}-$(gcc-fullversion)) not supported by ${PF}!"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # Fix the EXEC_STACK in ocaml compiled binaries (#153382)
+ epatch "${FILESDIR}"/${P}-exec-stack-fixes.patch
+
+ # Quick and somewhat dirty fix for bug #110541
+# epatch "${FILESDIR}"/${P}-execheap.patch
+
+ # The configure script doesn't inherit previous defined variables,
+ # overwriting previous declarations of bytecccompopts, bytecclinkopts,
+ # nativecccompopts and nativecclinkopts. Reported upstream as issue 0004267.
+ epatch "${FILESDIR}"/${P}-configure.patch
+
+ # The sed in the Makefile doesn't replace all occurences of @compiler@
+ # in driver/ocamlcomp.sh.in. Reported upstream as issue 0004268.
+# epatch "${FILESDIR}"/${P}-Makefile.patch
+
+
+ # ocaml has automagics on libX11 and gdbm
+ # http://caml.inria.fr/mantis/view.php?id=4278
+ epatch "${FILESDIR}/${P}-automagic.patch"
+
+ # Call ld with proper flags, different from gcc ones
+ # This happens when calling ocamlc -pack
+ # See comment in the patch
+ epatch "${FILESDIR}/${P}-call-ld-with-proper-ldflags.patch"
+
+ # Ocaml native code generation for hppa has a bug
+ # See comments in the patch
+ # http://bugs.gentoo.org/show_bug.cgi?id=178256
+# use hppa && epatch "${FILESDIR}/${P}-hppa-optimize-for-size-ocamlp4.patch"
+}
+
+src_compile() {
+ local myconf="--host ${CHOST}"
+
+ # dev-lang/ocaml tends to break/give unexpected results with "unsafe" CFLAGS.
+ strip-flags
+ replace-flags "-O?" -O2
+
+ use tk || myconf="${myconf} -no-tk"
+ use ncurses || myconf="${myconf} -no-curses"
+ use X || myconf="${myconf} -no-graph"
+ use gdbm || myconf="${myconf} -no-dbm"
+
+ # ocaml uses a home-brewn configure script, preventing it to use econf.
+ ./configure -prefix /usr \
+ --bindir /usr/bin \
+ --libdir /usr/$(get_libdir)/ocaml \
+ --mandir /usr/share/man \
+ --with-pthread ${myconf} || die "configure failed!"
+
+ make world || die "make world failed!"
+
+ # Native code generation is unsupported on some archs
+ if ! use ppc64 ; then
+ make opt || die "make opt failed!"
+ make opt.opt || die "make opt.opt failed!"
+ fi
+}
+
+src_install() {
+ make BINDIR="${D}"/usr/bin \
+ LIBDIR="${D}"/usr/$(get_libdir)/ocaml \
+ MANDIR="${D}"/usr/share/man \
+ install || die "make install failed!"
+
+ # Install the compiler libs
+ dodir /usr/$(get_libdir)/ocaml/compiler-libs
+ insinto /usr/$(get_libdir)/ocaml/compiler-libs
+ doins {utils,typing,parsing}/*.{mli,cmi,cmo,cmx,o}
+
+ # Symlink the headers to the right place
+ dodir /usr/include
+ dosym /usr/$(get_libdir)/ocaml/caml /usr/include/
+
+ # Remove ${D} from ld.conf, as the buildsystem isn't $(DESTDIR) aware
+ dosed "s:${D}::g" /usr/$(get_libdir)/ocaml/ld.conf
+
+ dodoc Changes INSTALL LICENSE README Upgrading
+
+ # Turn MPROTECT off for some of the ocaml binaries, since they are trying to
+ # rewrite the segment (which will obviously fail on systems having
+ # PAX_MPROTECT enabled).
+ pax-mark -m "${D}"/usr/bin/ocamldoc.opt "${D}"/usr/bin/ocamldep.opt \
+ "${D}"/usr/bin/ocamllex.opt "${D}"/usr/bin/camlp4r.opt \
+ "${D}"/usr/bin/camlp4o.opt
+
+ # Create and envd entry for latex input files (this definitely belongs into
+ # CONTENT and not in pkg_postinst.
+ if use latex ; then
+ echo "TEXINPUTS=/usr/$(get_libdir)/ocaml/ocamldoc:" > "${T}"/99ocamldoc
+ doenvd "${T}"/99ocamldoc
+ fi
+
+ # Install ocaml-rebuild.sh script rather than keeping it in $PORTDIR
+ dosbin "${FILESDIR}/ocaml-rebuild.sh"
+}
+
+pkg_postinst() {
+ if use amd64 && gcc-specs-ssp ; then
+ ewarn
+ ewarn "Make sure, you switch back to the default specfile ${CHOST}-$(gcc-fullversion) via gcc-config!"
+ ewarn
+ fi
+
+ echo
+ elog "OCaml is not binary compatible from version to version, so you (may)"
+ elog "need to rebuild all packages depending on it, that are actually"
+ elog "installed on your system. To do so, you can run:"
+ elog "/usr/sbin/ocaml-rebuild.sh [-h | emerge options]"
+ elog "Which will call emerge on all old packages with the given options"
+ echo
+}