aboutsummaryrefslogtreecommitdiffstats
path: root/testing/reason
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2018-03-10 14:17:29 +0100
committerJakub Jirutka <jakub@jirutka.cz>2018-03-10 14:18:03 +0100
commit038e244d1de38735118b697e32d81161042ba7ab (patch)
tree493be2c8f928451d69a7b0e11f508b8d48c14b82 /testing/reason
parent1e84a70462b5c9de9c468ab1593bd257706a5cc7 (diff)
downloadaports-038e244d1de38735118b697e32d81161042ba7ab.tar.bz2
aports-038e244d1de38735118b697e32d81161042ba7ab.tar.xz
testing/reason: new aport
http://reasonml.github.io/ Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
Diffstat (limited to 'testing/reason')
-rw-r--r--testing/reason/APKBUILD150
-rw-r--r--testing/reason/rtop.sh.patch41
2 files changed, 191 insertions, 0 deletions
diff --git a/testing/reason/APKBUILD b/testing/reason/APKBUILD
new file mode 100644
index 0000000000..bdb681f6fb
--- /dev/null
+++ b/testing/reason/APKBUILD
@@ -0,0 +1,150 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=reason
+pkgver=3.0.4
+pkgrel=0
+pkgdesc="Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems"
+url="http://reasonml.github.io/"
+# x86, armhf, s390x: limited by ocaml aport
+# ppc64le: limited by ocaml-utop aport
+arch="all !x86 !armhf !s390x !ppc64le"
+license="MIT"
+checkdepends="nodejs utop-full"
+_menhirver=20171013
+makedepends="
+ bash
+ dune
+ ocaml
+ ocaml-compiler-libs
+ ocaml-findlib-dev
+ ocaml-menhir-dev=~$_menhirver
+ ocaml-merlin-extend-dev
+ ocaml-migrate-parsetree-dev
+ ocaml-result-dev
+ ocaml-utop-dev
+ ocamlbuild
+ opam
+ "
+options="!check" # FIXME: tests cannot find reason's modules
+subpackages="
+ ocaml-$pkgname-dev:_libdev
+ $pkgname-merlin
+ $pkgname-reactjs
+ $pkgname-rebuild
+ $pkgname-rtop
+ ocaml-$pkgname:_lib
+ "
+source="$pkgname-$pkgver.tar.gz::https://github.com/facebook/$pkgname/archive/$pkgver.tar.gz
+ rtop.sh.patch"
+builddir="$srcdir/$pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+ jbuilder build @install
+}
+
+check() {
+ cd "$builddir"
+ jbuilder runtest
+}
+
+package() {
+ cd "$builddir"
+
+ opam-installer -i \
+ --prefix="$pkgdir/usr" \
+ --libdir="$pkgdir/usr/lib/ocaml" \
+ --docdir="$pkgdir/doc" \
+ --mandir="$pkgdir/usr/share/man" \
+ $pkgname.install
+
+ cd "$pkgdir"
+
+ # There's just a readme and changelog.
+ rm -Rf doc
+
+ # Remove annotation files and sources.
+ find usr/lib/ocaml \
+ -name '*.cmt' -delete \
+ -o -name '*.cmti' -delete \
+ -o -name '*.ml' -delete
+
+ # Just for internal tests.
+ rm usr/bin/testOprint
+
+ # This is probably used only to generate parser (?).
+ rm usr/bin/menhir_error_processor
+
+ mkdir -p usr/share/$pkgname-rtop
+ mv usr/bin/rtop_init.ml usr/share/$pkgname-rtop/
+}
+
+_libdev() {
+ pkgdesc="$pkgdesc (development files)"
+ depends="ocaml-$pkgname=$pkgver-r$pkgrel"
+ local sitelib="usr/lib/ocaml/$pkgname"
+
+ cd "$pkgdir"
+
+ local path; for path in $(find $sitelib/ \
+ -name '*.a' \
+ -o -name '*.cmx' \
+ -o -name '*.cmxa' \
+ -o -name '*.mli')
+ do
+ mkdir -p "$subpkgdir"/${path%/*}
+ mv "$path" "$subpkgdir"/${path%/*}/
+ done
+ rmdir "$subpkgdir"/$sitelib 2>/dev/null || true
+}
+
+merlin() {
+ pkgdesc="Reason extension to Merlin - context sensitive completion"
+ depends="ocaml-merlin"
+
+ _submv usr/bin/ocamlmerlin-reason
+}
+
+reactjs() {
+ pkgdesc="ReactJS interop that translates Reason JSX to JS"
+
+ _submv usr/bin/ppx_react
+ _submv usr/bin/reactjs_jsx_ppx_v2
+ _submv usr/bin/reactjs_jsx_ppx_v3
+}
+
+rebuild() {
+ pkgdesc="Simple build system for Reason based on OCamlbuild"
+ depends="$pkgname ocamlbuild"
+
+ _submv usr/bin/rebuild
+}
+
+rtop() {
+ pkgdesc="REPL for Reason based on Utop"
+ depends="$pkgname=$pkgver-r$pkgrel
+ ocaml-$pkgname=$pkgver-r$pkgrel
+ ocaml-menhir-dev=~$_menhirver
+ utop-full"
+
+ _submv usr/bin/rtop
+ _submv usr/lib/ocaml/$pkgname/rtop
+ _submv usr/share/$pkgname-rtop
+}
+
+_lib() {
+ pkgdesc="$pkgdesc (library)"
+ depends="ocaml-runtime ocaml-menhir=~$_menhirver ocaml-migrate-parsetree"
+
+ _submv usr/lib/ocaml/$pkgname
+}
+
+_submv() {
+ local path="$1"
+ mkdir -p "$subpkgdir"/${path%/*}
+ mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
+ rmdir -p "$pkgdir"/${path%/*} 2>/dev/null || true
+}
+
+sha512sums="ba21920b7320841b08cf0684aeb6718be92b175e2ab71d3b96b317f047c9726b656088cf1a4770766335d4f8a54194b84173e2d7458eabb9e2c0b89a78b1eb95 reason-3.0.4.tar.gz
+5a658798a27fa69cc2685353cf0c26dfd95ea6a1d8d5c53c6476500b37b86c18b7b1d26fecac13c5ab0aa91e07f4aa5a7087934e9faca0002dad8f6b8fafd876 rtop.sh.patch"
diff --git a/testing/reason/rtop.sh.patch b/testing/reason/rtop.sh.patch
new file mode 100644
index 0000000000..73682fd4ce
--- /dev/null
+++ b/testing/reason/rtop.sh.patch
@@ -0,0 +1,41 @@
+--- a/src/rtop/rtop.sh
++++ b/src/rtop/rtop.sh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env bash
++#!/bin/sh
+ # Copyright (c) 2015-present, Facebook, Inc. All rights reserved.
+
+
+@@ -13,15 +13,26 @@
+ # require's reason, so that reason is required after .ocamlinit is
+ # parsed in standard syntax.
+
+-touch $HOME/.utoprc
+-touch $HOME/.utop-history
+-DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
++# Enable pipefail if supported.
++if ( set -o pipefail 2>/dev/null ); then
++ set -o pipefail
++fi
+
++touch "$HOME"/.utoprc
++touch "$HOME"/.utop-history
++
+ # intercept the -stdin flag of utop, and preprocess the code into reason code
+ # before forwarding it. Afaik currently there's no better way of intercepting
+ # the code after urtop receives code from stdin and before it processes it
+-if [[ $@ =~ "stdin" ]]; then
+- refmt --parse re --print ml --interface false | utop-full $@
++stdin=no
++for arg in "$@"; do
++ case "$arg" in
++ -stdin) stdin=yes; break;;
++ esac
++done
++
++if [ "$stdin" = yes ]; then
++ refmt --parse re --print ml --interface false | utop-full "$@"
+ else
+- utop-full -init $DIR/rtop_init.ml $@ -I $HOME -safe-string
++ utop-full -init /usr/share/reason-rtop/rtop_init.ml "$@" -I "$HOME" -safe-string
+ fi