浏览代码

msys2 ci (#243)

* add msys2 ci job

* run CI on any branch

* install base-devel on msys2

* remove soname and nodefaultlibs flags from mingw

* avoid soname on Windows

* add OLM_DLLEXPORT to signgam

it needs to be exported from the DLL also

* define IMPORT_EXPORTS on WINNT

While there are function export thunks in the import library that allow the linker to do the right thing for functions even if this is not set, it is required for the linker to do the right thing with variables being imported from a DLL (namely, signgam)

* add OLM_DLLEXPORT to openlibm_fenv_i387.h

seems this whole header was overlooked

* Update openlibm_fenv_i387.h

include openlibm_defs.h for OLM_DLLEXPORT
jeremyd2019 4 年之前
父节点
当前提交
60dec83e33
共有 6 个文件被更改,包括 39 次插入35 次删除
  1. 22 21
      .github/workflows/ci.yml
  2. 1 2
      Make.inc
  3. 2 1
      Makefile
  4. 11 10
      include/openlibm_fenv_i387.h
  5. 1 1
      include/openlibm_math.h
  6. 2 0
      test/Makefile

+ 22 - 21
.github/workflows/ci.yml

@@ -2,12 +2,11 @@ name: OpenLibm CI
 
 on:
   push:
-    branches: [ master ]
   pull_request:
     branches: [ master ]
 
 jobs:
-  build:
+  build-nix:
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
@@ -15,19 +14,12 @@ jobs:
         os:
           - ubuntu-latest
           - macos-latest
-          - windows-latest
         arch:
           - x64
           - x86
           - armv7
           - aarch64
         exclude:
-          - os: windows-latest
-            arch: aarch64
-          - os: windows-latest
-            arch: armv7
-          - os: windows-latest
-            arch: x86
           - os: macos-latest
             arch: armv7
           - os: macos-latest
@@ -35,17 +27,26 @@ jobs:
             
     steps:
       - uses: actions/checkout@v2
-      - name: Install i686-w64-mingw32-gcc
-        if: ${{ matrix.os == 'windows-latest' && matrix.arch == 'x86' }}
-        shell: bash
-        run: |
-          choco install mingw -y --x86 --force --params "/exception:sjlj"
-          choco install make -y
-          echo "CC=i686-w64-mingw32-gcc" >> "${GITHUB_ENV}"
-      - name: Set compiler for 64-bit Windows
-        if: ${{ matrix.os == 'windows-latest' && matrix.arch == 'x64' }}
-        shell: bash
-        run: |
-          echo "CC=x86_64-w64-mingw32-gcc" >> "${GITHUB_ENV}"
       - name: Build and run tests
         run: make && make test
+
+  build-msys2:
+    runs-on: windows-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - { sys: mingw64, env: x86_64 }
+          - { sys: mingw32, env: i686 }
+          - { sys: ucrt64,  env: ucrt-x86_64 }  # Experimental!
+          - { sys: clang64, env: clang-x86_64 } # Experimental!
+            
+    steps:
+      - uses: actions/checkout@v2
+      - uses: msys2/setup-msys2@v2
+        with:
+          msystem: ${{matrix.sys}}
+          install: base-devel mingw-w64-${{matrix.env}}-toolchain
+      - name: Build and run tests
+        shell: msys2 {0}
+        run: make && make test

+ 1 - 2
Make.inc

@@ -94,8 +94,7 @@ endif
 #keep these if statements separate
 ifeq ($(OS), WINNT)
 SHLIB_EXT = dll
-SONAME_FLAG = -soname
-CFLAGS_add += -nodefaultlibs
+SONAME_FLAG =
 shlibdir = $(bindir)
 else
 ifeq ($(OS), Darwin)

+ 2 - 1
Makefile

@@ -46,6 +46,7 @@ else
 OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR)
 OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
 endif
+LDFLAGS_add += -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
 endif
 
 .PHONY: all check test clean distclean \
@@ -67,7 +68,7 @@ libopenlibm.a: $(OBJS)
 	$(AR) -rcs libopenlibm.a $(OBJS)
 
 libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT): $(OBJS)
-	$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT) -o $@
+	$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -o $@
 ifneq ($(OS),WINNT)
 	ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
 	ln -sf $@ libopenlibm.$(SHLIB_EXT)

+ 11 - 10
include/openlibm_fenv_i387.h

@@ -29,6 +29,7 @@
 #ifndef	_FENV_H_
 #define	_FENV_H_
 
+#include "openlibm_defs.h"
 #include "cdefs-compat.h"
 #include "types-compat.h"
 
@@ -88,8 +89,8 @@ __BEGIN_DECLS
 
 /* After testing for SSE support once, we cache the result in __has_sse. */
 enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK };
-extern enum __sse_support __has_sse;
-int __test_sse(void);
+OLM_DLLEXPORT extern enum __sse_support __has_sse;
+OLM_DLLEXPORT int __test_sse(void);
 #ifdef __SSE__
 #define	__HAS_SSE()	1
 #else
@@ -98,7 +99,7 @@ int __test_sse(void);
 #endif
 
 /* Default floating-point environment */
-extern const fenv_t	__fe_dfl_env;
+OLM_DLLEXPORT extern const fenv_t	__fe_dfl_env;
 #define	FE_DFL_ENV	(&__fe_dfl_env)
 
 #define	__fldcw(__cw)		__asm __volatile("fldcw %0" : : "m" (__cw))
@@ -150,8 +151,8 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts)
 	return (0);
 }
 
-int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
-int feraiseexcept(int __excepts);
+OLM_DLLEXPORT int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
+OLM_DLLEXPORT int feraiseexcept(int __excepts);
 
 __fenv_static inline int
 fetestexcept(int __excepts)
@@ -206,8 +207,8 @@ fesetround(int __round)
 	return (0);
 }
 
-int fegetenv(fenv_t *__envp);
-int feholdexcept(fenv_t *__envp);
+OLM_DLLEXPORT int fegetenv(fenv_t *__envp);
+OLM_DLLEXPORT int feholdexcept(fenv_t *__envp);
 
 __fenv_static inline int
 fesetenv(const fenv_t *__envp)
@@ -231,12 +232,12 @@ fesetenv(const fenv_t *__envp)
 	return (0);
 }
 
-int feupdateenv(const fenv_t *__envp);
+OLM_DLLEXPORT int feupdateenv(const fenv_t *__envp);
 
 #if __BSD_VISIBLE
 
-int feenableexcept(int __mask);
-int fedisableexcept(int __mask);
+OLM_DLLEXPORT int feenableexcept(int __mask);
+OLM_DLLEXPORT int fedisableexcept(int __mask);
 
 /* We currently provide no external definition of fegetexcept(). */
 static inline int

+ 1 - 1
include/openlibm_math.h

@@ -174,7 +174,7 @@ extern const union __nan_un {
 #define	MAXFLOAT	((float)3.40282346638528860e+38)
 
 #ifndef OPENLIBM_ONLY_THREAD_SAFE
-extern int signgam;
+OLM_DLLEXPORT extern int signgam;
 #endif
 #endif /* __BSD_VISIBLE || __XSI_VISIBLE */
 

+ 2 - 0
test/Makefile

@@ -7,6 +7,8 @@ ifneq ($(OS),WINNT)
 ifneq ($(OS),Darwin)
 OPENLIBM_LIB += -Wl,-rpath=$(OPENLIBM_HOME)
 endif
+else # WINNT
+CFLAGS_add += -DIMPORT_EXPORTS
 endif
 
 all: test-double test-float # test-double-system test-float-system