ysulsky avatar ysulsky committed d48bac2

clean up the build scripts, don't depend on a patched oasis

Comments (0)

Files changed (17)

base/async/core/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../../build-common.sh
 
-my_join () {
-    local FIRST="true"
-    while read line; do
-        if [[ "$FIRST" != "true" ]]; then
-            echo -n ","
-        else
-            FIRST="false"
-        fi
-        echo -n "$line"
-    done
-    echo
+function list_mods {
+    find "$HERE/lib" -name "*.ml" -print | mod_names
 }
 
-list_mods () {
-    echo Std
-    for i in $here/$1/*.ml; do
-        bname="$(basename $i)"
-        j=${bname%%.ml*};
-        case $j in
-            inline_tests_runner) continue;;
-            *);;
-        esac
-        echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1};
-    done
-}
+MODULES="$(list_mods | sort -u | my_join)"
 
-list_stubs () {
-    for i in "$here"/lib/*.{c,h} "$here"/lib/*.{c,h}; do
-        bname="$(basename $i)"
-        j=${bname%%.?};
-        case $j in
-            *);;
-        esac
-        echo "$bname"
-    done
-}
-
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 
 OASISFormat:  0.2
   Path:               lib
   FindlibName:        async_core
   Pack:               true
-  Modules:$(list_mods lib | sort -u | my_join)
+  Modules:            ${MODULES}
   BuildDepends:       sexplib.syntax,
                       sexplib,
                       fieldslib.syntax,
 
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags "$HERE/_tags" <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Async_core $HERE/lib/*.ml)
+
 <lib/*.ml{,i}>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml async_core
+
 ./configure "$@"
 

base/async/extra/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../../build-common.sh
 
-my_join () {
-    local FIRST="true"
-    while read line; do
-        if [[ "$FIRST" != "true" ]]; then
-            echo -n ","
-        else
-            FIRST="false"
-        fi
-        echo -n "$line"
-    done
-    echo
+function list_mods {
+    find "$HERE/lib" -name "*.ml" -print | mod_names
 }
 
-list_mods () {
-    echo Std
-    for i in $here/$1/*.ml; do
-        bname="$(basename $i)"
-        j=${bname%%.ml*};
-        case $j in
-            inline_tests_runner) continue;;
-            *);;
-        esac
-        echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1};
-    done
-}
+MODULES=$(list_mods | sort -u | my_join)
 
-list_stubs () {
-    for i in "$here"/lib/*.{c,h} "$here"/lib/*.{c,h}; do
-        bname="$(basename $i)"
-        j=${bname%%.?};
-        case $j in
-            *);;
-        esac
-        echo "$bname"
-    done
-}
-
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 
 OASISFormat:  0.2
   Path:               lib
   FindlibName:        async_extra
   Pack:               true
-  Modules:$(list_mods lib | sort -u | my_join)
+  Modules:            ${MODULES}
   BuildDepends:       sexplib.syntax,
                       sexplib,
                       fieldslib.syntax,
 
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags "$HERE/_tags" <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Async_extra $HERE/lib/*.ml)
+
 <lib/*.ml{,i}>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml async_extra
+
 ./configure "$@"
 

base/async/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-my_join () {
-    local FIRST="true"
-    while read line; do
-        if [[ "$FIRST" != "true" ]]; then
-            echo -n ","
-        else
-            FIRST="false"
-        fi
-        echo -n "$line"
-    done
-    echo
+function list_mods {
+    find "$HERE/lib" -name "*.ml" -print | mod_names
 }
 
-list_mods () {
-    echo Std
-    for i in $here/$1/*.ml; do
-        bname="$(basename $i)"
-        j=${bname%%.ml*};
-        case $j in
-            *);;
-        esac
-        echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1};
-    done
-}
+MODULES="$(list_mods | sort -u | my_join)"
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 
 OASISFormat:  0.2
 Library async
   Path:               lib
   FindlibName:        async
-  Pack:               true
-  Modules:$(list_mods lib | sort -u | my_join)
+  #Pack:               true
+  Modules:            ${MODULES}
   BuildDepends:       async_core,
                       async_scheduler,
                       async_extra,
 
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Async $HERE/lib/*.ml)
+
 # <lib_test/*.ml{,i}>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml async
+
 ./configure "$@"
 

base/async/scheduler/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-enable_linux=false
-enable_linux_default="--disable-linux"
-case $(ocamlc -config | awk '$1 == "system:" {print $2}') in
-    linux|linux_elf)
-        enable_linux=true
-        enable_linux_default="--enable-linux"
-    ;;
-esac
+source ../../../build-common.sh
 
-opts=( "$@" )
-for ((i=0; i<$#; i++)); do
-    case ${opts[$i]} in
-        --enable-linux)  enable_linux=true;  enable_linux_default= ;;
-        --disable-linux) enable_linux=false; enable_linux_default= ;;
-    esac
-done
+check_linux_enabled "$@"
 
-here="$(dirname "${BASH_SOURCE[0]}")"
-
-my_join () {
-    local FIRST="true"
-    while read line; do
-        if [[ "$FIRST" != "true" ]]; then
-            echo -n ","
-        else
-            FIRST="false"
-        fi
-        echo -n "$line"
-    done
-    echo
+function list_mods {
+    find "$HERE/lib" -name "*.ml" -print | mod_names
 }
 
-list_mods () {
-    echo Std
-    for i in $here/$1/*.ml; do
-        bname="$(basename $i)"
-        j=${bname%%.ml*};
-        case $j in
-            inline_tests_runner) continue;;
-            *);;
-        esac
-        echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1};
-    done
-}
+MODULES=$(list_mods | sort -u | my_join)
 
-list_stubs () {
-    for i in "$here"/lib/*.{c,h} "$here"/lib/*.{c,h}; do
-        bname="$(basename $i)"
-        j=${bname%%.?};
-        case $j in
-            *);;
-        esac
-        echo "$bname"
-    done
-}
-
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 
 OASISFormat:  0.2
   Path:               lib
   FindlibName:        async_scheduler
   Pack:               true
-  Modules:$(list_mods lib | sort -u | my_join)
+  Modules:            ${MODULES}
   BuildDepends:       sexplib.syntax,
                       sexplib,
                       fieldslib.syntax,
 
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags "$HERE/_tags" <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Async_scheduler $HERE/lib/*.ml)
+
 <lib/*.ml{,i}>: syntax_camlp4o
 "lib/async_unix.ml": pkg_camlp4.macro
 "lib/raw_scheduler.ml": pkg_camlp4.macro
 <lib/writer.ml{,i}>: pkg_camlp4.macro
 EOF
 
-cat >$here/lib/config.mlh <<EOF
+cat >$HERE/lib/config.mlh <<EOF
 $(if [[ "$enable_linux" == "true" ]]; then echo "DEFINE LINUX_EXT"; fi)
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml async_scheduler
+
 ./configure "$enable_linux_default" "$@"
 

base/bin-prot/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
 
 Library bin_prot
   Path:               lib
-  Pack:               true
+  #Pack:               true
   Modules:            Binable,
                       Nat0,
                       Common,
   XOCamlbuildLibraries: bin_prot
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Bin_prot $HERE/lib/*.ml)
+
 <lib/read_ml.ml{i,}>: pp(cpp -undef -traditional -Werror -I.)
 <lib/size.ml{i,}>: pp(cpp -undef -traditional -Werror -I.)
 <lib/type_class.ml{i,}>: pp(cpp -undef -traditional -Werror -I.)
 <syntax/pa_bin_prot.ml>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml bin_prot
+
 ./configure "$@"
 

base/compare/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
   XMETADescription:   Syntax extension for "with compare"
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
 <syntax/pa_compare.ml>: syntax_camlp4o
 EOF
 
-mkdir -p $here/lib
+mkdir -p $HERE/lib
 
-cd $here
+cd $HERE
 oasis setup
 ./configure "$@"
 

base/core/extended/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-enable_linux=false
-enable_linux_default="--disable-linux"
-case $(ocamlc -config | awk '$1 == "system:" {print $2}') in
-    linux|linux_elf)
-        enable_linux=true
-        enable_linux_default="--enable-linux"
-    ;;
-esac
+source ../../../build-common.sh
+check_linux_enabled "$@"
+check_posix_timers_enabled "$@"
 
-enable_timers=false
-enable_timers_default="--disable-posix-timers"
-if [[ $(getconf _POSIX_TIMERS 2>/dev/null) -ge 200112 ]]; then
-    enable_timers=true
-    enable_timers_default="--enable-posix-timers"
-fi
-
-opts=( "$@" )
-for ((i=0; i<$#; i++)); do
-    case ${opts[$i]} in
-        --enable-linux)  enable_linux=true;  enable_linux_default= ;;
-        --disable-linux) enable_linux=false; enable_linux_default= ;;
-        --enable-posix-timers)  enable_timers=true;  enable_timers_default= ;;
-        --disable-posix-timers) enable_timers=false; enable_timers_default= ;;
-    esac
-done
-
-here="$(dirname "${BASH_SOURCE[0]}")"
-my_join () {
-    FIRST="true"
-    while read line; do
-        if [[ "$FIRST" != "true" ]]; then
-            echo -n ","
-        else
-            FIRST="false"
-        fi
-        echo -n "$line"
-    done
-    echo
-}
-
-list_mods () {
-    for i in $here/lib/*.ml; do
-        bname="$(basename $i)"
-        j=${bname%%.ml*};
-        case $j in
-            malloc|extended_linux)
-                if [ "$enable_linux" == "false" ]; then continue; fi;;
-            bench|posix_clock)
-                if [ "$enable_timers" == "false" ]; then continue; fi;;
-            inline_tests_runner) continue;;
-            *);;
+function list_mods {
+    for mod in $(find "$HERE/lib" -name "*.ml" -print | mod_names); do
+        case "$mod" in
+            Malloc|Extended_linux)
+                if [[ "$enable_linux" == "true" ]]; then echo "$mod"; fi;;
+            Bench|Posix_clock)
+                if [[ "$enable_timers" == "true" ]]; then echo "$mod"; fi;;
+            *) echo "$mod";;
         esac
-        echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1};
     done
 }
 
-list_stubs () {
-    for i in $here/lib/*.c; do
-        bname="$(basename $i)"
-        j=${bname%%.?};
-        case $j in
+function list_stubs {
+    for stub in $(find "$HERE/lib" -name "*.[ch]" -exec basename \{\} \;); do
+        case "${stub%%.[ch]}" in
             malloc_stubs|extended_linux_stubs)
-                if [ "$enable_linux" == "false" ]; then continue; fi;;
+                if [[ "$enable_linux" == "true" ]]; then echo "$stub"; fi;;
             posix_clock_stubs)
-                if [ "$enable_timers" == "false" ]; then continue; fi;;
-            *);;
+                if [[ "$enable_timers" == "true" ]]; then echo "$stub"; fi;;
+            *) echo "$stub";;
         esac
-        echo "$bname"
     done
 }
 
 MODULES="$(list_mods | sort -u | my_join)"
 CSOURCES="fork_exec.h,$(list_stubs | sort -u | my_join)"
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 
 OASISFormat:  0.2
 Library core_extended
   Path:               lib
   FindlibName:        core_extended
-  Pack:               true
+  #Pack:               true
   Modules:            ${MODULES}
   CSources:           ${CSOURCES}
   CCOpt+:             -Ilib
 
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags "$HERE/_tags" <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Core_extended $HERE/lib/*.ml)
+
 <lib/*.ml{,i}>: syntax_camlp4o
 "lib/std.ml": pkg_camlp4.macro
 "lib/command.ml": pkg_camlp4.macro
 "lib/core_command.ml": pkg_camlp4.macro
 EOF
 
-if [[ ! -e $here/lib/version_defaults.mlh ]]; then
-    cat >$here/lib/version_defaults.mlh <<EOF
+if [[ ! -e $HERE/lib/version_defaults.mlh ]]; then
+    cat >$HERE/lib/version_defaults.mlh <<EOF
 DEFINE DEFAULT_VERSION = "No version info."
 DEFINE DEFAULT_BUILDINFO = "No build info."
 EOF
 fi
 
-cat >$here/lib/config.mlh <<EOF
+cat >$HERE/lib/config.mlh <<EOF
 $(if [[ "$enable_linux"  == "true" ]]; then echo "DEFINE LINUX_EXT"; fi)
 $(if [[ "$enable_timers" == "true" ]]; then echo "DEFINE POSIX_TIMERS"; fi)
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml core_extended
+
 ./configure "$enable_timers_default" "$enable_linux_default" "$@"

base/core/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-enable_linux=false
-enable_linux_default="--disable-linux"
-case $(ocamlc -config | awk '$1 == "system:" {print $2}') in
-    linux|linux_elf)
-        enable_linux=true
-        enable_linux_default="--enable-linux"
-    ;;
-esac
-
-enable_timers=false
-enable_timers_default="--disable-posix-timers"
-if [[ $(getconf _POSIX_TIMERS 2>/dev/null) -ge 200112 ]]; then
-    enable_timers=true
-    enable_timers_default="--enable-posix-timers"
-fi
-
-opts=( "$@" )
-for ((i=0; i<$#; i++)); do
-    case ${opts[$i]} in
-        --enable-linux)  enable_linux=true;  enable_linux_default= ;;
-        --disable-linux) enable_linux=false; enable_linux_default= ;;
-        --enable-posix-timers)  enable_timers=true;  enable_timers_default= ;;
-        --disable-posix-timers) enable_timers=false; enable_timers_default= ;;
-    esac
-done
+source ../../build-common.sh
+check_linux_enabled "$@"
+check_posix_timers_enabled "$@"
 
 use_librt=
 if ld -lrt -shared -o /dev/null 2>/dev/null; then
     use_librt=-lrt
 fi
 
-here="$(dirname "${BASH_SOURCE[0]}")"
-my_join () {
-    local FIRST="true"
-    while read line; do
-        if [[ "$FIRST" != "true" ]]; then
-            echo -n ","
-        else
-            FIRST="false"
-        fi
-        echo -n "$line"
-    done
-    echo
-}
-
-list_mods () {
-    for i in "$here"/lib/*.ml; do
-        bname="$(basename $i)"
-        j=${bname%%.ml*};
-        case $j in
-            linux_ext|bigstring_marshal)
-                if [ "$enable_linux" == "false" ]; then continue; fi;;
-            inline_tests_runner) continue;;
-            *);;
+function list_mods {
+    for mod in $(find "$HERE/lib" -name "*.ml" -print | mod_names); do
+        case "$mod" in
+            Linux_ext|Bigstring_marshal)
+                if [[ "$enable_linux" == "true" ]]; then echo "$mod"; fi;;
+            *) echo "$mod";;
         esac
-        echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1};
     done
 }
 
-list_stubs () {
-    for i in "$here"/lib/*.{c,h}; do
-        bname="$(basename $i)"
-        j=${bname%%.?};
-        case $j in
+function list_stubs {
+    for stub in $(find "$HERE/lib" -name "*.[ch]" -exec basename \{\} \;); do
+        case "${stub%%.[ch]}" in
             linux_ext_stubs|bigstring_marshal_stubs)
-                if [ "$enable_linux" == "false" ]; then continue; fi;;
-            *);;
+                if [[ "$enable_linux" == "true" ]]; then echo "$stub"; fi;;
+            *) echo "$stub";;
         esac
-        echo "$bname"
     done
 }
 
 MODULES="$(list_mods | sort -u | my_join)"
-CSOURCES="config.h,$(list_stubs | sort -u| my_join)"
+CSOURCES="config.h,$(list_stubs | sort -u | my_join)"
 CCLIB="$use_librt"
 
-cat >$here/_oasis<<EOF
+cat >$HERE/_oasis<<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 
 OASISFormat:  0.2
 Library core
   Path:               lib
   FindlibName:        core
-  Pack:               true
+  #Pack:               true
   Modules:${MODULES}
   CCOpt:              $(getconf LFS64_CFLAGS)
   CSources:           ${CSOURCES}
 
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags "$HERE/_tags" <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Core $HERE/lib/*.ml)
+
 <lib{,_test}/*.ml{,i}>: syntax_camlp4o
 <lib/{std,core_int63,bigstring,core_mutex,core_unix,bigstring_marshal,linux_ext}.ml{,i}>:pkg_camlp4.macro
 EOF
 
-cd $here
+cd $HERE
 oasis setup
-./configure "$enable_linux_default" "$@"
+enable_pack_in_setup_ml core
+
+./configure "$enable_linux_default" "$enable_timers_default" "$@"

base/fieldslib/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
 Library fieldslib
   Path:               lib
   FindlibName:        fieldslib
-  Pack:               true
+  #Pack:               true
   Modules:            Field
   XMETAType:          library
 
   XOCamlbuildLibraries: fieldslib
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Fieldslib $HERE/lib/*.ml)
+
 <syntax/pa_fields_conv.ml>: syntax_camlp4o
-<lib/field.cmx>:for-pack(Fieldslib)
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml fieldslib
+
 ./configure "$@"
 

base/pa_ounit/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
   XMETADescription:   Syntax extension writing inline tests
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
 <syntax/pa_ounit.ml>: syntax_camlp4o,pkg_camlp4.extend
 EOF
 
-cd $here
+cd $HERE
 oasis setup
 ./configure "$@"
 

base/pipebang/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
   XMETADescription:   Syntax extension writing inline tests
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
 <lib/pa_pipebang.ml>: syntax_camlp4o,pkg_camlp4.extend
 EOF
 
-cd $here
+cd $HERE
 oasis setup
 ./configure "$@"
 

base/sexplib/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
 Library sexplib
   Path:               lib
   FindlibName:        sexplib
-  Pack:               true
+  #Pack:               true
   Modules:            Type,
                       Parser,
                       Lexer,
   XOCamlbuildLibraries: sexplib
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
-<lib/pre_sexp.ml>: pp(cpp -undef -traditional -Werror -I$here/syntax)
+make_tags $HERE/_tags <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Sexplib $HERE/lib/*.ml{,l,y})
+
+<lib/pre_sexp.ml>: pp(cpp -undef -traditional -Werror -I$HERE/syntax)
 <lib_test/*.ml{,i}>: syntax_camlp4o
 <syntax/pa_sexp_conv.ml>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml sexplib
+
 ./configure "$@"
 

base/type-conv/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.1
 OCamlVersion: >= 3.11
   XOCamlbuildLibraries: type-conv
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
 <syntax/pa_type_conv.ml>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
 ./configure "$@"
 

base/typehash/oasis.sh

 #!/bin/bash
 set -e -u -o pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
   XMETADescription:   Syntax extension for "with typehash"
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
 <syntax/pa_typehash.ml>: syntax_camlp4o,pkg_camlp4.extend
 EOF
 
-mkdir -p $here/lib
+mkdir -p $HERE/lib
 
-cd $here
+cd $HERE
 oasis setup
 ./configure "$@"
 

base/variantslib/oasis.sh

 #!/bin/bash
 set -e -u -o -pipefail
 
-here="$(dirname "${BASH_SOURCE[0]}")"
+source ../../build-common.sh
 
-cat >$here/_oasis <<EOF
+cat >$HERE/_oasis <<EOF
 #AUTOGENERATED FILE; EDIT oasis.sh INSTEAD
 OASISFormat:  0.2
 OCamlVersion: >= 3.12
 Library variantslib
   Path:               lib
   FindlibName:        variantslib
-  Pack:               true
+  #Pack:               true
   Modules:            Variant
   XMETAType:          library
 
   XOCamlbuildLibraries: variantslib
 EOF
 
-cat >$here/_tags <<EOF
-# OASIS_START
-# OASIS_STOP
+make_tags $HERE/_tags <<EOF
+# remove this part when oasis supports Pack: true
+$(tag_for_pack Variantslib $HERE/lib/*.ml)
+
 <syntax/*.ml{,i}>: syntax_camlp4o
 EOF
 
-cd $here
+cd $HERE
 oasis setup
+enable_pack_in_setup_ml variantslib
+
 ./configure "$@"
 

build-and-install

       async/scheduler)    optflags="$linuxflag" ;;
       async) # horrible hack (avoids rebuilding async_{core,scheduler,extra})
           dest=$(mktemp -d)
-          cp -t "$dest" -a lib oasis.sh
-          cd $dest
+          mkdir -p "$dest/base/async"
+          cp -t "$dest/"     -a ../../build-common.sh
+          cp -t "$dest/base/async" -a lib oasis.sh
+          cd $dest/base/async
+          trap "rm -r '$dest'" EXIT
           ;;
   esac
   ./oasis.sh $optflags "${configopts[@]-}"
+#!/bin/bash
+
+function my_join {
+    sep=","
+    if [[ $# -gt 0 ]]; then sep="$1"; fi
+    local cursep=
+    while read line; do
+        echo -n "$cursep"
+        cursep="$sep"
+        echo -n "$line"
+    done
+    echo
+}
+
+function capitalize {
+    local j="$1"
+    echo -n "${j:0:1}" | tr "[:lower:]" "[:upper:]"; echo ${j:1}
+}
+
+function mod_names {
+    while read line; do
+        bname=$(basename "$line")
+        j=${bname%%.ml*};
+        if [[ "$j" == "inline_tests_runner" ]]; then continue; fi
+        capitalize "$j"
+    done
+}
+
+function make_tags {
+    cat >"$1" <<EOF
+# OASIS_START
+# OASIS_STOP
+EOF
+    cat >>"$1"
+}
+
+function tag_for_pack {
+    local libname=$(capitalize "$1")
+    shift
+    for ml in "$@"; do
+        local dir=$(dirname "$ml" | sed -e 's_^\./__')
+        local bname=$(basename "$ml")
+        echo "\"${dir}/${bname%%.ml*}.cmx\": for-pack($libname)"
+        echo "\"${dir}/$(capitalize ${bname%%.ml*}).cmx\": for-pack($libname)"
+    done
+}
+
+function enable_pack_in_setup_ml {
+    awk -f - setup.ml > setup.ml.pack <<EOF
+BEGIN                      { next_pack=0; skipnext=0; }
+/cs_name/                  { next_pack=0; }
+/cs_name = "$1"/           { next_pack=1; }
+/lib_pack = (true|false);/ { if (next_pack) {
+                               print "lib_pack = true;"
+                               skipnext=1
+                             }
+                           }
+/.*/                       { if (!skipnext) { print \$0; }
+                             skipnext=0; }
+EOF
+    mv setup.ml.pack setup.ml
+    for dir in $(find . -name "$1".mllib -exec dirname \{\} \;); do
+        mv "$dir"/"$1".mllib "$dir"/"$1".mlpack
+    done
+}
+
+function check_linux_enabled {
+    enable_linux=false
+    enable_linux_default="--disable-linux"
+    case $(ocamlc -config | awk '$1 == "system:" {print $2}') in
+        linux|linux_elf)
+            enable_linux=true
+            enable_linux_default="--enable-linux"
+            ;;
+    esac
+
+    for opt in "$@"; do
+        case "$opt" in
+            --enable-linux)  enable_linux=true;  enable_linux_default= ;;
+            --disable-linux) enable_linux=false; enable_linux_default= ;;
+        esac
+    done
+}
+
+function check_posix_timers_enabled {
+    enable_timers=false
+    enable_timers_default="--disable-posix-timers"
+    if [[ $(getconf _POSIX_TIMERS 2>/dev/null) -ge 200112 ]]; then
+        enable_timers=true
+        enable_timers_default="--enable-posix-timers"
+    fi
+
+    for opt in "$@"; do
+        case "$opt" in
+            --enable-posix-timers)  enable_timers=true;  enable_timers_default= ;;
+            --disable-posix-timers) enable_timers=false; enable_timers_default= ;;
+        esac
+    done
+}
+
+HERE=$(dirname "$0")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.