My working unpac repository

Update pkg support.

+30 -6
+30 -6
pkg/pkg-builder
··· 1 1 #!/bin/sh 2 2 3 3 # Should be included by a script. The includer should set the variable 4 - # $NATIVE to "true" if it wants native code compilation. 4 + # $NATIVE to "false" if it doesn't want native code compilation. 5 5 6 6 OCAMLBUILD=${OCAMLBUILD:="ocamlbuild -use-ocamlfind -classic-display"} 7 7 B="_build" ··· 10 10 11 11 LIBS=""; ILIBS="" 12 12 BINS=""; IBINS="" 13 + SBIS=""; ISBIS="" 13 14 TOPS=""; ITOPS="" 14 15 SHRS=""; ISHRS="" 16 + ETCS=""; IETCS="" 15 17 DOCS=""; IDOCS="" 16 18 MISC=""; IMISC="" 17 19 STBS=""; ISTBS="" 18 20 MANS=""; IMANS="" 19 21 20 22 add_lib () { LIBS="$LIBS $1"; ILIBS="$ILIBS$NL \"$B/$1\" {\"$2\"}"; } 23 + add_lib_nobuild () { ILIBS="$ILIBS$NL \"?$B/$1\" {\"$2\"}"; } 21 24 add_bin () { BINS="$BINS $1"; IBINS="$IBINS$NL \"$B/$1\" {\"$2\"}"; } 25 + add_sbin () { SBIS="$SBIS $1"; ISBIS="$ISBIS$NL \"$B/$1\" {\"$2\"}"; } 22 26 add_toplevel () { TOPS="$TOPS $1"; ITOPS="$ITOPS$NL \"$B/$1\" {\"$2\"}"; } 23 27 add_share () { SHRS="$SHRS $1"; ISHRS="$ISHRS$NL \"$B/$1\" {\"$2\"}"; } 28 + add_etc () { ETCS="$ETCS $1"; IETCS="$IETCS$NL \"$B/$1\" {\"$2\"}"; } 24 29 add_doc () { DOCS="$DOCS $1"; IDOCS="$IDOCS$NL \"$B/$1\" {\"$2\"}"; } 25 30 add_misc () { MISC="$MISC $1"; IMISC="$IMISC$NL \"$B/$1\" {\"$2\"}"; } 26 31 add_stublibs () { STBS="$STBS $1"; ISTBS="$ISTBS$NL \"$B/$1\" {\"$2\"}"; } ··· 34 39 fi 35 40 case $1 in 36 41 lib) 37 - if [ "$NATIVE" = "true" ]; then 38 - add_lib $SRC $DST 42 + if [ "$NATIVE" != "false" ]; then 43 + case $2 in 44 + *.cmti | *.cmt) add_lib_nobuild $SRC $DST ;; 45 + *) add_lib $SRC $DST ;; 46 + esac 39 47 else 40 48 case $2 in 41 49 *.a | *.cmx | *.cmxa | *.cmxs) ;; 50 + *.cmti | *.cmt) add_lib_nobuild $SRC $DST ;; 42 51 *) add_lib $SRC $DST ;; 43 52 esac 44 53 fi 45 54 ;; 46 55 bin) 47 - if [ "$NATIVE" = "true" ]; then 56 + if [ "$NATIVE" != "false" ]; then 48 57 add_bin $SRC.native $DST 49 58 else 50 59 add_bin $SRC.byte $DST 51 60 fi 52 61 ;; 62 + sbin) 63 + if [ "$NATIVE" != "false" ]; then 64 + add_sbin $SRC.native $DST 65 + else 66 + add_sbin $SRC.byte $DST 67 + fi 68 + ;; 53 69 share) add_share $SRC $DST ;; 70 + etc) add_etc $SRC $DST ;; 54 71 toplevel) add_top $SRC.top $DST ;; 55 72 doc) add_doc $SRC $DST ;; 56 73 misc) add_misc $SRC $DST ;; ··· 59 76 esac 60 77 } 61 78 62 - build () { $OCAMLBUILD $LIBS $BINS $DOCS $TOPS $SHRS $MISC $STBS $MANS; } 79 + build () 80 + { 81 + $OCAMLBUILD $LIBS $BINS $SBIS $DOCS $TOPS $SHRS $ETCS $MISC $STBS $MANS; 82 + } 83 + 63 84 install () 64 85 { 65 86 cat > $1.install <<EOF 66 - opam-version: "1" 67 87 lib: [$ILIBS 68 88 ] 69 89 bin: [$IBINS 70 90 ] 91 + sbin: [$ISBIS 92 + ] 71 93 toplevel: [$ITOPS 72 94 ] 73 95 share: [$ISHRS 96 + ] 97 + etc: [$IETCS 74 98 ] 75 99 doc: [$IDOCS 76 100 ]