summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-10-28 13:45:59 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-10-28 15:00:41 +0000
commit0f6a83529742564e73ffc8cac13d5b159805a2e0 (patch)
tree81957963a03b91eb74556f5dce9b8ea516a34240 /testing
parent93a756bf967e9d2d014e6266556849bd84cc1cba (diff)
downloadaports-0f6a83529742564e73ffc8cac13d5b159805a2e0.tar.bz2
aports-0f6a83529742564e73ffc8cac13d5b159805a2e0.tar.xz
testing/ocaml: add patches from gentoo and fix build on x86
Diffstat (limited to 'testing')
-rw-r--r--testing/ocaml/010_all_execstacks.patch240
-rw-r--r--testing/ocaml/020_all_configure.patch50
-rw-r--r--testing/ocaml/040_all_yaccldflags.patch17
-rw-r--r--testing/ocaml/050_all_objinfoldflags.patch13
-rw-r--r--testing/ocaml/060_all_linkorder.patch50
-rw-r--r--testing/ocaml/APKBUILD40
6 files changed, 407 insertions, 3 deletions
diff --git a/testing/ocaml/010_all_execstacks.patch b/testing/ocaml/010_all_execstacks.patch
new file mode 100644
index 000000000..87e30f402
--- /dev/null
+++ b/testing/ocaml/010_all_execstacks.patch
@@ -0,0 +1,240 @@
+Fix the EXEC_STACK in ocaml compiled binaries (#153382)
+
+Index: ocaml-3.12.0/asmcomp/alpha/emit.mlp
+===================================================================
+--- ocaml-3.12.0.orig/asmcomp/alpha/emit.mlp
++++ ocaml-3.12.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.12.0/asmrun/alpha.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/alpha.S
++++ ocaml-3.12.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.12.0/asmrun/arm.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/arm.S
++++ ocaml-3.12.0/asmrun/arm.S
+@@ -316,3 +316,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.12.0/asmrun/hppa.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/hppa.S
++++ ocaml-3.12.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.12.0/asmrun/ia64.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/ia64.S
++++ ocaml-3.12.0/asmrun/ia64.S
+@@ -521,3 +521,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.12.0/asmrun/m68k.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/m68k.S
++++ ocaml-3.12.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.12.0/asmrun/sparc.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/sparc.S
++++ ocaml-3.12.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.12.0/asmcomp/arm/emit.mlp
+===================================================================
+--- ocaml-3.12.0.orig/asmcomp/arm/emit.mlp
++++ ocaml-3.12.0/asmcomp/arm/emit.mlp
+@@ -601,6 +601,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() =
+@@ -617,6 +624,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.12.0/asmcomp/hppa/emit.mlp
+===================================================================
+--- ocaml-3.12.0.orig/asmcomp/hppa/emit.mlp
++++ ocaml-3.12.0/asmcomp/hppa/emit.mlp
+@@ -996,6 +996,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() =
+@@ -1024,6 +1030,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.12.0/asmcomp/ia64/emit.mlp
+===================================================================
+--- ocaml-3.12.0.orig/asmcomp/ia64/emit.mlp
++++ ocaml-3.12.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.12.0/asmcomp/power/emit.mlp
+===================================================================
+--- ocaml-3.12.0.orig/asmcomp/power/emit.mlp
++++ ocaml-3.12.0/asmcomp/power/emit.mlp
+@@ -927,6 +927,12 @@ let data l =
+ emit_string data_space;
+ List.iter emit_item l
+
++(* Mark stack as non executable *)
++let nx_stack() =
++ if Config.system = "elf" then
++ ` .section .note.GNU-stack,\"\",%progbits\n`
++
++
+ (* Beginning / end of an assembly file *)
+
+ let begin_assembly() =
+@@ -943,6 +949,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.12.0/asmcomp/sparc/emit.mlp
+===================================================================
+--- ocaml-3.12.0.orig/asmcomp/sparc/emit.mlp
++++ ocaml-3.12.0/asmcomp/sparc/emit.mlp
+@@ -742,6 +742,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() =
+@@ -755,6 +761,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`;
+Index: ocaml-3.12.0/asmrun/power-elf.S
+===================================================================
+--- ocaml-3.12.0.orig/asmrun/power-elf.S
++++ ocaml-3.12.0/asmrun/power-elf.S
+@@ -418,3 +418,8 @@ caml_system__frametable:
+ .long .L105 + 4 /* return address into callback */
+ .short -1 /* negative size count => use callback link */
+ .short 0 /* no roots here */
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",%progbits
++#endif
++
diff --git a/testing/ocaml/020_all_configure.patch b/testing/ocaml/020_all_configure.patch
new file mode 100644
index 000000000..2ae0c4943
--- /dev/null
+++ b/testing/ocaml/020_all_configure.patch
@@ -0,0 +1,50 @@
+The configure script doesn't inherit previous defined variables,
+overwriting previous declarations of bytecccompopts, bytecclinkopts,
+nativecccompopts and nativecclinkopts. Reported upstream as issue 0004267.
+
+Index: ocaml-3.12.0/configure
+===================================================================
+--- ocaml-3.12.0.orig/configure
++++ ocaml-3.12.0/configure
+@@ -241,7 +241,7 @@ esac
+ # Configure the bytecode compiler
+
+ bytecc="$cc"
+-mkexe="\$(BYTECC)"
++mkexe="\$(BYTECC) \$(BYTECCLINKOPTS)"
+ bytecccompopts=""
+ bytecclinkopts=""
+ dllccompopts=""
+@@ -1582,7 +1582,15 @@ fi
+
+ # Final twiddling of compiler options to work around known bugs
+
++bytecccompopts="$CFLAGS $bytecccompopts"
++bytecclinkopts="$LDFLAGS $bytecclinkopts"
++natdynlinkopts="$LDFLAGS $natdynlinkopts"
++nativeccrawlinkopts="$RAW_LDFLAGS $nativecclinkopts"
++nativecclinkopts="$LDFLAGS $nativecclinkopts"
++nativecccompopts="$CFLAGS $nativecccompopts"
+ nativeccprofopts="$nativecccompopts"
++mksharedlib="$mksharedlib $LDFLAGS"
++mkmaindll="$mkmaindll $LDFLAGS"
+ case "$buggycc" in
+ gcc.2.96)
+ bytecccompopts="$bytecccompopts -fomit-frame-pointer"
+@@ -1618,6 +1626,7 @@ echo "NATIVECC=$nativecc" >> Makefile
+ echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
+ echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
+ echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
++echo "NATIVECCRAWLINKOPTS=$nativeccrawlinkopts" >> Makefile
+ echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
+ echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile
+ echo "ASM=$as" >> Makefile
+@@ -1630,7 +1639,7 @@ echo "DEBUGGER=$debugger" >> Makefile
+ echo "CC_PROFILE=$cc_profile" >> Makefile
+ echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
+ echo "PARTIALLD=$partialld" >> Makefile
+-echo "PACKLD=\$(PARTIALLD) \$(NATIVECCLINKOPTS) -o " \
++echo "PACKLD=\$(PARTIALLD) \$(NATIVECCRAWLINKOPTS) -o " \
+ | sed -e 's/ $/\\ /' >> Makefile
+ echo "DLLCCCOMPOPTS=$dllccompopts" >> Makefile
+ echo "IFLEXDIR=$iflexdir" >> Makefile
diff --git a/testing/ocaml/040_all_yaccldflags.patch b/testing/ocaml/040_all_yaccldflags.patch
new file mode 100644
index 000000000..872f254e8
--- /dev/null
+++ b/testing/ocaml/040_all_yaccldflags.patch
@@ -0,0 +1,17 @@
+Respect LDFLAGS for ocamlyacc
+
+http://caml.inria.fr/mantis/view.php?id=4698
+
+Index: ocaml-3.12.0/yacc/Makefile
+===================================================================
+--- ocaml-3.12.0.orig/yacc/Makefile
++++ ocaml-3.12.0/yacc/Makefile
+@@ -25,7 +25,7 @@ OBJS= closure.o error.o lalr.o lr0.o mai
+ all: ocamlyacc$(EXE)
+
+ ocamlyacc$(EXE): $(OBJS)
+- $(CC) $(CFLAGS) $(CCLINKFLAGS) -o ocamlyacc $(OBJS)
++ $(CC) $(LDFLAGS) $(CFLAGS) $(CCLINKFLAGS) -o ocamlyacc $(OBJS)
+
+ version.h : ../VERSION
+ echo "#define OCAML_VERSION \"`sed -e 1q ../VERSION`\"" >version.h
diff --git a/testing/ocaml/050_all_objinfoldflags.patch b/testing/ocaml/050_all_objinfoldflags.patch
new file mode 100644
index 000000000..3c1ff9f46
--- /dev/null
+++ b/testing/ocaml/050_all_objinfoldflags.patch
@@ -0,0 +1,13 @@
+Index: ocaml-3.12.0/tools/Makefile.shared
+===================================================================
+--- ocaml-3.12.0.orig/tools/Makefile.shared
++++ ocaml-3.12.0/tools/Makefile.shared
+@@ -229,7 +229,7 @@ beforedepend:: opnames.ml
+ # Display info on compiled files
+
+ objinfo_helper$(EXE): objinfo_helper.c ../config/s.h
+- $(BYTECC) -o objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
++ $(MKEXE) -o objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
+ objinfo_helper.c $(LIBBFD_LINK)
+
+ OBJINFO=../utils/misc.cmo ../utils/config.cmo ../bytecomp/bytesections.cmo \
diff --git a/testing/ocaml/060_all_linkorder.patch b/testing/ocaml/060_all_linkorder.patch
new file mode 100644
index 000000000..07176b47c
--- /dev/null
+++ b/testing/ocaml/060_all_linkorder.patch
@@ -0,0 +1,50 @@
+Always pass the libraries to link as last argument to the linker.
+Should fix build failures with as-needed such as:
+https://bugs.gentoo.org/show_bug.cgi?id=331075
+https://bugs.gentoo.org/show_bug.cgi?id=331377
+
+Index: ocaml-3.12.0/utils/ccomp.ml
+===================================================================
+--- ocaml-3.12.0.orig/utils/ccomp.ml
++++ ocaml-3.12.0/utils/ccomp.ml
+@@ -98,8 +98,18 @@ type link_mode =
+ | MainDll
+ | Partial
+
++let is_lib name = String.length name >= 2 && String.sub name 0 2 = "-l"
++
++let rec link_order init libs = function
++ [] -> List.rev_append init (List.rev libs)
++ | t::q -> if is_lib t then link_order init (t::libs) q else link_order (t::init) libs q
++
++let rec split_libs libs others = function
++ [] -> (libs, others)
++ | t::q -> if is_lib t then split_libs (t::libs) others q else split_libs libs (t::others) q
++
+ let call_linker mode output_name files extra =
+- let files = quote_files files in
++ let files = quote_files (link_order [] [] files) in
+ let cmd =
+ if mode = Partial then
+ Printf.sprintf "%s%s %s %s"
+@@ -108,7 +118,8 @@ let call_linker mode output_name files e
+ files
+ extra
+ else
+- Printf.sprintf "%s -o %s %s %s %s %s %s %s"
++ let (cclibs,ccopts) = split_libs [] [] !Clflags.ccopts in
++ Printf.sprintf "%s -o %s %s %s %s %s %s %s %s"
+ (match !Clflags.c_compiler, mode with
+ | Some cc, _ -> cc
+ | None, Exe -> Config.mkexe
+@@ -120,8 +131,9 @@ let call_linker mode output_name files e
+ (if !Clflags.gprofile then Config.cc_profile else "")
+ "" (*(Clflags.std_include_flag "-I")*)
+ (quote_prefixed "-L" !Config.load_path)
+- (String.concat " " (List.rev !Clflags.ccopts))
++ (String.concat " " ccopts)
+ files
++ (String.concat " " cclibs)
+ extra
+ in
+ command cmd = 0
diff --git a/testing/ocaml/APKBUILD b/testing/ocaml/APKBUILD
index c92ad7426..2c26c4148 100644
--- a/testing/ocaml/APKBUILD
+++ b/testing/ocaml/APKBUILD
@@ -2,15 +2,21 @@
# Maintainer: Borys Zhukov <mp5@mp5.im>
pkgname=ocaml
pkgver=3.12.1
-pkgrel=0
+pkgrel=1
pkgdesc="Main implementation of the Caml programming language"
url="http://caml.inria.fr"
arch="all"
license="QPL-1.0/GPLv2"
makedepends="ncurses-dev zlib-dev gdbm-dev"
install=""
+options="textrels"
subpackages="$pkgname-doc"
source="http://caml.inria.fr/pub/distrib/ocaml-3.12/$pkgname-$pkgver.tar.gz
+ 010_all_execstacks.patch
+ 020_all_configure.patch
+ 040_all_yaccldflags.patch
+ 050_all_objinfoldflags.patch
+ 060_all_linkorder.patch
"
_builddir="$srcdir/$pkgname-$pkgver"
@@ -26,7 +32,18 @@ prepare() {
build() {
cd "$_builddir"
- ./configure -cc "${CC:-gcc} -fPIC -fno-pie" \
+
+ #strip out -fomit-frame-pointer due to -pg
+ local _cflags="$CFLAGS"
+ CFLAGS="-fPIC"
+ for i in $_cflags; do
+ case $i in
+ -fomit-frame-pointer);;
+ *) CFLAGS="$CFLAGS $i";;
+ esac
+ done
+
+ LDFLAGS="$LDFLAGS -fno-pie" ./configure -cc "${CC:-gcc}" \
-bindir /usr/bin \
-libdir /usr/lib/ocaml \
-mandir /usr/share/man \
@@ -47,4 +64,21 @@ package() {
find "$pkgdir"/usr/lib/ocaml -name \*.ml -delete
}
-md5sums="814a047085f0f901ab7d8e3a4b7a9e65 ocaml-3.12.1.tar.gz"
+md5sums="814a047085f0f901ab7d8e3a4b7a9e65 ocaml-3.12.1.tar.gz
+ef0810371df5ca55843f8faf6707cd6f 010_all_execstacks.patch
+2a88918e39e30016b1575b3ac740bb63 020_all_configure.patch
+2c7171ae2c8c77ceadabbd4db7f6e01b 040_all_yaccldflags.patch
+baed56051b58c3a7aef9248e85771de0 050_all_objinfoldflags.patch
+b52c8999a7bf66fc3eab0de79cd2b4cc 060_all_linkorder.patch"
+sha256sums="4f81ab86258be0eea1507dd5338c8670490f8616249821e731f8ac1c64caa4a7 ocaml-3.12.1.tar.gz
+083649669bcafb2778336f776bfa37e0448a2e52b104447ef3a4bc212f1df87b 010_all_execstacks.patch
+ff91dc8def0a2829bca64cdd8af5cb59073ca958753f18172d3bbc3bfede6c11 020_all_configure.patch
+f663febae991b57c8b02cfe2b25f7ee0cbc1c6307f6d1b8b4148fda6b8f8d871 040_all_yaccldflags.patch
+29e4fb60d61c73cca31da65c0742c17a6f67ef18c04b24d591cbc44c3b8dec9a 050_all_objinfoldflags.patch
+1ce54407303ff6e03c7c8ba39bac7ede7d252e8fcf56b5bde54ffe4c3843b3e9 060_all_linkorder.patch"
+sha512sums="9d594721816bb5e0edbb50e35496bc5f228a4419b05d518ea7fc72975b18c27ee0f34247efc3bdd264214eb285e72ddb42516fbae2f499a780e62ea4f9b85756 ocaml-3.12.1.tar.gz
+2f408565a249e26bceaf1055e7923b103bb0e94f2381b1294aa8de286e6c06942ae89958e1c1dc275fe85ad56ff95484c3ca8a836cd29edaf27dadb1d06f4706 010_all_execstacks.patch
+7ff4ad6dfbfbf97d44269fae8cb3bee1ea4e55ae7c83385a5acf27c1041a8c96e9dbf25f6359be65d263f4b6ae854b447855eda9e6ac64da3d48a3083456c5a8 020_all_configure.patch
+007a787fd57e209302c999b1fb018bae94fe2150f7ecbbddec7e637444ee8e3f9965b14d0f89eab4e68cf5c374cc7e4bdc1087120be64efe7a953a21cd160bce 040_all_yaccldflags.patch
+02c3dcf8c18bafc984f1396c576704b20a566e08a963bad877295018ede86dd530a6f770bab156506532564606f148454407e2497c19985a52a1d68625f1330f 050_all_objinfoldflags.patch
+888f3aac57751fc6944f62e8cb14e3c17184f331144a58058ee8ac49a3a9add49f7a6e0f6024a36b960d0b8e8db9e80fbf91318c63241f86248caab4b2fdd99e 060_all_linkorder.patch"