Skip to content

Install needed folders for snapshot #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ yacc/*.[ch] ocaml-typo=long-line,very-long-line,unused-prop
*.precheck text eol=lf
*.runner text eol=lf

clone-flexdll text eol=lf
configure text eol=lf
configure-windows text eol=lf
esy-configure text eol=lf
esy-build text eol=lf
config/auto-aux/hasgot text eol=lf
config/auto-aux/hasgot2 text eol=lf
config/auto-aux/runtest text eol=lf
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

16 changes: 16 additions & 0 deletions clone-flexdll
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/sh

# clone-flexdll
#
# Brings in flexdll, if necessary

if [ -d "flexdll" ]; then
echo "[Flexdll] Already present, no need to clone."
else
echo "[Flexdll] Cloning..."
git clone https://github.com/esy-ocaml/flexdll.git
cd flexdll
git checkout f84baaeae463f96f9582883a9cfb7dd1096757ff
cd ..
echo "[Flexdll] Clone successful!"
fi
2 changes: 1 addition & 1 deletion config/Makefile.mingw64
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ BINDIR=$(PREFIX)/bin
BYTERUN=ocamlrun

### Where to install the standard library
LIBDIR=$(PREFIX)/lib
LIBDIR=$(PREFIX)/lib/ocaml

### Where to install the stub DLLs
STUBLIBDIR=$(LIBDIR)/stublibs
Expand Down
34 changes: 34 additions & 0 deletions configure-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! /bin/sh

# configure-windows
#
# Creates a native Windows MingW build, based on:
# https://github.com/ocaml/ocaml/blob/trunk/README.win32.adoc


export prefix=C:/ocamlmgw64
while : ; do
case "$1" in
"") break;;
-prefix|--prefix)
prefix=$2; shift;;
esac
shift
done

echo "[configure-windows] Prefix path: $prefix"

echo "[configure-windows] Copying architecture headers."
cp config/m-nt.h byterun/caml/m.h
cp config/s-nt.h byterun/caml/s.h

# TODO: Differentiate based on architecture - use 'Makefile.mingw' for 32-bit environments
echo "[configure-windows] Bringing over mingw64 Makefile."
cp config/Makefile.mingw64 config/Makefile

echo "[configure-windows] Replace prefix path with: $prefix."
sed -i "s#PREFIX=C:/ocamlmgw64#PREFIX=$prefix#g" config/Makefile

echo "[configure-windows] Setting up flexdll"
./clone-flexdll
make flexdll
24 changes: 24 additions & 0 deletions esy-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /bin/bash

# esy-build
#
# Wrapper to execute appropriate build strategy, based on platform

set -u
set -e
set -o pipefail

case "$(uname -s)" in
CYGWIN*|MINGW32*|MSYS*)
echo "[esy-build] Detected windows environment..."
make -j1 world.opt
make flexlink.opt
;;
*)
echo "[esy-build] Detected OSX / Linux environment"
make -j4 world.opt
;;
esac

# Common build steps
make install
29 changes: 29 additions & 0 deletions esy-configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#! /bin/bash

# esy-configure
#
# Wrapper to delegate to configuration to the
# appropriate `configure` strategy based on the active platform.
#
# Today, OCaml has separate build strategies:
# - Linux, OSX, Cygwin (gcc) - https://github.com/ocaml/ocaml/blob/trunk/INSTALL.adoc
# - Windows, Cygin (mingw) - https://github.com/ocaml/ocaml/blob/trunk/README.win32.adoc
#
# We want `esy` to work cross-platform, so this is a shim script that will delegate to the
# appropriate script depending on the platform. We assume that if the platform is `CYGWIN`
# that the `mingw` (native executable) strategy is desired.

set -u
set -e
set -o pipefail

case "$(uname -s)" in
CYGWIN*|MINGW32*|MSYS*)
echo "[esy-configure] Detected windows environment..."
./configure-windows "$@"
;;
*)
echo "[esy-configure] Detected OSX / Linux environment"
./configure "$@"
;;
esac
1 change: 0 additions & 1 deletion flexdll
Submodule flexdll deleted from 7f565e
49 changes: 44 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,50 @@
"description": "BuckleScript's OCaml Compiler as an npm Package",
"esy": {
"build": [
"./configure -no-cfi -prefix $cur__install",
"make -j world.opt"
],
"install": [
"make install"
"./esy-configure -no-cfi -prefix #{self.install}",
"./esy-build",
[
"cp",
"-r",
"-f",
"#{self.root / 'utils'}",
"#{self.install / 'utils'}"
],
[
"cp",
"-r",
"-f",
"#{self.root / 'parsing'}",
"#{self.install / 'parsing'}"
],
[
"cp",
"-r",
"-f",
"#{self.root / 'typing'}",
"#{self.install / 'typing'}"
],
[
"cp",
"-r",
"-f",
"#{self.root / 'bytecomp'}",
"#{self.install / 'bytecomp'}"
],
[
"cp",
"-r",
"-f",
"#{self.root / 'driver'}",
"#{self.install / 'driver'}"
],
[
"cp",
"-r",
"-f",
"#{self.root / 'tools'}",
"#{self.install / 'tools'}"
]
],
"buildsInSource": true,
"exportedEnv": {
Expand Down