From 8dda8683c5f461ac62a31c65823baf232843f228 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Mon, 4 Apr 2016 09:05:50 +0200 Subject: [PATCH] Install ginac-excompiler in $LIBEXECDIR, not in $BINDIR. ...and make the GiNaC library aware of where it is installed. The ginac-excompiler script is only invoked by GiNaC::compile_ex(...) and serves no purpose on its own. In compliance with the FHS, it should be installed in $LIBEXECDIR, not in $BINDIR. This also disburdens distribution packagers from having to provide a manpage (which may be required for all programs in $BINDIR). The location for $LIBEXECDIR defaults to ${prefix}/libexec/. It may be overwritten at configuration time. (Many distributions want to set it to ${prefix}/lib/ginac/.) --- CMakeLists.txt | 4 ++++ doc/tutorial/ginac.texi | 6 +++--- ginac/CMakeLists.txt | 1 + ginac/Makefile.am | 1 + ginac/excompiler.cpp | 2 +- tools/CMakeLists.txt | 4 ++-- tools/Makefile.am | 4 ++-- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 182207d9..cdb18f09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,6 +171,10 @@ find_program(FIG2DEV fig2dev) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) add_definitions(-DHAVE_CONFIG_H) +if (NOT LIBEXECDIR) + set (LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/libexec") +endif() + add_subdirectory(ginac) add_subdirectory(tools) add_subdirectory(check) diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index ecf4a227..17718f83 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -6691,9 +6691,9 @@ ones supplied to @code{compile_ex} should appear in the expression. @cindex ginac-excompiler @code{compile_ex} uses the shell script @code{ginac-excompiler} to start the C compiler and produce the object files. This shell script comes with GiNaC and -will be installed together with GiNaC in the configured @code{$PREFIX/bin} -directory. You can also export additional compiler flags via the $CXXFLAGS -variable: +will be installed together with GiNaC in the configured @code{$LIBEXECDIR} +(typically @code{$PREFIX/libexec} or @code{$PREFIX/lib/ginac}). You can also +export additional compiler flags via the @env{$CXXFLAGS} variable: @example setenv("CXXFLAGS", "-O3 -fomit-frame-pointer -ffast-math", 1); diff --git a/ginac/CMakeLists.txt b/ginac/CMakeLists.txt index 00824a49..db963935 100644 --- a/ginac/CMakeLists.txt +++ b/ginac/CMakeLists.txt @@ -147,6 +147,7 @@ set(ginaclib_private_headers ) add_library(ginac ${ginaclib_sources}) +add_definitions(-DLIBEXECDIR="${LIBEXECDIR}/") set_target_properties(ginac PROPERTIES SOVERSION ${ginaclib_soversion} VERSION ${ginaclib_version}) diff --git a/ginac/Makefile.am b/ginac/Makefile.am index 6f9fe748..890c5ac8 100644 --- a/ginac/Makefile.am +++ b/ginac/Makefile.am @@ -58,6 +58,7 @@ polynomial/smod_helpers.h \ polynomial/debug.h libginac_la_LDFLAGS = -version-info $(LT_VERSION_INFO) +libginac_la_CPPFLAGS = -DLIBEXECDIR='"$(libexecdir)/"' libginac_la_LIBADD = $(DL_LIBS) ginacincludedir = $(includedir)/ginac ginacinclude_HEADERS = ginac.h add.h archive.h assertion.h basic.h class_info.h \ diff --git a/ginac/excompiler.cpp b/ginac/excompiler.cpp index 1ef61d1f..68e4a302 100644 --- a/ginac/excompiler.cpp +++ b/ginac/excompiler.cpp @@ -140,7 +140,7 @@ public: */ void compile_src_file(const std::string filename, bool clean_up) { - std::string strcompile = "ginac-excompiler " + filename; + std::string strcompile = LIBEXECDIR "ginac-excompiler " + filename; if (system(strcompile.c_str())) { throw std::runtime_error("excompiler::compile_src_file: error compiling source file!"); } diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index d92e5d93..6feeb2d9 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -12,5 +12,5 @@ if (CMAKE_COMPILER_IS_GNUCC) "${CMAKE_CURRENT_BINARY_DIR}/ginac-excompiler" ) - install(PROGRAMS ginac-excompiler DESTINATION "${BIN_INSTALL_DIR}") -endif (CMAKE_COMPILER_IS_GNUCC) + install(PROGRAMS ginac-excompiler DESTINATION "${LIBEXECDIR}") +endif (CMAKE_COMPILER_IS_GNUCC) diff --git a/tools/Makefile.am b/tools/Makefile.am index 17867ab9..b4596f39 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -4,9 +4,9 @@ bin_PROGRAMS = viewgar viewgar_SOURCES = viewgar.cpp viewgar_LDADD = ../ginac/libginac.la -bin_SCRIPTS = +libexec_SCRIPTS = if CONFIG_EXCOMPILER -bin_SCRIPTS += ginac-excompiler +libexec_SCRIPTS += ginac-excompiler endif AM_CPPFLAGS = -I$(srcdir)/../ginac -I../ginac -DIN_GINAC -- 2.47.0