From 629e8da3aa6da507bc360385f5f341471ef57a89 Mon Sep 17 00:00:00 2001 From: Marko Durkovic Date: Tue, 9 Dec 2014 12:16:27 +0100 Subject: [PATCH 1/4] Explicitly include required C headers --- src/download-via-ssh/download-via-ssh.cc | 1 + src/libmain/shared.cc | 1 + src/libstore/optimise-store.cc | 1 + src/libstore/remote-store.cc | 1 + src/libutil/monitor-fd.hh | 1 + 5 files changed, 5 insertions(+) diff --git a/src/download-via-ssh/download-via-ssh.cc b/src/download-via-ssh/download-via-ssh.cc index b64455eb1..164c24b49 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 +#include #include using namespace nix; diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index ef4ea3706..bf5688a1e 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -11,6 +11,7 @@ #include #include +#include #include #include #include diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index dd18d66fa..fb5607676 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 #include #include #include diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 650f17798..cabde051b 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/src/libutil/monitor-fd.hh b/src/libutil/monitor-fd.hh index 72d23fb69..e99869eff 100644 --- a/src/libutil/monitor-fd.hh +++ b/src/libutil/monitor-fd.hh @@ -3,6 +3,7 @@ #include #include +#include #include #include #include From 936f68668c191ca6f904dd868fe364aeba1d531f Mon Sep 17 00:00:00 2001 From: Marko Durkovic Date: Tue, 9 Dec 2014 12:20:27 +0100 Subject: [PATCH 2/4] Set custom compiler flags on Cygwin --- mk/lib.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mk/lib.mk b/mk/lib.mk index 56e162d50..f7c8c6b3a 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -29,8 +29,13 @@ mandir ?= $(prefix)/share/man 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 From 4872677ffafce60bf863583804bb5700601ad7a4 Mon Sep 17 00:00:00 2001 From: Marko Durkovic Date: Tue, 9 Dec 2014 12:22:12 +0100 Subject: [PATCH 3/4] Fix library handling on Cygwin 1. Shared lib extension is .dll 2. Shared libs are installed to $(prefix)/bin 3. Linker does not support -z flag --- mk/libraries.mk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mk/libraries.mk b/mk/libraries.mk index 3b91c699e..3b292e988 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 := $$(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 From f665c5d9b368cba0ca153323a805844f179e8bee Mon Sep 17 00:00:00 2001 From: Marko Durkovic Date: Tue, 9 Dec 2014 12:25:25 +0100 Subject: [PATCH 4/4] Link against perl.dll on Cygwin --- perl/local.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/perl/local.mk b/perl/local.mk index 8ff60e9ce..73d8a7c95 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