1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

Fix $filter and Msys/Cygwin

- switched the patter and input of $filter into the right places
- added pattern wildcard to MSYS_NT & CYGWIN_NT as they change with windows versions
- correctly identify MSYS2, even in an env like MINGW64
This commit is contained in:
Quentin Boswank
2024-06-05 18:21:34 +02:00
parent 2acf90431a
commit f19c98228f
8 changed files with 26 additions and 18 deletions

View File

@ -151,7 +151,7 @@ clean:
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# make install is validated only for Linux, macOS, Hurd and some BSD targets # make install is validated only for Linux, macOS, Hurd and some BSD targets
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT CYGWIN_NT Haiku AIX)) ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT% CYGWIN_NT% Haiku AIX,$(shell sh -c 'MSYSTEM="MSYS" uname') ))
HOST_OS = POSIX HOST_OS = POSIX
@ -390,19 +390,19 @@ lz4install:
endif endif
ifneq (,$(filter MSYS%,$(shell uname))) ifneq (,$(filter MSYS%,$(shell sh -c 'MSYSTEM="MSYS" uname') ))
HOST_OS = MSYS HOST_OS = MSYS
endif endif
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# target specific tests # target specific tests
#------------------------------------------------------------------------ #------------------------------------------------------------------------
ifneq (,$(filter $(HOST_OS),MSYS POSIX)) ifneq (,$(filter MSYS POSIX,$(HOST_OS)))
CMAKE ?= cmake CMAKE ?= cmake
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON
ifneq (,$(filter MSYS%,$(shell uname))) ifneq (,$(filter MSYS%,$(shell sh -c 'MSYSTEM="MSYS" uname')))
CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
endif endif

View File

@ -10,7 +10,7 @@
ZSTD ?= zstd # note: requires zstd installation on local system ZSTD ?= zstd # note: requires zstd installation on local system
UNAME?= $(shell uname) UNAME?= $(shell sh -c 'MSYSTEM="MSYS" uname')
ifeq ($(UNAME), SunOS) ifeq ($(UNAME), SunOS)
DIFF ?= gdiff DIFF ?= gdiff
else else

View File

@ -266,7 +266,7 @@ clean:
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# make install is validated only for below listed environments # make install is validated only for below listed environments
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT CYGWIN_NT)) ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT%,$(UNAME)))
lib: libzstd.pc lib: libzstd.pc
@ -305,13 +305,21 @@ else
PCLIB := $(LDFLAGS_DYNLIB) PCLIB := $(LDFLAGS_DYNLIB)
endif endif
ifneq (,$(filter $(UNAME),FreeBSD NetBSD DragonFly))
ifneq ($(MT),)
PCLIB :=
PCMTLIB := $(LDFLAGS_DYNLIB)
else
PCLIB := $(LDFLAGS_DYNLIB)
endif
ifneq (,$(filter FreeBSD NetBSD DragonFly,$(UNAME)))
PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig
else else
PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig
endif endif
ifneq (,$(filter $(UNAME),SunOS)) ifneq (,$(filter SunOS,$(UNAME)))
INSTALL ?= ginstall INSTALL ?= ginstall
else else
INSTALL ?= install INSTALL ?= install

View File

@ -206,7 +206,7 @@ endif
endif endif
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT) CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
UNAME := $(shell uname) UNAME := $(shell sh -c 'MSYSTEM="MSYS" uname')
ifndef BUILD_DIR ifndef BUILD_DIR
ifeq ($(UNAME), Darwin) ifeq ($(UNAME), Darwin)

View File

@ -345,7 +345,7 @@ include $(wildcard $(DEPFILES))
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# make install is validated only for Linux, macOS, BSD, Hurd and Solaris targets # make install is validated only for Linux, macOS, BSD, Hurd and Solaris targets
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT CYGWIN_NT)) ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku AIX MSYS_NT% CYGWIN_NT%,$(UNAME)))
HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0) HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
EGREP_OPTIONS ?= EGREP_OPTIONS ?=
@ -388,14 +388,14 @@ datarootdir ?= $(PREFIX)/share
mandir ?= $(datarootdir)/man mandir ?= $(datarootdir)/man
man1dir ?= $(mandir)/man1 man1dir ?= $(mandir)/man1
ifneq (,$(filter $(UNAME),OpenBSD FreeBSD NetBSD DragonFly SunOS)) ifneq (,$(filter OpenBSD FreeBSD NetBSD DragonFly SunOS,$(UNAME)))
MANDIR ?= $(PREFIX)/man MANDIR ?= $(PREFIX)/man
MAN1DIR ?= $(MANDIR)/man1 MAN1DIR ?= $(MANDIR)/man1
else else
MAN1DIR ?= $(man1dir) MAN1DIR ?= $(man1dir)
endif endif
ifneq (,$(filter $(UNAME),SunOS)) ifneq (,$(filter SunOS,$(UNAME)))
INSTALL ?= ginstall INSTALL ?= ginstall
else else
INSTALL ?= install INSTALL ?= install

View File

@ -271,8 +271,8 @@ clean:
#---------------------------------------------------------------------------------- #----------------------------------------------------------------------------------
# valgrind tests validated only for some posix platforms # valgrind tests validated only for some posix platforms
#---------------------------------------------------------------------------------- #----------------------------------------------------------------------------------
UNAME := $(shell uname) UNAME := $(shell sh -c 'MSYSTEM="MSYS" uname')
ifneq (,$(filter $(UNAME),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX CYGWIN_NT)) ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS AIX CYGWIN_NT%,$(UNAME)))
HOST_OS = POSIX HOST_OS = POSIX
.PHONY: test-valgrind .PHONY: test-valgrind
@ -300,10 +300,10 @@ endif
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# make tests validated only for below targets # make tests validated only for below targets
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
ifneq (,$(filter $(HOST_OS),MSYS POSIX)) ifneq (,$(filter MSYS POSIX,$(HOST_OS)))
DIFF:=diff DIFF:=diff
ifneq (,$(filter $(UNAME),SunOS)) ifneq (,$(filter SunOS,$(UNAME)))
DIFF:=gdiff DIFF:=gdiff
endif endif

View File

@ -17,7 +17,7 @@ LDFLAGS ?=
ARFLAGS ?= ARFLAGS ?=
LIB_FUZZING_ENGINE ?= libregression.a LIB_FUZZING_ENGINE ?= libregression.a
PYTHON ?= python PYTHON ?= python
ifeq ($(shell uname), Darwin) ifeq ($(shell sh -c 'MSYSTEM="MSYS" uname') , Darwin)
DOWNLOAD?=curl -L -o DOWNLOAD?=curl -L -o
else else
DOWNLOAD?=wget -O DOWNLOAD?=wget -O

View File

@ -36,7 +36,7 @@ clean:
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# validated only for Linux, macOS, Hurd and some BSD targets # validated only for Linux, macOS, Hurd and some BSD targets
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD)) ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD,$(shell sh -c 'MSYSTEM="MSYS" uname') ))
test-%: zstd test-%: zstd
@./test-driver.sh --test-name $* --log-file $*.log --trs-file $*.trs --expect-failure "no" --color-tests "yes" --enable-hard-errors "yes" ./$*.sh @./test-driver.sh --test-name $* --log-file $*.log --trs-file $*.trs --expect-failure "no" --color-tests "yes" --enable-hard-errors "yes" ./$*.sh