commit adafacd3356d54a893e7181d7fb63363129f7c64 from: Thomas Adam date: Tue Aug 29 16:31:10 2023 UTC portable: configure gitwrapper/gotd paths Rather than hard-code assumptions into gitwrapper and gotd binaries, allow for some values to be overriden at compile time. This should help portability. commit - e0b6d366f262254dd06e78941adf35836499d723 commit + adafacd3356d54a893e7181d7fb63363129f7c64 blob - 0c6b4829871cd12a8f1181ebeb65219b8b1ae7bc blob + 7f582638c01e06b741b7bfa8416888fd175c6475 --- configure.ac +++ configure.ac @@ -23,6 +23,24 @@ AC_CANONICAL_HOST AC_CONFIG_SUBDIRS([template]) AC_ARG_ENABLE([gotd], AS_HELP_STRING([--enable gotd], [build gotd and gotsh])) + +# Override gotd's empty_path location. +AC_ARG_WITH([gotd-empty-path], + [AS_HELP_STRING([--with-gotd-empty-path], + [gotd empty path]) + ], + [GOTD_EMPTY_PATHC=$withval] + []) +AC_SUBST(GOTD_EMPTY_PATHC) + +# Override where git's libexec helpers are located for gitwrapper. +AC_ARG_WITH([gitwrapper-git-libexec-path], + [AS_HELP_STRING([--with-gitwrapper-git-libexec-path], + [git libexec path for gitwrapper]) + ], + [GITWRAPPER_LIBEXEC_PATHC=$withval] + []) +AC_SUBST(GITWRAPPER_LIBEXEC_PATHC) # When CFLAGS isn't set at this stage and gcc is detected by the macro below, # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an blob - d199a603cd967964eefb0416b9ae6427b2d79cf3 blob + 4267fc7b77a9a4b2dcd891cae1a69243237c38d6 --- gitwrapper/Makefile.am +++ gitwrapper/Makefile.am @@ -3,6 +3,7 @@ bin_PROGRAMS = gitwrapper include $(top_builddir)/Makefile.common AM_CPPFLAGS += -I$(top_builddir)/gotd +AM_CPPFLAGS += -DGITWRAPPER_GIT_LIBEXEC_DIR='"@GITWRAPPER_LIBEXEC_PATHC@"' CLEANFILES = parse.h blob - af3cf15215d61e94a762d704ddca0ecf37080994 blob + 2b1255118b91d4c7edef0a6016130ed9de07bfcd --- gitwrapper/gitwrapper.c +++ gitwrapper/gitwrapper.c @@ -43,12 +43,8 @@ #include "log.h" #ifndef GITWRAPPER_GIT_LIBEXEC_DIR -#ifdef __linux__ -#define GITWRAPPER_GIT_LIBEXEC_DIR "/usr/lib/git-core/" -#else #define GITWRAPPER_GIT_LIBEXEC_DIR "/usr/local/libexec/git" #endif -#endif #ifndef GITWRAPPER_MY_SERVER_PROG #define GITWRAPPER_MY_SERVER_PROG "gotsh" blob - c6531257554a0d495a7ef3a1e39d84a0be4ce03d blob + 48c4a7682ccaa4839186ef9c9f12418cd94c8ddf --- gotd/Makefile.am +++ gotd/Makefile.am @@ -2,6 +2,8 @@ sbin_PROGRAMS = gotd include $(top_builddir)/Makefile.common +AM_CPPFLAGS += -DGOTD_EMPTY_PATH='"@GOTD_EMPTY_PATHC@"' + gotd_SOURCES = gotd.c \ auth.c \ imsg.c \ blob - a379ad89ec990acda3d6d8952f4e9ad3d45e92e0 blob + c9dacfdc7fc166370fa8e6384c7fef0a6ddc3fac --- gotd/gotd.h +++ gotd/gotd.h @@ -20,11 +20,7 @@ #define GOTD_UNIX_SOCKET_BACKLOG 10 #define GOTD_USER "_gotd" #define GOTD_CONF_PATH "/etc/gotd.conf" -#ifdef __linux__ -/* FIXME: Will move to --configure */ -#define GOTD_EMPTY_PATH "/var/run/gotd" -#else -/* Assumes *BSD, Apple, etc... */ +#ifndef GOTD_EMPTY_PATH #define GOTD_EMPTY_PATH "/var/empty" #endif