9bc9014b7284df08e0b0ab7352cd98d36997e979
[vlc.git] / contrib / src / pthreads / rules.mak
1 # POSIX threads
2
3 ifndef HAVE_WIN32
4 PKGS_FOUND += pthreads
5 endif
6
7 PTHREADS_W32_VERSION := 2-9-1
8 PTHREADS_W32_URL := ftp://sources.redhat.com/pub/pthreads-win32/pthreads-w32-$(PTHREADS_W32_VERSION)-release.tar.gz
9
10 $(TARBALLS)/pthreads-w32-$(PTHREADS_W32_VERSION)-release.tar.gz:
11         $(call download_pkg,$(PTHREADS_W32_URL),pthreads)
12
13 .sum-pthreads: pthreads-w32-$(PTHREADS_W32_VERSION)-release.tar.gz
14
15 ifdef HAVE_WIN32
16 pthreads: pthreads-w32-$(PTHREADS_W32_VERSION)-release.tar.gz .sum-pthreads
17         $(UNPACK)
18         sed -e 's/^CROSS.*=/CROSS ?=/' -i.orig $(UNPACK_DIR)/GNUmakefile
19 ifdef HAVE_WINSTORE
20         $(APPLY) $(SRC)/pthreads/winrt.patch
21 endif
22         $(APPLY) $(SRC)/pthreads/implib.patch
23         $(APPLY) $(SRC)/pthreads/remove-inline.patch
24         $(APPLY) $(SRC)/pthreads/x86-inline-asm.patch
25         $(MOVE)
26
27 ifdef HAVE_CROSS_COMPILE
28 PTHREADS_W32_CONF := CROSS="$(HOST)-"
29 endif
30
31 .pthreads: pthreads
32         cd $< && $(HOSTVARS) $(PTHREADS_W32_CONF) $(MAKE) MAKEFLAGS=-j1 GC GC-static
33         mkdir -p -- "$(PREFIX)/include"
34         cd $< && cp -v pthread.h sched.h semaphore.h "$(PREFIX)/include/"
35         sed -e 's/#if HAVE_CONFIG_H/#if 0 \&\& HAVE_CONFIG_H/' -i \
36                 "$(PREFIX)/include/pthread.h"
37         mkdir -p -- "$(PREFIX)/lib"
38         cp -v $</*.a $</*.dll "$(PREFIX)/lib/"
39         touch $@
40 endif