Skip to content

Commit

Permalink
Add FreeBSD support
Browse files Browse the repository at this point in the history
Summary:
This set of changes makes it possible to compile `flow` on FreeBSD.

It does require `libinotify` to be install separately, but otherwise seems fine.  I'm not sure how to make the local `libinotify` a dependency through the `opam` build system.

Additionally, the current install instructions in `README.md` specify that `opam init --comp 4.03.0` is sufficient to change versions but on FreeBSD it is necessary to use `opam switch 4.03.0` since the `init` subcommand will not replace the system version (currently 4.02.3 on FreeBSD) which is automatically installed as a dependency of `opam`.
Closes facebook/flow#4433

Reviewed By: samwgoldman

Differential Revision: D5502390

Pulled By: gabelevi

fbshipit-source-id: 06c2310702c6f34980849776cdbe2fb72542baa1
  • Loading branch information
Parakleta authored and hhvm-bot committed Aug 2, 2017
1 parent 998a22c commit c959f9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 6 additions & 1 deletion hphp/hack/src/heap/hh_shared.c
Expand Up @@ -148,7 +148,7 @@
* with the MAP_ANONYMOUS flag. The memfd_create() system call first
* appeared in Linux 3.17.
****************************************************************************/
#if !defined __APPLE__ && !defined _WIN32
#ifdef __linux__
// Linux version for the architecture must support syscall memfd_create
#ifndef SYS_memfd_create
#if defined(__x86_64__)
Expand Down Expand Up @@ -176,6 +176,11 @@
}
#endif

#ifndef MAP_NORESERVE
// This flag was unimplemented in FreeBSD and then later removed
#define MAP_NORESERVE 0
#endif

// The following 'typedef' won't be required anymore
// when dropping support for OCaml < 4.03
#ifdef __MINGW64__
Expand Down
3 changes: 1 addition & 2 deletions hphp/hack/src/third-party/inotify/inotify_stubs.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2008 Vincent Hanquez <vincent@snarc.org>
* Copyright (C) 2006-2008 Vincent Hanquez <vincent@snarc.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand Down Expand Up @@ -28,7 +28,6 @@
#include <caml/callback.h>
#include <caml/unixsupport.h>

#include <features.h>
#include <sys/inotify.h>

static int inotify_flag_table[] = {
Expand Down
4 changes: 1 addition & 3 deletions hphp/hack/src/utils/sysinfo.c
Expand Up @@ -13,11 +13,9 @@
#include <caml/mlvalues.h>

#include <assert.h>
#ifndef _WIN32
#ifndef __APPLE__
#ifdef __linux__
#include <sys/sysinfo.h>
#endif
#endif

#ifdef _WIN32
#include <windows.h>
Expand Down

0 comments on commit c959f9b

Please sign in to comment.