ae6f7e1ca5938410ff8189423ddc9f365f5a0804
max
  Tue Feb 13 03:38:37 2024 -0800
The common.mk file is getting hard to read in part because the parts
that are run on hgwdev are not obvious to see, they're hidden under
five layers of "if" statements. So I'm starting to move everything that is only
run on hgwdev into a separate section, at the end as an override. Email from
cluster-admin, telling us the libpng is not statically linked anymore.
No redmine.

diff --git src/inc/common.mk src/inc/common.mk
index 21632d0..a52bc74 100644
--- src/inc/common.mk
+++ src/inc/common.mk
@@ -27,53 +27,58 @@
 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
 
 # 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
 
-  # we use our static library on dev
+  # use the static library on OSX
   ifeq (${IS_HGWDEV},no)
     ifeq (${FREETYPELIBS},)
       ifeq ($(UNAME_S),Darwin)
         FREETYPELIBS =  $(shell freetype-config --libs --static 2> /dev/null )
       else
         FREETYPELIBS =  $(shell freetype-config --libs 2> /dev/null )
+        # Ubuntu does not have freetype-config anymore
+        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 (${IS_HGWDEV},yes)
-  FULLWARN = yes
-endif
 
 ifeq (${HOSTNAME},cirm-01)
   FULLWARN = yes
 endif
 
 ifeq (${PTHREADLIB},)
   PTHREADLIB=-lpthread
 endif
 
 # required extra library on Mac OSX
 ICONVLIB=
 
 # pthreads is required
 ifneq ($(UNAME_S),Darwin)
   L+=${PTHREADLIB}
@@ -104,78 +109,50 @@
     HG_INC+=-I${HALDIR}/inc -I${HALDIR}/hal/blockViz/inc
 endif
 # on hgwdev, include HAL by defaults
 ifeq (${IS_HGWDEV},yes)
    L+=${HALLIBS}
 endif
 
 ifeq (${USE_HIC},)
     USE_HIC=1
 endif
 
 ifeq (${USE_HIC},1)
     HG_DEFS+=-DUSE_HIC
 endif
 
-
-# libssl: disabled by default
-#ifneq (${SSL_DIR}, "/usr/include/openssl")
-  #ifneq ($(UNAME_S),Darwin)
-    #ifneq ($(wildcard ${SSL_DIR}),)
-      #L+=-L${SSL_DIR}/lib
-    #endif
-  #endif
-    #HG_INC+=-I${SSL_DIR}/include
-#endif
-
-# on hgwdev, using the static library with mysqllient.
-ifeq (${IS_HGWDEV},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
-else
-   ifeq (${CONDA_BUILD},1)
-       L+=${PREFIX}/lib/libssl.a ${PREFIX}/lib/libcrypto.a -ldl
-   else
-       L+=-lssl -lcrypto -ldl
-   endif
-endif
-
 # autodetect where libm is installed
 ifeq (${MLIB},)
   MLIB=-lm
 endif
 
 # autodetect where png is installed
 ifeq (${PNGLIB},)
       PNGLIB := $(shell libpng-config --ldflags  || true)
 endif
 ifeq (${PNGLIB},)
   PNGLIB=-lpng
 endif
 ifeq (${PNGINCL},)
   PNGINCL := $(shell libpng-config --I_opts  || true)
 #       $(info using libpng-config to set PNGINCL: ${PNGINCL})
 endif
 
 # autodetect where mysql includes and libraries are installed
 # do not need to do this during 'clean' target (this is very slow for 'clean')
 ifneq ($(MAKECMDGOALS),clean)
-  # on hgwdev, use the static library.
-  ifeq (${IS_HGWDEV},yes)
-    MYSQLINC=/usr/include/mysql
-    MYSQLLIBS=/usr/lib64/libmysqlclient.a /usr/lib64/libssl.a /usr/lib64/libcrypto.a -lkrb5 -ldl -lz
-  endif
 
   # set MYSQL include path
   ifeq (${MYSQLINC},)
     MYSQLINC := $(shell mysql_config --include | sed -e 's/-I//' || true)
 #        $(info using mysql_config to set MYSQLINC: ${MYSQLINC})
   endif
   ifeq (${MYSQLINC},)
     ifneq ($(wildcard /usr/local/mysql/include/mysql.h),)
 	  MYSQLINC=/usr/local/mysql/include
     endif
   endif
   ifeq (${MYSQLINC},)
     ifneq ($(wildcard /usr/include/mysql/mysql.h),)
 	  MYSQLINC=/usr/include/mysql
     endif
@@ -192,44 +169,60 @@
     ifeq (${MYSQLINC},)
         $(error can not find installed mysql development system)
     endif
   endif
     # last resort, hoping the compiler can find it in standard locations
   ifeq (${MYSQLLIBS},)
       MYSQLLIBS="-lmysqlclient"
   endif
 endif
 
 # $(info have MYSQLINC: ${MYSQLINC})
 # $(info have MYSQLLIBS: ${MYSQLLIBS})
 
 # OK to add -lstdc++ to all MYSQLLIBS just in case it is
 #    MySQL version 5.6 libraries, but no 'librt' on Mac OSX
-ifeq (${IS_HGWDEV},yes)
-  MYSQLLIBS += /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.a /usr/lib64/librt.a
-else
+ifeq (${IS_HGWDEV},no)
   ifeq ($(UNAME_S),Darwin)
     MYSQLLIBS += -lstdc++
   else
     MYSQLLIBS += -lstdc++ -lrt
   endif
 endif
 
 ifeq (${ZLIB},)
   ZLIB=-lz
 endif
 
+# 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
+       L+=-lssl -lcrypto -ldl
+   endif
+endif
+
 #global external libraries
 L += $(kentSrc)/htslib/libhts.a
 
 L+=${PNGLIB} ${MLIB} ${ZLIB} ${ICONVLIB}
 HG_INC+=${PNGINCL}
 
 # pass through COREDUMP
 ifneq (${COREDUMP},)
     HG_DEFS+=-DCOREDUMP
 endif
 
 # autodetect UCSC additional source code with password for some external tracks on gbib
 GBIBDIR = /hive/groups/browser/gbib/
 ifneq ($(wildcard ${GBIBDIR}/*.c),)
   HG_DEFS+=-DUSE_GBIB_PWD