diff --git a/config/ext.json b/config/ext.json index b52076c2..fe75c790 100644 --- a/config/ext.json +++ b/config/ext.json @@ -190,7 +190,10 @@ "parallel": { "type": "external", "source": "parallel", - "arg-type-windows": "with" + "arg-type-windows": "with", + "lib-depends-windows": [ + "pthreads4w" + ] }, "ldap": { "type": "builtin", diff --git a/config/lib.json b/config/lib.json index b7a92d04..82f4cf91 100644 --- a/config/lib.json +++ b/config/lib.json @@ -125,6 +125,12 @@ "gmp.h" ] }, + "pthreads4w": { + "source": "pthreads4w", + "static-libs-windows": [ + "libpthreadVC3.lib" + ] + }, "icu": { "source": "icu", "cpp-library": true, diff --git a/config/source.json b/config/source.json index 595389bc..d704d3f6 100644 --- a/config/source.json +++ b/config/source.json @@ -52,6 +52,15 @@ "path": "COPYING" } }, + "pthreads4w": { + "type": "git", + "rev": "master", + "url": "https://git.code.sf.net/p/pthreads4w/code", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "ext-ds": { "type": "url", "url": "https://pecl.php.net/get/ds", diff --git a/src/SPC/builder/windows/library/pthreads4w.php b/src/SPC/builder/windows/library/pthreads4w.php new file mode 100644 index 00000000..66707cbb --- /dev/null +++ b/src/SPC/builder/windows/library/pthreads4w.php @@ -0,0 +1,29 @@ +cd($this->source_dir) + ->execWithWrapper( + $this->builder->makeSimpleWrapper( + 'nmake /E /nologo /f Makefile ' . + 'DESTROOT=' . BUILD_ROOT_PATH . ' ' . + 'XCFLAGS="/MT" ' . // no dll + 'EHFLAGS="/I. /DHAVE_CONFIG_H /Os /Ob2 /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED"' + ), + 'pthreadVC3.inlined_static_stamp' + ); + copy($this->source_dir . '\libpthreadVC3.lib', BUILD_LIB_PATH . '\libpthreadVC3.lib'); + copy($this->source_dir . '\_ptw32.h', BUILD_INCLUDE_PATH . '\_ptw32.h'); + copy($this->source_dir . '\pthread.h', BUILD_INCLUDE_PATH . '\pthread.h'); + copy($this->source_dir . '\sched.h', BUILD_INCLUDE_PATH . '\sched.h'); + copy($this->source_dir . '\semaphore.h', BUILD_INCLUDE_PATH . '\semaphore.h'); + } +}