From 05380b49b7337df2eb11f834a8a9b01b0ab1cbe7 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Tue, 27 Oct 2015 13:58:22 +1100 Subject: gcc pthreads: build pthreads and mingw-w64 headers inline and enable libgomp * fixes "~winpthreads changes ~pthread_signal.h" etc. reported by build-pkg mingw-w64 installs dummy headers if winpthreads isn't built * enables libgomp to avoid double-build (see #331) * no change in openmp-validation (still 20 failures - taken with a grain of salt as the batch file test runner isn't a reliable perl substitute) * pthreads virtual package kept for future testing --- index.html | 8 -------- src/flann.mk | 2 +- src/gcc.mk | 20 ++++++++++++++++++-- src/graphicsmagick.mk | 2 +- src/jack.mk | 2 +- src/libgomp-test.c | 21 --------------------- src/libgomp.mk | 41 ----------------------------------------- src/mingw-w64.mk | 13 ------------- src/openblas.mk | 2 +- src/openmp-validation.mk | 2 +- src/pcl.mk | 2 +- src/primesieve.mk | 2 +- src/pthreads-libgomp-test.c | 21 +++++++++++++++++++++ src/pthreads-test.cmake | 18 ++++++++++++++++++ src/pthreads.mk | 12 +++++++++--- src/sox.mk | 4 ++-- src/winpthreads-test.cmake | 18 ------------------ src/winpthreads.mk | 26 -------------------------- 18 files changed, 75 insertions(+), 141 deletions(-) delete mode 100644 src/libgomp-test.c delete mode 100644 src/libgomp.mk create mode 100644 src/pthreads-libgomp-test.c create mode 100644 src/pthreads-test.cmake delete mode 100644 src/winpthreads-test.cmake delete mode 100644 src/winpthreads.mk diff --git a/index.html b/index.html index f6a3f0c..f63d6d5 100644 --- a/index.html +++ b/index.html @@ -1643,10 +1643,6 @@ local-pkg-list: $(LOCAL_PKG_LIST) libgnurx - libgomp - GCC-libgomp - - libgpg_error libgpg-error @@ -2511,10 +2507,6 @@ local-pkg-list: $(LOCAL_PKG_LIST) WinPcap - winpthreads - MinGW w64 pthreads - - wt Wt diff --git a/src/flann.mk b/src/flann.mk index 97b5220..1bc5dd7 100644 --- a/src/flann.mk +++ b/src/flann.mk @@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := dfbb9321b0d687626a644c70872a2c540b16200e7f4c7bd72f91ae032f445 $(PKG)_SUBDIR := flann-$($(PKG)_VERSION)-src $(PKG)_FILE := flann-$($(PKG)_VERSION)-src.zip $(PKG)_URL := http://www.cs.ubc.ca/research/flann/uploads/FLANN/$($(PKG)_FILE) -$(PKG)_DEPS := gcc libgomp +$(PKG)_DEPS := gcc define $(PKG)_UPDATE $(WGET) -q -O- 'http://www.cs.ubc.ca/research/flann/index.php/FLANN/Changelog' | \ diff --git a/src/gcc.mk b/src/gcc.mk index 64a90a0..37976c3 100644 --- a/src/gcc.mk +++ b/src/gcc.mk @@ -39,7 +39,7 @@ define $(PKG)_CONFIGURE --without-x \ --disable-win32-registry \ --enable-threads=win32 \ - --disable-libgomp \ + --enable-libgomp \ --with-gmp='$(PREFIX)/$(BUILD)' \ --with-isl='$(PREFIX)/$(BUILD)' \ --with-mpc='$(PREFIX)/$(BUILD)' \ @@ -63,13 +63,22 @@ define $(PKG)_POST_BUILD endef define $(PKG)_BUILD_mingw-w64 + # install mingw-w64 headers + $(call PREPARE_PKG_SOURCE,mingw-w64,$(1)) + mkdir '$(1).headers-build' + cd '$(1).headers-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-headers/configure' \ + --host='$(TARGET)' \ + --prefix='$(PREFIX)/$(TARGET)' \ + --enable-sdk=all \ + --enable-idl + $(MAKE) -C '$(1).headers-build' install + # build standalone gcc $($(PKG)_CONFIGURE) $(MAKE) -C '$(1).build' -j '$(JOBS)' all-gcc $(MAKE) -C '$(1).build' -j 1 install-gcc # build mingw-w64-crt - cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,mingw-w64) mkdir '$(1).crt-build' cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \ --host='$(TARGET)' \ @@ -78,6 +87,13 @@ define $(PKG)_BUILD_mingw-w64 $(MAKE) -C '$(1).crt-build' -j '$(JOBS)' || $(MAKE) -C '$(1).crt-build' -j '$(JOBS)' $(MAKE) -C '$(1).crt-build' -j 1 install + # build posix threads + mkdir '$(1).pthread-build' + cd '$(1).pthread-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-libraries/winpthreads/configure' \ + $(MXE_CONFIGURE_OPTS) + $(MAKE) -C '$(1).pthread-build' -j '$(JOBS)' || $(MAKE) -C '$(1).pthread-build' -j '$(JOBS)' + $(MAKE) -C '$(1).pthread-build' -j 1 install + # build rest of gcc cd '$(1).build' $(MAKE) -C '$(1).build' -j '$(JOBS)' diff --git a/src/graphicsmagick.mk b/src/graphicsmagick.mk index 6e66688..30c4c0e 100644 --- a/src/graphicsmagick.mk +++ b/src/graphicsmagick.mk @@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := 9045304d991776b6a37e1b45b9b6ef152593ada0d49bc744263565617cbf3 $(PKG)_SUBDIR := GraphicsMagick-$($(PKG)_VERSION) $(PKG)_FILE := GraphicsMagick-$($(PKG)_VERSION).tar.xz $(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/$(PKG)/$(PKG)/$($(PKG)_VERSION)/$($(PKG)_FILE) -$(PKG)_DEPS := gcc bzip2 freetype jasper jpeg lcms libgomp libltdl libpng libxml2 pthreads tiff zlib +$(PKG)_DEPS := gcc bzip2 freetype jasper jpeg lcms libltdl libpng libxml2 pthreads tiff zlib define $(PKG)_UPDATE $(WGET) -q -O- 'http://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/' | \ diff --git a/src/jack.mk b/src/jack.mk index 9c1dd6b..b13afa9 100644 --- a/src/jack.mk +++ b/src/jack.mk @@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := 5bc6336e6ac9799e3cb241915e2ba5d01b030589bbb2afae39579a59ef0f2 $(PKG)_SUBDIR := jack-$($(PKG)_VERSION) $(PKG)_FILE := jack-$($(PKG)_VERSION).tar.bz2 $(PKG)_URL := https://dl.dropboxusercontent.com/u/28869550/$($(PKG)_FILE) -$(PKG)_DEPS := gcc libgnurx libsamplerate libsndfile portaudio readline winpthreads +$(PKG)_DEPS := gcc libgnurx libsamplerate libsndfile portaudio pthreads readline define $(PKG)_UPDATE $(WGET) -q -O- 'http://jackaudio.org/downloads/' | \ diff --git a/src/libgomp-test.c b/src/libgomp-test.c deleted file mode 100644 index 20068e6..0000000 --- a/src/libgomp-test.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * This file is part of MXE. - * See index.html for further information. - */ - -#include -#include - -int main(int argc, char *argv[]) -{ - (void)argc; - (void)argv; - - omp_set_num_threads(4); - - #pragma omp parallel - fprintf(stderr, "Hello from thread %d, nthreads %d\n", - omp_get_thread_num(), omp_get_num_threads()); - - return 0; -} diff --git a/src/libgomp.mk b/src/libgomp.mk deleted file mode 100644 index 899a545..0000000 --- a/src/libgomp.mk +++ /dev/null @@ -1,41 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -PKG := libgomp -$(PKG)_IGNORE = $(gcc_IGNORE) -$(PKG)_VERSION = $(gcc_VERSION) -$(PKG)_CHECKSUM = $(gcc_CHECKSUM) -$(PKG)_SUBDIR = $(gcc_SUBDIR) -$(PKG)_FILE = $(gcc_FILE) -$(PKG)_URL = $(gcc_URL) -$(PKG)_URL_2 = $(gcc_URL_2) -$(PKG)_DEPS := gcc pthreads - -define $(PKG)_UPDATE - echo $(gcc_VERSION) -endef - -define $(PKG)_BUILD - mkdir -p '$(1).build' - cd '$(1).build' && '$(1)/libgomp/configure' \ - $(MXE_CONFIGURE_OPTS) \ - --prefix='$(PREFIX)' \ - --enable-version-specific-runtime-libs \ - --with-gnu-ld \ - LIBS='-lws2_32' \ - ac_cv_prog_FC='$(TARGET)-gfortran' - $(MAKE) -C '$(1).build' -j '$(JOBS)' install - - # TODO: find a way to fix this in configure stage - $(if $(BUILD_SHARED), \ - mv '$(PREFIX)/bin/'libgomp*.dll '$(PREFIX)/$(TARGET)/bin/'; \ - cp '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'libgomp.dll.a \ - '$(PREFIX)/$(TARGET)/lib/'; \ - cp '$(PREFIX)/lib/gcc/$(TARGET)/$($(PKG)_VERSION)/'libgomp.la \ - '$(PREFIX)/$(TARGET)/lib/') - - '$(TARGET)-gcc' \ - -W -Wall -Werror -ansi -pedantic \ - '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libgomp.exe' \ - -fopenmp -endef diff --git a/src/mingw-w64.mk b/src/mingw-w64.mk index 86b73dd..7e10f96 100644 --- a/src/mingw-w64.mk +++ b/src/mingw-w64.mk @@ -16,16 +16,3 @@ define $(PKG)_UPDATE $(SORT) -V | \ tail -1 endef - -define $(PKG)_BUILD_mingw-w64 - mkdir '$(1).headers-build' - cd '$(1).headers-build' && '$(1)/mingw-w64-headers/configure' \ - --host='$(TARGET)' \ - --prefix='$(PREFIX)/$(TARGET)' \ - --enable-sdk=all \ - --enable-idl - $(MAKE) -C '$(1).headers-build' install -endef - -$(PKG)_BUILD_x86_64-w64-mingw32 = $($(PKG)_BUILD_mingw-w64) -$(PKG)_BUILD_i686-w64-mingw32 = $($(PKG)_BUILD_mingw-w64) diff --git a/src/openblas.mk b/src/openblas.mk index a051c1a..89eb3ee 100644 --- a/src/openblas.mk +++ b/src/openblas.mk @@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := b41f71f46faab1215f6f6d17541113dc01fd4d8fee0694f3f459bc2e3c2aa $(PKG)_SUBDIR := OpenBLAS-$($(PKG)_VERSION) $(PKG)_FILE := $($(PKG)_SUBDIR).tar.gz $(PKG)_URL := http://github.com/xianyi/OpenBLAS/archive/v$($(PKG)_VERSION).tar.gz -$(PKG)_DEPS := gcc libgomp +$(PKG)_DEPS := gcc define $(PKG)_UPDATE $(WGET) -q -O- 'https://github.com/xianyi/OpenBLAS/releases' | \ diff --git a/src/openmp-validation.mk b/src/openmp-validation.mk index 591e2f0..28a1219 100644 --- a/src/openmp-validation.mk +++ b/src/openmp-validation.mk @@ -9,7 +9,7 @@ $(PKG)_SUBDIR := OpenMP$($(PKG)_VERSION)_Validation $(PKG)_FILE := $($(PKG)_SUBDIR).tar.gz $(PKG)_URL := http://web.cs.uh.edu/~openuh/download/packages/$($(PKG)_FILE) $(PKG)_URL_2 := -$(PKG)_DEPS := gcc libgomp +$(PKG)_DEPS := gcc define $(PKG)_UPDATE echo 'TODO: Updates for package openmp-validation need to be written.' >&2; diff --git a/src/pcl.mk b/src/pcl.mk index 159d924..6ba02d2 100644 --- a/src/pcl.mk +++ b/src/pcl.mk @@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := 479f84f2c658a6319b78271111251b4c2d6cf07643421b66bbc351d9bed0a $(PKG)_SUBDIR := $(PKG)-$(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := https://github.com/PointCloudLibrary/pcl/archive/$($(PKG)_FILE) -$(PKG)_DEPS := gcc boost eigen flann libgomp vtk +$(PKG)_DEPS := gcc boost eigen flann vtk define $(PKG)_UPDATE $(WGET) -q -O- "https://github.com/PointCloudLibrary/pcl/releases" | \ diff --git a/src/primesieve.mk b/src/primesieve.mk index 73928b0..b42e594 100644 --- a/src/primesieve.mk +++ b/src/primesieve.mk @@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := e6cb1eee915ff50dbd01ed9c6f13324cde16002c7ac49bf29feea07e0f348 $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://dl.bintray.com/kimwalisch/$(PKG)/$($(PKG)_FILE) -$(PKG)_DEPS := gcc libgomp +$(PKG)_DEPS := gcc define $(PKG)_UPDATE $(WGET) -q -O- 'http://primesieve.org/downloads/' | \ diff --git a/src/pthreads-libgomp-test.c b/src/pthreads-libgomp-test.c new file mode 100644 index 0000000..20068e6 --- /dev/null +++ b/src/pthreads-libgomp-test.c @@ -0,0 +1,21 @@ +/* + * This file is part of MXE. + * See index.html for further information. + */ + +#include +#include + +int main(int argc, char *argv[]) +{ + (void)argc; + (void)argv; + + omp_set_num_threads(4); + + #pragma omp parallel + fprintf(stderr, "Hello from thread %d, nthreads %d\n", + omp_get_thread_num(), omp_get_num_threads()); + + return 0; +} diff --git a/src/pthreads-test.cmake b/src/pthreads-test.cmake new file mode 100644 index 0000000..f818d90 --- /dev/null +++ b/src/pthreads-test.cmake @@ -0,0 +1,18 @@ +# This file is part of MXE. +# See index.html for further information. + +# partial module - included by src/cmake/CMakeLists.txt + +set(TGT test-${PKG}-cmake) + +enable_language(C) +add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/pthreads-test.c) + +find_package(Threads REQUIRED) +if(Threads::Threads) # cmake 3.1.0+ + target_link_libraries(${TGT} Threads::Threads) +else() + target_link_libraries(${TGT} ${CMAKE_THREAD_LIBS_INIT}) +endif() + +install(TARGETS ${TGT} DESTINATION bin) diff --git a/src/pthreads.mk b/src/pthreads.mk index 827cce8..e8b1a89 100644 --- a/src/pthreads.mk +++ b/src/pthreads.mk @@ -6,13 +6,13 @@ PKG := pthreads $(PKG)_VERSION := POSIX 1003.1-2001 -$(PKG)_DEPS := winpthreads +$(PKG)_DEPS := gcc define $(PKG)_UPDATE echo $(pthreads_VERSION) endef -define PTHREADS_TEST +define $(PKG)_BUILD # install and test pkg-config $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig' (echo 'Name: pthreads'; \ @@ -21,11 +21,17 @@ define PTHREADS_TEST echo 'Libs: -lpthread'; \ ) > '$(PREFIX)/$(TARGET)/lib/pkgconfig/pthreads.pc' + # test pkg-config and libgomp '$(TARGET)-gcc' \ -W -Wall -Werror -ansi -pedantic \ - '$(TOP_DIR)/src/pthreads-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \ + '$(TOP_DIR)/src/$(PKG)-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \ `'$(TARGET)-pkg-config' --libs pthreads` + '$(TARGET)-gcc' \ + -W -Wall -Werror -ansi -pedantic \ + '$(TOP_DIR)/src/$(PKG)-libgomp-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG)-libgomp.exe' \ + -fopenmp + # test cmake mkdir '$(1).test-cmake' cd '$(1).test-cmake' && '$(TARGET)-cmake' \ diff --git a/src/sox.mk b/src/sox.mk index c288c86..ac613d1 100644 --- a/src/sox.mk +++ b/src/sox.mk @@ -8,8 +8,8 @@ $(PKG)_CHECKSUM := b45f598643ffbd8e363ff24d61166ccec4836fea6d3888881b8df53e3bb55 $(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) $(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz $(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/$(PKG)/$(PKG)/$($(PKG)_VERSION)/$($(PKG)_FILE) -$(PKG)_DEPS := gcc file flac lame libgomp libltdl libmad libpng \ - libsndfile opencore-amr opus twolame vorbis wavpack +$(PKG)_DEPS := gcc file flac lame libltdl libmad libpng libsndfile \ + opencore-amr opus twolame vorbis wavpack define $(PKG)_UPDATE $(WGET) -q -O- 'http://sourceforge.net/projects/sox/files/sox/' | \ diff --git a/src/winpthreads-test.cmake b/src/winpthreads-test.cmake deleted file mode 100644 index f818d90..0000000 --- a/src/winpthreads-test.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -# partial module - included by src/cmake/CMakeLists.txt - -set(TGT test-${PKG}-cmake) - -enable_language(C) -add_executable(${TGT} ${CMAKE_CURRENT_LIST_DIR}/pthreads-test.c) - -find_package(Threads REQUIRED) -if(Threads::Threads) # cmake 3.1.0+ - target_link_libraries(${TGT} Threads::Threads) -else() - target_link_libraries(${TGT} ${CMAKE_THREAD_LIBS_INIT}) -endif() - -install(TARGETS ${TGT} DESTINATION bin) diff --git a/src/winpthreads.mk b/src/winpthreads.mk deleted file mode 100644 index 69d3061..0000000 --- a/src/winpthreads.mk +++ /dev/null @@ -1,26 +0,0 @@ -# This file is part of MXE. -# See index.html for further information. - -PKG := winpthreads -$(PKG)_IGNORE = $(mingw-w64_IGNORE) -$(PKG)_VERSION = $(mingw-w64_VERSION) -$(PKG)_CHECKSUM = $(mingw-w64_CHECKSUM) -$(PKG)_SUBDIR = $(mingw-w64_SUBDIR) -$(PKG)_FILE = $(mingw-w64_FILE) -$(PKG)_URL = $(mingw-w64_URL) -$(PKG)_DEPS := gcc - -define $(PKG)_UPDATE - echo $(mingw-w64_VERSION) -endef - -define $(PKG)_BUILD_mingw-w64 - cd '$(1)/mingw-w64-libraries/winpthreads' && ./configure \ - $(MXE_CONFIGURE_OPTS) - $(MAKE) -C '$(1)/mingw-w64-libraries/winpthreads' -j '$(JOBS)' install - - $(PTHREADS_TEST) -endef - -$(PKG)_BUILD_x86_64-w64-mingw32 = $($(PKG)_BUILD_mingw-w64) -$(PKG)_BUILD_i686-w64-mingw32 = $($(PKG)_BUILD_mingw-w64) -- cgit v0.12