From 96c92f33b55a3381bdc037bc4fe450c20b974d1c Mon Sep 17 00:00:00 2001 From: Mark Ito Date: Thu, 22 Oct 2020 16:08:19 -0400 Subject: [PATCH 1/4] Remove python_version.mk. --- python_version.mk | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 python_version.mk diff --git a/python_version.mk b/python_version.mk deleted file mode 100644 index 540c6f1..0000000 --- a/python_version.mk +++ /dev/null @@ -1,5 +0,0 @@ -PYTHON_VERSION := $(shell python --version 2>&1 | head -1 | awk '{print $$2}') -PYTHON_MAJOR_VERSION := $(shell echo $(PYTHON_VERSION) | awk -F. '{print $$1}') -PYTHON_MINOR_VERSION := $(shell echo $(PYTHON_VERSION) | awk -F. '{print $$2}') -PYTHON_SUBMINOR_VERSION := $(shell echo $(PYTHON_VERSION) | awk -F. '{print $$3}') -PYTHON_GE_3 := $(shell if [ $(PYTHON_MAJOR_VERSION) -ge 3 ]; then echo true; else echo false; fi) From 227825655887b9bff34078a2c78c4aaa1990e5a7 Mon Sep 17 00:00:00 2001 From: Mark Ito Date: Thu, 22 Oct 2020 16:37:14 -0400 Subject: [PATCH 2/4] Gets python-config from the command line successfully. --- GNUmakefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 4f07abf..92792b6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,8 +3,6 @@ # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. # -------------------------------------------------------------- -include python_version.mk - name := hdgeant4 G4TARGET := $(name) G4EXLIB := true @@ -23,12 +21,14 @@ ifdef DIRACXX_HOME CPPFLAGS += -I$(DIRACXX_HOME) -DUSING_DIRACXX -L$(DIRACXX_HOME) -lDirac endif +PYTHON_CONFIG = python-config + CPPFLAGS += -I$(HDDS_HOME) -I./src -I./src/G4fixes CPPFLAGS += -I./src/G4debug CPPFLAGS += -I$(HALLD_RECON_HOME)/$(BMS_OSNAME)/include CPPFLAGS += -I$(JANA_HOME)/include CPPFLAGS += -I$(shell root-config --incdir) -CPPFLAGS += $(shell python-config --includes) +CPPFLAGS += $(shell $(PYTHON_CONFIG) --includes) CPPFLAGS += -Wno-unused-parameter -Wno-unused-but-set-variable CPPFLAGS += -DUSE_SSE2 -std=c++11 #CPPFLAGS += -I/usr/include/Qt @@ -93,7 +93,7 @@ INTYLIBS += -Wl,--whole-archive $(DANALIBS) -Wl,--no-whole-archive INTYLIBS += -fPIC -I$(HDDS_HOME) -I$(XERCESCROOT)/include INTYLIBS += -L${XERCESCROOT}/lib -lxerces-c INTYLIBS += -L$(G4TMPDIR) -lhdds -INTYLIBS += -l$(BOOST_PYTHON_LIB) -L$(shell python-config --prefix)/lib $(shell python-config --ldflags) +INTYLIBS += -l$(BOOST_PYTHON_LIB) -L$(shell $(PYTHON_CONFIG) --prefix)/lib $(shell $(PYTHON_CONFIG) --ldflags) INTYLIBS += -L$(G4ROOT)/lib64 $(patsubst $(G4ROOT)/lib64/lib%.so, -l%, $(G4shared_libs)) INTYLIBS += -lgfortran INTYLIBS += -L/usr/lib64 From 695e07f112e2e10354459513e5e2a72345b350aa Mon Sep 17 00:00:00 2001 From: Mark Ito Date: Thu, 22 Oct 2020 17:18:19 -0400 Subject: [PATCH 3/4] Get the python boost library name from the command line if default of boost_python is no good. --- GNUmakefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 92792b6..d0f1ba5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -83,11 +83,7 @@ DANALIBS += -L$(ETROOT)/lib -let -let_remote endif G4shared_libs := $(wildcard $(G4ROOT)/lib64/*.so) -ifeq ($(PYTHON_GE_3), true) - BOOST_PYTHON_LIB = boost_python$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION) -else - BOOST_PYTHON_LIB = boost_python -endif +BOOST_PYTHON_LIB = boost_python INTYLIBS += -Wl,--whole-archive $(DANALIBS) -Wl,--no-whole-archive INTYLIBS += -fPIC -I$(HDDS_HOME) -I$(XERCESCROOT)/include From b976cec13cc23cd420f0136bc44c3553f45fb698 Mon Sep 17 00:00:00 2001 From: Mark Ito Date: Mon, 2 Nov 2020 11:11:38 -0500 Subject: [PATCH 4/4] Also get the "-lpython" option from the command line if needed. Before Fedora 33, always came with python-config --libs, but no more. --- GNUmakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index d0f1ba5..caa3f42 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -84,12 +84,13 @@ endif G4shared_libs := $(wildcard $(G4ROOT)/lib64/*.so) BOOST_PYTHON_LIB = boost_python +PYTHON_LIB_OPTION = "" INTYLIBS += -Wl,--whole-archive $(DANALIBS) -Wl,--no-whole-archive INTYLIBS += -fPIC -I$(HDDS_HOME) -I$(XERCESCROOT)/include INTYLIBS += -L${XERCESCROOT}/lib -lxerces-c INTYLIBS += -L$(G4TMPDIR) -lhdds -INTYLIBS += -l$(BOOST_PYTHON_LIB) -L$(shell $(PYTHON_CONFIG) --prefix)/lib $(shell $(PYTHON_CONFIG) --ldflags) +INTYLIBS += -l$(BOOST_PYTHON_LIB) -L$(shell $(PYTHON_CONFIG) --prefix)/lib $(shell $(PYTHON_CONFIG) --ldflags) $(PYTHON_LIB_OPTION) INTYLIBS += -L$(G4ROOT)/lib64 $(patsubst $(G4ROOT)/lib64/lib%.so, -l%, $(G4shared_libs)) INTYLIBS += -lgfortran INTYLIBS += -L/usr/lib64