-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
[WIP] Esy-enabled Windows Build #44
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Cross-platform set of build steps for building esy projects | ||
|
||
steps: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: '8.9' | ||
- script: npm install -g esy@0.6.2 | ||
displayName: 'npm install -g esy@0.6.2' | ||
- script: esy install | ||
displayName: 'esy install' | ||
- script: esy build | ||
displayName: 'esy build' | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
steps: | ||
- task: NodeTool@0 | ||
displayName: 'Use Node 8.x' | ||
inputs: | ||
versionSpec: 8.x |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Starter pipeline | ||
# Start with a minimal pipeline that you can customize to build and deploy your code. | ||
# Add steps that build, run tests, deploy, and more: | ||
# https://aka.ms/yaml | ||
|
||
name: $(Build.SourceVersion) | ||
jobs: | ||
- job: Linux | ||
timeoutInMinutes: 0 | ||
pool: | ||
vmImage: 'Ubuntu 16.04' | ||
|
||
variables: | ||
STAGING_DIRECTORY: $(Build.StagingDirectory) | ||
ESY__CACHE_INSTALL_PATH: /home/vsts/.esy/3_____________________________________________________________________/i | ||
ESY__CACHE_SOURCE_TARBALL_PATH: /home/vsts/.esy/source/i | ||
# ESY__NPM_ROOT: /opt/hostedtoolcache/node/8.14.0/x64/lib/node_modules/esy | ||
|
||
steps: | ||
- script: sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-utils mesa-utils-extra ragel xvfb | ||
- template: .ci/use-node.yml | ||
- template: .ci/esy-build-steps.yml | ||
|
||
- job: MacOS | ||
timeoutInMinutes: 0 | ||
pool: | ||
vmImage: 'macOS 10.13' | ||
|
||
variables: | ||
STAGING_DIRECTORY: $(Build.StagingDirectory) | ||
ESY__CACHE_INSTALL_PATH: /Users/runner/.esy/3__________________________________________________________________/i | ||
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/runner/.esy/source/i | ||
# ESY__NPM_ROOT: /usr/local/lib/node_modules/esy | ||
|
||
steps: | ||
- script: brew update | ||
- script: brew install libtool libpng | ||
- template: .ci/use-node.yml | ||
- template: .ci/esy-build-steps.yml | ||
|
||
- job: Windows | ||
timeoutInMinutes: 0 | ||
pool: | ||
vmImage: 'vs2017-win2016' | ||
|
||
variables: | ||
STAGING_DIRECTORY: $(Build.StagingDirectory) | ||
ESY__CACHE_INSTALL_PATH: /C/Users/VssAdministrator/.esy/3_/i | ||
ESY__CACHE_SOURCE_TARBALL_PATH: /C/Users/VssAdministrator/.esy/source/i | ||
# ESY__NPM_ROOT: /C/npm/prefix/node_modules/esy | ||
|
||
steps: | ||
- template: .ci/use-node.yml | ||
- template: .ci/esy-build-steps.yml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "luv", | ||
"version": "1.0.0", | ||
"description": "libuv bindings for OCaml", | ||
"license": "MIT", | ||
"scripts": { | ||
}, | ||
"esy": { | ||
"build": [ | ||
[ | ||
"dune", | ||
"build", | ||
"-p", | ||
"luv", | ||
"-j", | ||
"4" | ||
] | ||
], | ||
"install": [ | ||
"esy-installer luv.install" | ||
] | ||
}, | ||
"dependencies": { | ||
"@opam/dune": "^2.0.0", | ||
"@opam/dune-configurator": "^2.0.0", | ||
"ocaml": ">=4.2.0", | ||
"@opam/ctypes": "0.15.1", | ||
"@opam/ctypes-foreign": "0.4.0", | ||
"esy-libuv": "github:revery-ui/esy-libuv#89d293b" | ||
}, | ||
"resolutions": { | ||
"@esy-ocaml/libffi": "esy-ocaml/libffi#c61127d", | ||
"esy-cmake": "prometheansacrifice/esy-cmake#2a47392def" | ||
}, | ||
"devDependencies": { | ||
"ocaml": "~4.8.0", | ||
"@opam/alcotest": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
type os = | ||
| Windows | ||
| Mac | ||
| Linux | ||
| Unknown | ||
|
||
let uname () = | ||
let ic = Unix.open_process_in "uname" in | ||
let uname = input_line ic in | ||
let () = close_in ic in | ||
uname;; | ||
|
||
let get_os = | ||
match Sys.os_type with | ||
| "Win32" -> Windows | ||
| _ -> match uname () with | ||
| "Darwin" -> Mac | ||
| "Linux" -> Linux | ||
| _ -> Unknown | ||
|
||
let libPath = "-L" ^ (Sys.getenv "LIBUV_LIB_PATH") | ||
|
||
let ccopt s = ["-ccopt"; s] | ||
let cclib s = ["-cclib"; s] | ||
|
||
let c_flags = ["-I"; (Sys.getenv "LIBUV_INCLUDE_PATH");] | ||
|
||
let c_flags = match get_os with | ||
| Linux -> c_flags @ ["-fPIC"] | ||
| _ -> c_flags | ||
;; | ||
|
||
let flags = | ||
[] | ||
@ ccopt(libPath) | ||
@ cclib("-luv") | ||
;; | ||
|
||
Configurator.V1.Flags.write_sexp "c_flags.sexp" c_flags; | ||
Configurator.V1.Flags.write_sexp "flags.sexp" flags; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(executable | ||
(name discover) | ||
(libraries dune.configurator)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,14 @@ | |
|
||
|
||
let () = | ||
|
||
(* Include headers necessary for Windows *) | ||
if Sys.win32 then | ||
(* Setting a WINVER to Vista+ is necessary to get types like AI_ADDRCONFIG *) | ||
(print_endline "#define WINVER 0x0600"; | ||
print_endline "#define _WIN32_WINNT 0x0600"; | ||
print_endline "#include <ws2tcpip.h>"); | ||
|
||
Comment on lines
+9
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There were some headers we need to pull in to get some APIs (like |
||
print_endline "#include <memory.h>"; | ||
print_endline "#include <caml/mlvalues.h>"; | ||
print_endline "#include <caml/socketaddr.h>"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,9 @@ struct | |
module Option = | ||
struct | ||
let block_signal = constant "UV_LOOP_BLOCK_SIGNAL" int | ||
let sigprof = constant "SIGPROF" int | ||
let sigprof = match Sys.win32 with | ||
| false -> constant "SIGPROF" int | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure the best way to handle this, but |
||
| true -> constant "0" int | ||
end | ||
|
||
type t = [ `Loop ] structure | ||
|
@@ -398,9 +400,9 @@ struct | |
let iwoth = constant "S_IWOTH" int | ||
let ixoth = constant "S_IXOTH" int | ||
|
||
let isuid = constant "S_ISUID" int | ||
(*let isuid = constant "S_ISUID" int | ||
let isgid = constant "S_ISGID" int | ||
let isvtx = constant "S_ISVTX" int | ||
let isvtx = constant "S_ISVTX" int*) | ||
end | ||
|
||
module Dirent = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,9 +121,11 @@ struct | |
| `IWOTH | ||
| `IXOTH | ||
|
||
(* TODO: Not supported on Windows | ||
| `ISUID | ||
| `ISGID | ||
| `ISVTX | ||
*) | ||
Comment on lines
+124
to
+128
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise - several of these file constants were not defined on Windows. |
||
|
||
| `NUMERIC of int | ||
] | ||
|
@@ -144,9 +146,9 @@ struct | |
| `IWOTH -> iwoth | ||
| `IXOTH -> ixoth | ||
|
||
| `ISUID -> isuid | ||
(*| `ISUID -> isuid | ||
| `ISGID -> isgid | ||
| `ISVTX -> isvtx | ||
| `ISVTX -> isvtx*) | ||
|
||
| `NUMERIC i -> i | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct that these steps are running in
cmd
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is correct that they are running in
cmd
- one of the main benefits of usingesy
, for me, is that I don't have to change how I work as a windows developer.The set of steps described in
esy-build-steps.yml
is the same for OSX, Linux, and Windows - it's really nice to have a consistent workflow across all platforms:esy
(npm install -g esy
)esy install
)esy build
)