about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-14T00·49+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-14T00·49+0100
commit8bdff8c1003501bab0dbc63ed6c391ff2f2da4b5 (patch)
treed36f30676cb75b3146959f06e2565a12bf12633b
parent14955c297de82e964ea5bf44f8aaf543d4cae33a (diff)
parentf665c5d9b368cba0ca153323a805844f179e8bee (diff)
Merge branch 'cygwin-master' of https://github.com/ternaris/nix
-rw-r--r--mk/lib.mk9
-rw-r--r--mk/libraries.mk16
-rw-r--r--perl/local.mk6
-rw-r--r--src/download-via-ssh/download-via-ssh.cc1
-rw-r--r--src/libmain/shared.cc1
-rw-r--r--src/libstore/optimise-store.cc1
-rw-r--r--src/libstore/remote-store.cc1
-rw-r--r--src/libutil/monitor-fd.hh1
8 files changed, 31 insertions, 5 deletions
diff --git a/mk/lib.mk b/mk/lib.mk
index ba1fb3a2a989..4ad5c636c8d4 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -52,8 +52,13 @@ endif
 BUILD_SHARED_LIBS ?= 1
 
 ifeq ($(BUILD_SHARED_LIBS), 1)
-  GLOBAL_CFLAGS += -fPIC
-  GLOBAL_CXXFLAGS += -fPIC
+  ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+    GLOBAL_CFLAGS += -U__STRICT_ANSI__
+    GLOBAL_CXXFLAGS += -U__STRICT_ANSI__
+  else
+    GLOBAL_CFLAGS += -fPIC
+    GLOBAL_CXXFLAGS += -fPIC
+  endif
   ifneq ($(OS), Darwin)
    ifneq ($(OS), SunOS)
     GLOBAL_LDFLAGS += -Wl,--no-copy-dt-needed-entries
diff --git a/mk/libraries.mk b/mk/libraries.mk
index 766f7ccf70f7..3cd7a53107bd 100644
--- a/mk/libraries.mk
+++ b/mk/libraries.mk
@@ -3,7 +3,11 @@ libs-list :=
 ifeq ($(OS), Darwin)
   SO_EXT = dylib
 else
-  SO_EXT = so
+  ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+    SO_EXT = dll
+  else
+    SO_EXT = so
+  endif
 endif
 
 # Build a library with symbolic name $(1).  The library is defined by
@@ -50,7 +54,11 @@ define build-library
   $(1)_OBJS := $$(addprefix $(buildprefix), $$(addsuffix .o, $$(basename $$(_srcs))))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
 
-  $(1)_INSTALL_DIR ?= $$(libdir)
+  ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+    $(1)_INSTALL_DIR ?= $$(bindir)
+  else
+    $(1)_INSTALL_DIR ?= $$(libdir)
+  endif
 
   $(1)_LDFLAGS_USE :=
   $(1)_LDFLAGS_USE_INSTALLED :=
@@ -65,7 +73,9 @@ define build-library
       endif
     else
       ifneq ($(OS), Darwin)
-        $(1)_LDFLAGS += -Wl,-z,defs
+        ifneq (CYGWIN,$(findstring CYGWIN,$(OS)))
+          $(1)_LDFLAGS += -Wl,-z,defs
+        endif
       endif
     endif
 
diff --git a/perl/local.mk b/perl/local.mk
index 8ff60e9ce3c7..73d8a7c9526b 100644
--- a/perl/local.mk
+++ b/perl/local.mk
@@ -29,6 +29,12 @@ ifeq ($(perlbindings), yes)
     -I$(shell $(perl) -e 'use Config; print $$Config{archlibexp};')/CORE \
     -D_FILE_OFFSET_BITS=64 -Wno-unused-variable -Wno-literal-suffix -Wno-reserved-user-defined-literal
 
+  ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+    archlib = $(shell perl -E 'use Config; print $$Config{archlib};')
+    libperl = $(shell perl -E 'use Config; print $$Config{libperl};')
+    Store_LDFLAGS = $(shell find ${archlib} -name ${libperl})
+  endif
+
   Store_ALLOW_UNDEFINED = 1
 
   Store_FORCE_INSTALL = 1
diff --git a/src/download-via-ssh/download-via-ssh.cc b/src/download-via-ssh/download-via-ssh.cc
index b64455eb1724..164c24b49e26 100644
--- a/src/download-via-ssh/download-via-ssh.cc
+++ b/src/download-via-ssh/download-via-ssh.cc
@@ -9,6 +9,7 @@
 #include "store-api.hh"
 
 #include <iostream>
+#include <stdlib.h>
 #include <unistd.h>
 
 using namespace nix;
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 7b50bfa9bb32..9c74a614e2e4 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -11,6 +11,7 @@
 #include <exception>
 #include <algorithm>
 
+#include <stdlib.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index dd18d66fa008..fb5607676510 100644
--- a/src/libstore/optimise-store.cc
+++ b/src/libstore/optimise-store.cc
@@ -4,6 +4,7 @@
 #include "local-store.hh"
 #include "globals.hh"
 
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index acc895409eba..d08913246321 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -10,6 +10,7 @@
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/un.h>
+#include <errno.h>
 #include <fcntl.h>
 
 #include <iostream>
diff --git a/src/libutil/monitor-fd.hh b/src/libutil/monitor-fd.hh
index 72d23fb6934c..e99869effe1a 100644
--- a/src/libutil/monitor-fd.hh
+++ b/src/libutil/monitor-fd.hh
@@ -3,6 +3,7 @@
 #include <thread>
 #include <atomic>
 
+#include <stdlib.h>
 #include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>