]> granicus.if.org Git - nethack/commitdiff
some macports updates
authornhmall <nhmall@nethack.org>
Wed, 15 Jun 2022 20:00:13 +0000 (16:00 -0400)
committernhmall <nhmall@nethack.org>
Wed, 15 Jun 2022 20:00:13 +0000 (16:00 -0400)
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.

sys/unix/hints/macOS.370

index 15ba657f9f21b3539f9008fc10a585a625db0816..098024703e6d2940ed434974f331af88ad802f25 100755 (executable)
 # 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,22 +167,9 @@ endif   #MAKEFILE_SRC
 endif   #HAVE_NCURSESW
 endif   #WANT_WIN_CURSES
 
-CFLAGS+= $(WINCFLAGS)  #WINCFLAGS set from multiw-2.370
-CFLAGS+= $(NHCFLAGS)
-
-CCXXFLAGS+= $(WINCFLAGS) #WINCFLAGS set from multiw-2.370
-CCXXFLAGS+= $(NHCFLAGS)
-
-VARDATND =
-VARDATND0 =
-
-ifdef WANT_WIN_CHAIN
-HINTSRC=$(CHAINSRC)
-HINTOBJ=$(CHAINOBJ)
-endif # WANT_WIN_CHAIN
-
 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))
@@ -180,15 +177,39 @@ 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
-ifdef HOMEBREW_LFLAGS
-LFLAGS += $(HOMEBREW_LFLAGS)
+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
-WINLIB += $(HOMEBREW_WINLIB) $(CURSESLIB)
+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
+CCXXFLAGS+= $(NHCFLAGS)
+
+VARDATND =
+VARDATND0 =
+
+ifdef WANT_WIN_CHAIN
+HINTSRC=$(CHAINSRC)
+HINTOBJ=$(CHAINOBJ)
+endif # WANT_WIN_CHAIN
+
 ifdef WANT_WIN_X11
 USE_XPM=1
 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11