aboutsummaryrefslogtreecommitdiffstats
path: root/community/ocaml
diff options
context:
space:
mode:
authorAnil Madhavapeddy <anil@recoil.org>2016-12-01 18:23:02 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2016-12-02 21:20:45 +0000
commit801ace687ae3930b8c1bc3cc722aac05e0910f37 (patch)
treeccbcb858313b3533963883f7413aac04e50f8fcd /community/ocaml
parentcf560a843119e90bb2950edc50c7e30c86e970fb (diff)
downloadaports-801ace687ae3930b8c1bc3cc722aac05e0910f37.tar.bz2
aports-801ace687ae3930b8c1bc3cc722aac05e0910f37.tar.xz
community/ocaml: move from testing to community
Diffstat (limited to 'community/ocaml')
-rw-r--r--community/ocaml/010_all_execstacks.patch40
-rw-r--r--community/ocaml/020_all_configure.patch51
-rw-r--r--community/ocaml/050_all_objinfoldflags.patch13
-rw-r--r--community/ocaml/APKBUILD75
4 files changed, 179 insertions, 0 deletions
diff --git a/community/ocaml/010_all_execstacks.patch b/community/ocaml/010_all_execstacks.patch
new file mode 100644
index 0000000000..30cf23ec61
--- /dev/null
+++ b/community/ocaml/010_all_execstacks.patch
@@ -0,0 +1,40 @@
+Fix the EXEC_STACK in ocaml compiled binaries (#153382)
+
+Index: ocaml-4.03.0+beta1/asmrun/sparc.S
+===================================================================
+--- ocaml-4.03.0+beta1.orig/asmrun/sparc.S
++++ ocaml-4.03.0+beta1/asmrun/sparc.S
+@@ -358,3 +358,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-4.03.0+beta1/asmcomp/sparc/emit.mlp
+===================================================================
+--- ocaml-4.03.0+beta1.orig/asmcomp/sparc/emit.mlp
++++ ocaml-4.03.0+beta1/asmcomp/sparc/emit.mlp
+@@ -737,6 +737,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() =
+@@ -750,6 +756,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/community/ocaml/020_all_configure.patch b/community/ocaml/020_all_configure.patch
new file mode 100644
index 0000000000..4505a987ec
--- /dev/null
+++ b/community/ocaml/020_all_configure.patch
@@ -0,0 +1,51 @@
+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-4.03.0+beta1/configure
+===================================================================
+--- ocaml-4.03.0+beta1.orig/configure
++++ ocaml-4.03.0+beta1/configure
+@@ -290,7 +290,7 @@ esac
+ # Configure the bytecode compiler
+
+ bytecc="$cc"
+-mkexe="\$(BYTECC)"
++mkexe="\$(BYTECC) \$(BYTECCLINKOPTS)"
+ mkexedebugflag="-g"
+ bytecccompopts=""
+ bytecclinkopts=""
+@@ -1671,6 +1671,16 @@ fi
+ echo "X11_INCLUDES=$x11_include" >> Makefile
+ echo "X11_LINK=$x11_link" >> Makefile
+
++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"
++
+ # Look for BFD library
+
+ if sh ./hasgot -DPACKAGE=ocaml -i bfd.h && \
+@@ -1769,6 +1779,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
+@@ -1780,7 +1791,7 @@ echo "OTHERLIBRARIES=$otherlibraries" >>
+ 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/community/ocaml/050_all_objinfoldflags.patch b/community/ocaml/050_all_objinfoldflags.patch
new file mode 100644
index 0000000000..e7b2fc170f
--- /dev/null
+++ b/community/ocaml/050_all_objinfoldflags.patch
@@ -0,0 +1,13 @@
+Index: ocaml-4.03.0+beta1/tools/Makefile.shared
+===================================================================
+--- ocaml-4.03.0+beta1.orig/tools/Makefile.shared
++++ ocaml-4.03.0+beta1/tools/Makefile.shared
+@@ -273,7 +273,7 @@ CCOUT = -o $(EMPTY)
+ endif
+
+ objinfo_helper$(EXE): objinfo_helper.c ../config/s.h
+- $(BYTECC) $(CCOUT)objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
++ $(MKEXE) $(CCOUT)objinfo_helper$(EXE) $(BYTECCCOMPOPTS) \
+ $(DEF_SYMBOL_PREFIX) $(LIBBFD_INCLUDE) objinfo_helper.c $(LIBBFD_LINK)
+
+ OBJINFO=../compilerlibs/ocamlcommon.cma \
diff --git a/community/ocaml/APKBUILD b/community/ocaml/APKBUILD
new file mode 100644
index 0000000000..b19e1f5b0a
--- /dev/null
+++ b/community/ocaml/APKBUILD
@@ -0,0 +1,75 @@
+# Contributor: Borys Zhukov <mp5@mp5.im>
+# Maintainer: Borys Zhukov <mp5@mp5.im>
+pkgname=ocaml
+pkgver=4.03.0
+pkgrel=0
+pkgdesc="Main implementation of the Caml programming language"
+url="http://caml.inria.fr"
+arch="all"
+license="LGPLv2"
+makedepends="ncurses-dev zlib-dev gdbm-dev"
+install=""
+options="textrels"
+subpackages="$pkgname-doc"
+source="http://caml.inria.fr/pub/distrib/ocaml-${pkgver%.*}/$pkgname-$pkgver.tar.gz
+ 010_all_execstacks.patch
+ 020_all_configure.patch
+ 050_all_objinfoldflags.patch
+ "
+
+_builddir="$srcdir/$pkgname-$pkgver"
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+
+ #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 \
+ || return 1
+ make -j1 world.opt || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make BINDIR="$pkgdir"/usr/bin LIBDIR="$pkgdir"/usr/lib/ocaml MANDIR="$pkgdir"/usr/share/man install || return 1
+
+ install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+
+ install -Dm644 INSTALL "$pkgdir"/usr/share/doc/$pkgname/INSTALL
+ install -Dm644 Changes "$pkgdir"/usr/share/doc/$pkgname/Changes
+ install -Dm644 README "$pkgdir"/usr/share/doc/$pkgname/README
+
+ find "$pkgdir"/usr/lib/ocaml -name \*.ml -delete
+}
+md5sums="43812739ea1b4641cf480f57f977c149 ocaml-4.03.0.tar.gz
+08f8697f0c9aca620fb946418cd7272e 010_all_execstacks.patch
+6e11ac70d23a21d9b38ac6b30cecc243 020_all_configure.patch
+6d63f3e63a4bd533fd1884e78a6de2ba 050_all_objinfoldflags.patch"
+sha256sums="7fdf280cc6c0a2de4fc9891d0bf4633ea417046ece619f011fd44540fcfc8da2 ocaml-4.03.0.tar.gz
+a32653d95498bdbdec4595d2d93270d6719b5512d7f0c2787fc216699aa5bc23 010_all_execstacks.patch
+747c8a48b5988776d1b0e9cbbf77b9dac63315d17854e9202b150362c16054e7 020_all_configure.patch
+59c2bf7465bfc44ca5b984ba84a25341b2b7b7aae2c5019c1e3d3f26aeb22766 050_all_objinfoldflags.patch"
+sha512sums="91d5c0b2fcc52fc05be64bf54d3c7be8d77ee754e847907909d4e123c1d00c9f62523770d56bb81f80200f75ec53ab874e031ce46f7b437febbd3a8e6800e2ca ocaml-4.03.0.tar.gz
+71ac807fb1173863b9dcf8e5fb4e651e0155d6cd0e4b327f5457b83fc09e1b5fbe34150c5d8ccd24f0faff1a8419f5ed8310aa60af1f38c2766ccc37dc6c3835 010_all_execstacks.patch
+286758402517a1345556d374b0c3fc49eb93f1ec2bb9ccd2ffe1cc043f59d93b154f68eb9ff410020a15d3d8f148b27f249b7f97954b0e8a080cdd32d6014b4a 020_all_configure.patch
+61d9cae6c8be7c16ed4aa6fafc533e2879caadbbe0e023775c1d735c0e54e66e94b9ffab8dc0b0b12c19ccf5c389e05f62af822014d202ae54c52943a0639753 050_all_objinfoldflags.patch"