contrib: pthreads: Use the right CONTEXT field on arm64
[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         $(APPLY) $(SRC)/pthreads/arm64.patch
26         $(MOVE)
27
28 ifdef HAVE_CROSS_COMPILE
29 PTHREADS_W32_CONF := CROSS="$(HOST)-"
30 endif
31
32 .pthreads: pthreads
33         cd $< && $(HOSTVARS) $(PTHREADS_W32_CONF) $(MAKE) MAKEFLAGS=-j1 GC GC-static
34         mkdir -p -- "$(PREFIX)/include"
35         cd $< && cp -v pthread.h sched.h semaphore.h "$(PREFIX)/include/"
36         sed -e 's/#if HAVE_CONFIG_H/#if 0 \&\& HAVE_CONFIG_H/' -i \
37                 "$(PREFIX)/include/pthread.h"
38         mkdir -p -- "$(PREFIX)/lib"
39         cp -v $</*.a $</*.dll "$(PREFIX)/lib/"
40         touch $@
41 endif