some macports updates

if macports is detected:
- check for ncurses from macports
- adjust the library search path to include /opt/local/lib
- adjust the C compiler include search path to include /opt/local/include
  via -I/opt/local/include.
- if libncursesw* is in /opt/local/lib, link with it.

Also, USEMACPORTS=1 will use macports if you have both homebrew and macports.
It isn't required, but the ordering in the Makefile will use homebrew first
otherwise.
This commit is contained in:
nhmall
2022-06-15 16:00:13 -04:00
parent 3c75e6b01a
commit f3dc168366

View File

@@ -19,6 +19,14 @@
# note: '#-INCLUDE' is not just a comment; multiw-1 contains sections 1 to 2
#-INCLUDE multiw-1.370
ifneq "$(USEMACPORTS)" "1"
HAVE_HOMEBREW := $(shell expr `which -s brew; echo $$?` = 0)
endif
ifneq "$(USEHOMEBREW)" "1"
HAVE_MACPORTS := $(shell expr `which -s port; echo $$?` = 0)
endif
# 3. If you set WANT_WIN_QT, you need to
# A) set QTDIR either here or in the environment to point to the Qt5
# library installation root. (Qt2, Qt3, Qt4 will not work)
@@ -39,10 +47,6 @@ endif # not WANT_WIN_QT
endif # WANT_WIN_QT6
endif # not WANT_WIN_QT
#check for homebrew or macports
HAVE_HOMEBREW := $(shell expr `which -s brew; echo $$?` = 0)
HAVE_MACPORTS := $(shell expr `which -s port; echo $$?` = 0)
ifdef WANT_WIN_QT
ifndef WANT_WIN_QT5
ifndef WANT_WIN_QT6
@@ -58,12 +62,18 @@ endif # WANT_WIN_QT5
ifdef WANT_WIN_QT6
QTDIR :=$(shell brew --prefix)/opt/qt@6
endif # WANT_WIN_QT6
else # not HAVE_HOMEBREW
else
$(info forcing use of macports)
endif # HAVE_HOMEBREW
ifeq "$(HAVE_MACPORTS)" "1"
ifdef WANT_WIN_QT5
# Qt5 installed via macports
QTDIR=/opt/local/libexec/qt5
endif # WANT_WIN_QT5
ifdef WANT_WIN_QT6
QTDIR=/opt/local/libexec/qt6
endif # WANT_WIN_QT6
endif # HAVE_MACPORTS
endif # HAVE_HOMEBREW
endif # WANT_WIN_QT
ifndef LIBXPM
@@ -157,7 +167,36 @@ endif #MAKEFILE_SRC
endif #HAVE_NCURSESW
endif #WANT_WIN_CURSES
CFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
ifdef MAKEFILE_SRC
ifdef CURSESLIB
PKGCFLAGS=
ifeq "$(HAVE_HOMEBREW)" "1"
HAVE_HOMEBREW_NCURSES := $(shell expr `brew ls --versions ncurses > /dev/null; echo $$?` = 0)
#$(info HAVE_HOMEBREW_NCURSES=$(HAVE_HOMEBREW_NCURSES))
ifeq "$(HAVE_HOMEBREW_NCURSES)" "1"
# Newer versions of ncurses are commonly installed via homebrew, but intentionally unlinked.
HOMEBREW_LFLAGS := -L$(shell brew --prefix)/opt/ncurses/lib
HOMEBREW_WINLIB := -I$(shell brew --prefix)/opt/ncurses/include
HOMEBREW_CFLAGS =
endif #HAVE_HOMEBREW_NCURSES
endif #HAVE_HOMEBREW
ifeq "$(HAVE_MACPORTS)" "1"
MACPORTS_CFLAGS = -I/opt/local/include
MACPORTS_LFLAGS = -L/opt/local/lib
CURSESLIB=
ifneq ($(wildcard /opt/local/lib/libncursesw*),)
MACPORTS_WINLIB = -lncursesw
else
MACPORTS_WINLIB = -lncurses
endif
endif #HAVE_MACPORTS
LFLAGS += $(HOMEBREW_LFLAGS) $(MACPORTS_LFLAGS)
WINLIB += $(HOMEBREW_WINLIB) $(MACPORTS_WINLIB) $(CURSESLIB)
PKGCFLAGS += $(HOMEBREW_CFLAGS) $(MACPORTS_CFLAGS)
endif #CURSESLIB
endif #MAKEFILE_SRC
CFLAGS+= $(PKGCFLAGS) $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
CFLAGS+= $(NHCFLAGS)
CCXXFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
@@ -171,24 +210,6 @@ HINTSRC=$(CHAINSRC)
HINTOBJ=$(CHAINOBJ)
endif # WANT_WIN_CHAIN
ifdef MAKEFILE_SRC
ifdef CURSESLIB
ifeq "$(HAVE_HOMEBREW)" "1"
HAVE_HOMEBREW_NCURSES := $(shell expr `brew ls --versions ncurses > /dev/null; echo $$?` = 0)
#$(info HAVE_HOMEBREW_NCURSES=$(HAVE_HOMEBREW_NCURSES))
ifeq "$(HAVE_HOMEBREW_NCURSES)" "1"
# Newer versions of ncurses are commonly installed via homebrew, but intentionally unlinked.
HOMEBREW_LFLAGS := -L$(shell brew --prefix)/opt/ncurses/lib
HOMEBREW_WINLIB := -I$(shell brew --prefix)/opt/ncurses/include
endif #HAVE_HOMEBREW_NCURSES
endif #HAVE_HOMEBREW
ifdef HOMEBREW_LFLAGS
LFLAGS += $(HOMEBREW_LFLAGS)
endif
WINLIB += $(HOMEBREW_WINLIB) $(CURSESLIB)
endif #CURSESLIB
endif #MAKEFILE_SRC
ifdef WANT_WIN_X11
USE_XPM=1
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11