d68fdca16fd97881c20eaf95c2a431d6536e1fa4
hiram
  Mon Feb 26 17:29:51 2024 -0800
refining the build on Mac OSX no redmine

diff --git src/inc/common.mk src/inc/common.mk
index 8a7c23f..83803ad 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -24,53 +24,61 @@
 HG_INC+=-I../inc -I../../inc -I../../../inc -I../../../../inc -I../../../../../inc -I$(kentSrc)/htslib
 
 # to check for Mac OSX Darwin specifics:
 UNAME_S := $(shell uname -s)
 # to check for builds on hgwdev
 HOSTNAME = $(shell uname -n)
 
 ifeq (${HOSTNAME},hgwdev)
   IS_HGWDEV = yes
 else
   IS_HGWDEV = no
 endif
 
 # for Darwin (Mac OSX), use static libs when they can be found
 ifeq ($(UNAME_S),Darwin)
+  ifneq ($(wildcard /opt/local/include/openssl/ssl.h),)
+    HG_INC += -I/opt/local/include
+  endif
   ifneq ($(wildcard /opt/local/lib/libz.a),)
     ZLIB = /opt/local/lib/libz.a
-    $(info Darwin ZLIB: ${ZLIB})
   endif
   ifneq ($(wildcard /opt/local/lib/libpng.a),)
     PNGLIB = /opt/local/lib/libpng.a
-    $(info Darwin PNGLIB: ${PNGLIB})
   endif
   ifneq ($(wildcard /opt/local/lib/libfreetype.a),)
-    FREETYPELIBS = /opt/local/lib/libfreetype.a
-    $(info Darwin FREETYPELIBS: ${FREETYPELIBS})
+    FREETYPELIBS = /opt/local/lib/libfreetype.a /opt/local/lib/libbz2.a /opt/local/lib/libbrotlidec.a /opt/local/lib/libbrotlicommon.a
   endif
   ifneq ($(wildcard /usr/local/opt/openssl@3/lib/libssl.a),)
     SSLLIB = /usr/local/opt/openssl@3/lib/libssl.a
-    $(info Darwin SSLLIB: ${SSLLIB})
+  else
+    ifneq ($(wildcard /opt/local/libexec/openssl3/lib/libssl.a),)
+      SSLLIB = /opt/local/libexec/openssl3/lib/libssl.a
+    endif
   endif
   ifneq ($(wildcard /usr/local/opt/openssl@3/lib/libcrypto.a),)
     CRYPTOLIB = /usr/local/opt/openssl@3/lib/libcrypto.a
-    $(info Darwin CRYPTOLIB: ${CRYPTOLIB})
+  else
+    ifneq ($(wildcard /opt/local/libexec/openssl3/lib/libcrypto.a),)
+      CRYPTOLIB = /opt/local/libexec/openssl3/lib/libcrypto.a
+    endif
   endif
   ifneq ($(wildcard /opt/local/lib/libiconv.a),)
     ICONVLIB = /opt/local/lib/libiconv.a
-    $(info Darwin ICONVLIB: ${ICONVLIB})
+  endif
+  ifneq ($(wildcard /opt/homebrew/lib/libmysqlclient.a),)
+    MYSQLLIBS = /opt/homebrew/lib/libmysqlclient.a
   endif
 endif
 
 # Skip freetype for conda build; not needed for utils, and the Mac build environment has
 # freetype installed but we don't want to use the system libraries because they can be
 # for a newer OSX version than the conda build target, and can be incompatible.
 ifneq (${CONDA_BUILD},1)
   FREETYPECFLAGS = $(shell freetype-config --cflags  2> /dev/null)
   # Ubuntu does not have freetype-config anymore
   ifeq (${FREETYPEFLAGS},)
      FREETYPECFLAGS =  $(shell pkg-config freetype2 --cflags 2> /dev/null )
   endif
 
   # use the static library on OSX
   ifeq (${IS_HGWDEV},no)
@@ -83,31 +91,30 @@
         ifeq (${FREETYPELIBS},)
           FREETYPELIBS =  $(shell pkg-config freetype2 --libs 2> /dev/null )
         endif
       endif
     endif
   endif
 
   ifneq (${FREETYPECFLAGS},)
   FREETYPECFLAGS += -DUSE_FREETYPE
   endif
 
   HG_INC += ${FREETYPECFLAGS}
   L += ${FREETYPELIBS}
 endif
 
-
 ifeq (${HOSTNAME},cirm-01)
   FULLWARN = yes
 endif
 
 ifeq (${PTHREADLIB},)
   PTHREADLIB=-lpthread
 endif
 
 ifneq ($(UNAME_S),Darwin)
   L+=${PTHREADLIB}
 else
   ifeq (${ICONVLIB},)
     ICONVLIB=-liconv
   endif
 endif
@@ -221,34 +228,38 @@
 
 # on hgwdev, use the static libraries
 ifeq (${IS_HGWDEV},yes)
    FULLWARN = yes
    L+=/hive/groups/browser/freetype/freetype-2.10.0/objs/.libs/libfreetype.a -lbz2
    L+=/usr/lib64/libssl.a /usr/lib64/libcrypto.a -lkrb5 -lk5crypto -ldl
    PNGLIB=/usr/lib64/libpng.a
    PNGINCL=-I/usr/include/libpng15
    MYSQLINC=/usr/include/mysql
    MYSQLLIBS=/usr/lib64/libmysqlclient.a /usr/lib64/libssl.a /usr/lib64/libcrypto.a -lkrb5 -ldl -lz
    MYSQLLIBS += /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.a /usr/lib64/librt.a
 else
    ifeq (${CONDA_BUILD},1)
        L+=${PREFIX}/lib/libssl.a ${PREFIX}/lib/libcrypto.a -ldl
    else
-       ifeq (${SSLLIB},)
+       ifneq (${SSLLIB},)
+          L+=${SSLLIB}
+       else
           L+=-lssl
        endif
-       ifeq (${CRYPTOLIB},)
+       ifneq (${CRYPTOLIB},)
+          L+=${CRYPTOLIB}
+       else
           L+=-lcrypto -ldl
        endif
        ifeq (${DLLIB},)
           L+=-ldl
        endif
    endif
 endif
 
 #global external libraries
 L += $(kentSrc)/htslib/libhts.a
 
 L+=${PNGLIB} ${MLIB} ${ZLIB} ${ICONVLIB}
 HG_INC+=${PNGINCL}
 
 # pass through COREDUMP