···11-diff --git a/3rdparty/stout/include/Makefile.am b/3rdparty/stout/include/Makefile.am
22-index 1f2ee85..b0b08d8 100644
33---- a/3rdparty/stout/include/Makefile.am
44-+++ b/3rdparty/stout/include/Makefile.am
55-@@ -64,7 +64,6 @@ nobase_include_HEADERS = \
66- stout/os/chroot.hpp \
77- stout/os/close.hpp \
88- stout/os/constants.hpp \
99-- stout/os/direntsize.hpp \
1010- stout/os/environment.hpp \
1111- stout/os/exists.hpp \
1212- stout/os/fcntl.hpp \
1313-@@ -108,7 +107,6 @@ nobase_include_HEADERS = \
1414- stout/os/posix/chown.hpp \
1515- stout/os/posix/chroot.hpp \
1616- stout/os/posix/close.hpp \
1717-- stout/os/posix/direntsize.hpp \
1818- stout/os/posix/exists.hpp \
1919- stout/os/posix/fcntl.hpp \
2020- stout/os/posix/fork.hpp \
2121-@@ -134,7 +132,6 @@ nobase_include_HEADERS = \
2222- stout/os/windows/bootid.hpp \
2323- stout/os/windows/chroot.hpp \
2424- stout/os/windows/close.hpp \
2525-- stout/os/windows/direntsize.hpp \
2626- stout/os/windows/exists.hpp \
2727- stout/os/windows/fcntl.hpp \
2828- stout/os/windows/fork.hpp \
2929-diff --git a/3rdparty/stout/include/stout/os/direntsize.hpp b/3rdparty/stout/include/stout/os/direntsize.hpp
3030-deleted file mode 100644
3131-index 819f99a..0000000
3232---- a/3rdparty/stout/include/stout/os/direntsize.hpp
3333-+++ /dev/null
3434-@@ -1,26 +0,0 @@
3535--// Licensed under the Apache License, Version 2.0 (the "License");
3636--// you may not use this file except in compliance with the License.
3737--// You may obtain a copy of the License at
3838--//
3939--// http://www.apache.org/licenses/LICENSE-2.0
4040--//
4141--// Unless required by applicable law or agreed to in writing, software
4242--// distributed under the License is distributed on an "AS IS" BASIS,
4343--// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4444--// See the License for the specific language governing permissions and
4545--// limitations under the License.
4646--
4747--#ifndef __STOUT_OS_DIRENTSIZE_HPP__
4848--#define __STOUT_OS_DIRENTSIZE_HPP__
4949--
5050--
5151--// For readability, we minimize the number of #ifdef blocks in the code by
5252--// splitting platform specifc system calls into separate directories.
5353--#ifdef __WINDOWS__
5454--#include <stout/os/windows/direntsize.hpp>
5555--#else
5656--#include <stout/os/posix/direntsize.hpp>
5757--#endif // __WINDOWS__
5858--
5959--
6060--#endif // __STOUT_OS_DIRENTSIZE_HPP__
6161-diff --git a/3rdparty/stout/include/stout/os/posix/direntsize.hpp b/3rdparty/stout/include/stout/os/posix/direntsize.hpp
6262-deleted file mode 100644
6363-index 9d8f72e..0000000
6464---- a/3rdparty/stout/include/stout/os/posix/direntsize.hpp
6565-+++ /dev/null
6666-@@ -1,42 +0,0 @@
6767--// Licensed under the Apache License, Version 2.0 (the "License");
6868--// you may not use this file except in compliance with the License.
6969--// You may obtain a copy of the License at
7070--//
7171--// http://www.apache.org/licenses/LICENSE-2.0
7272--//
7373--// Unless required by applicable law or agreed to in writing, software
7474--// distributed under the License is distributed on an "AS IS" BASIS,
7575--// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7676--// See the License for the specific language governing permissions and
7777--// limitations under the License.
7878--
7979--#ifndef __STOUT_OS_POSIX_DIRENTSIZE_HPP__
8080--#define __STOUT_OS_POSIX_DIRENTSIZE_HPP__
8181--
8282--#include <dirent.h>
8383--#include <unistd.h>
8484--
8585--
8686--namespace os {
8787--
8888--inline size_t dirent_size(DIR* dir)
8989--{
9090-- // Calculate the size for a "directory entry".
9191-- long name_max = fpathconf(dirfd(dir), _PC_NAME_MAX);
9292--
9393-- // If we don't get a valid size, check NAME_MAX, but fall back on
9494-- // 255 in the worst case ... Danger, Will Robinson!
9595-- if (name_max == -1) {
9696-- name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
9797-- }
9898--
9999-- size_t name_end = (size_t) offsetof(dirent, d_name) + name_max + 1;
100100--
101101-- size_t size = (name_end > sizeof(dirent) ? name_end : sizeof(dirent));
102102--
103103-- return size;
104104--}
105105--
106106--} // namespace os {
107107--
108108--#endif // __STOUT_OS_POSIX_DIRENTSIZE_HPP__
109109-diff --git a/3rdparty/stout/include/stout/os/windows/direntsize.hpp b/3rdparty/stout/include/stout/os/windows/direntsize.hpp
110110-deleted file mode 100644
111111-index 7c8c7a0..0000000
112112---- a/3rdparty/stout/include/stout/os/windows/direntsize.hpp
113113-+++ /dev/null
114114-@@ -1,43 +0,0 @@
115115--// Licensed under the Apache License, Version 2.0 (the "License");
116116--// you may not use this file except in compliance with the License.
117117--// You may obtain a copy of the License at
118118--//
119119--// http://www.apache.org/licenses/LICENSE-2.0
120120--//
121121--// Unless required by applicable law or agreed to in writing, software
122122--// distributed under the License is distributed on an "AS IS" BASIS,
123123--// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124124--// See the License for the specific language governing permissions and
125125--// limitations under the License.
126126--
127127--#ifndef __STOUT_OS_WINDOWS_DIRENTSIZE_HPP__
128128--#define __STOUT_OS_WINDOWS_DIRENTSIZE_HPP__
129129--
130130--#include <stout/internal/windows/dirent.hpp>
131131--
132132--#include <stout/windows.hpp>
133133--
134134--
135135--namespace os {
136136--
137137--inline size_t dirent_size(DIR* dir)
138138--{
139139-- // NOTE: Size calculation logic here is much simpler than on POSIX because
140140-- // our implementation of `dirent` is constant-sized. In particular, on POSIX,
141141-- // we usually have to calculate the maximum name size for a path before we
142142-- // can alloc a correctly-size `dirent`, but on Windows, `dirent.d_name` is
143143-- // always `MAX_PATH` bytes in size.
144144-- //
145145-- // This follows closely from the Windows standard API data structures for
146146-- // manipulating and querying directories. For example, the structures
147147-- // `WIN32_FIND_DATA`[1] (which in many ways is the Windows equivalent of
148148-- // `dirent`) has a field `cFileName` (which is much like `d_name`) that is
149149-- // also `MAX_PATH` in size.
150150-- //
151151-- // [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365740(v=vs.85).aspx
152152-- return sizeof(dirent);
153153--}
154154--
155155--} // namespace os {
156156--
157157--#endif // __STOUT_OS_WINDOWS_DIRENTSIZE_HPP__
···11-{ stdenv, version, src
11+{ stdenv, lib, version, src
22, autoreconfHook, zlib, gtest
33, ...
44}:
···2020 outputs = [ "out" "lib" ];
21212222 buildInputs = [ autoreconfHook zlib ];
2323+2424+ # The generated C++ code uses static initializers which mutate a global data
2525+ # structure. This causes problems for an executable when:
2626+ #
2727+ # 1) it dynamically links to two libs, both of which contain generated C++ for
2828+ # the same proto file, and
2929+ # 2) the two aforementioned libs both dynamically link to libprotobuf.
3030+ #
3131+ # One solution is to statically link libprotobuf, that way the global
3232+ # variables are not shared; in fact, this is necessary for the python Mesos
3333+ # binding to not crash, as the python lib contains two C extensions which
3434+ # both refer to the same proto schema.
3535+ #
3636+ # See: https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
3737+ # https://github.com/google/protobuf/issues/1489
3838+ dontDisableStatic = true;
3939+ configureFlags = [
4040+ "CFLAGS=-fPIC"
4141+ "CXXFLAGS=-fPIC"
4242+ ];
23432444 doCheck = true;
2545
+20-3
pkgs/top-level/python-packages.nix
···1914619146 '';
19147191471914819148 preConfigure = optionalString (versionAtLeast protobuf.version "2.6.0") ''
1914919149- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
1915019150- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
1914919149+ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
1915019150+ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2
1915119151 '';
19152191521915319153- checkPhase = if versionAtLeast protobuf.version "2.6.0" then ''
1915319153+ preBuild = optionalString (versionAtLeast protobuf.version "2.6.0") ''
1915419154+ ${python}/bin/${python.executable} setup.py build_ext --cpp_implementation
1915519155+ '';
1915619156+1915719157+ checkPhase = ''
1915819158+ runHook preCheck
1915919159+ '' + (if versionAtLeast protobuf.version "2.6.0" then ''
1915419160 ${python.executable} setup.py google_test --cpp_implementation
1916119161+ echo "sanity checking the C extension . . ."
1916219162+ echo "import google.protobuf.descriptor" | ${python.executable}
1915519163 '' else ''
1915619164 ${python.executable} setup.py test
1916519165+ '') + ''
1916619166+ runHook postCheck
1915719167 '';
19158191681915919169 installFlags = optional (versionAtLeast protobuf.version "2.6.0") "--install-option='--cpp_implementation'";
1917019170+1917119171+ # the _message.so isn't installed, so we'll do that manually.
1917219172+ # if someone can figure out a less hacky way to get the _message.so to
1917319173+ # install, please do replace this.
1917419174+ postInstall = optionalString (versionAtLeast protobuf.version "2.6.0") ''
1917519175+ cp -v $(find build -name "_message*") $out/${python.sitePackages}/google/protobuf/pyext
1917619176+ '';
19160191771916119178 doCheck = true;
1916219179