summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-03-29 03:47:34 -0400
committerDan McGee <dan@archlinux.org>2007-03-30 15:55:58 -0400
commitc3ad8bd75fbec09d60e2c681781034a1178999cc (patch)
tree45d41b625c9ddaac119080edc1ddb319b90065ee
parente9ee9045ff4e9dd2355cb0fea781d7e166f9b345 (diff)
downloadpacman-c3ad8bd75fbec09d60e2c681781034a1178999cc.tar.xz
Make all paths and file locations configurable
Several important paths, file locations, and extensions were #define-d in the source code instead of being configurable. This moves all of these to the configure script where they can be picked upon running ./configure. We may later want to make some of these even more visible and move them to pacman.conf. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--configure.ac81
-rw-r--r--lib/libalpm/alpm.h10
-rw-r--r--src/pacman/pacman.c2
3 files changed, 67 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 81fce19b..5c16fbfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,15 +35,45 @@ AC_CHECK_FUNCS([strverscmp])
AM_PROG_LIBTOOL
AM_CONDITIONAL(LINKSTATIC, test "$enable_static" = "yes")
-dnl Help line for doxygen
-AC_ARG_ENABLE(doxygen,
- AC_HELP_STRING([--disable-doxygen], [Build API docs via Doxygen]),
- [wantdoxygen=$enableval], [wantdoxygen=yes])
+dnl Help line for root directory
+AC_ARG_WITH(root-dir,
+ AC_HELP_STRING([--with-root-dir=path], [Set the location of pacman's root operating directory]),
+ [rootdir=$withval], [rootdir=/])
+
+dnl Help line for database path
+AC_ARG_WITH(db-path,
+ AC_HELP_STRING([--with-db-path=path], [Set the location of pacman's database]),
+ [dbpath=$withval], [dbpath=var/lib/pacman/])
+
+dnl Help line for cache directory
+AC_ARG_WITH(cache-dir,
+ AC_HELP_STRING([--with-cache-dir=path], [Set the location of pacman's cache directory]),
+ [cachedir=$withval], [cachedir=var/cache/pacman/pkg/])
+
+dnl Help line for lock file
+AC_ARG_WITH(lock-file,
+ AC_HELP_STRING([--with-lock-file=path], [Set the location of pacman's lock file]),
+ [lockfile=$withval], [lockfile=var/run/pacman.lck])
dnl Help line for config file
AC_ARG_WITH(config-file,
AC_HELP_STRING([--with-config-file=path], [Set the location of pacman's config file]),
- [configfile=$withval], [configfile=/etc/pacman.conf])
+ [configfile=$withval], [configfile=etc/pacman.conf])
+
+dnl Help line for package extension
+AC_ARG_WITH(pkg-ext,
+ AC_HELP_STRING([--with-pkg-ext=ext], [Set the file extension used by packages]),
+ [pkgext=$withval], [pkgext=.pkg.tar.gz])
+
+dnl Help line for database extension
+AC_ARG_WITH(db-ext,
+ AC_HELP_STRING([--with-db-ext=ext], [Set the file extension used by the database]),
+ [dbext=$withval], [dbext=.db.tar.gz])
+
+dnl Help line for doxygen
+AC_ARG_ENABLE(doxygen,
+ AC_HELP_STRING([--disable-doxygen], [Build API docs via Doxygen]),
+ [wantdoxygen=$enableval], [wantdoxygen=yes])
dnl Help line for debug
AC_ARG_ENABLE(debug,
@@ -145,15 +175,6 @@ if test -z "$LIBDOWNLOAD"; then
AC_MSG_ERROR("libdownload is needed to compile pacman!");
fi
-dnl Set config location
-AC_MSG_CHECKING(for configuration file name)
-if test -n "$configfile"; then
- AC_DEFINE_UNQUOTED([PACCONF], "$configfile", [Location of pacman conf file])
- AC_MSG_RESULT(["$configfile"])
-else
- AC_MSG_ERROR(["pacman config file (--with-config-file is not set"])
-fi
-
dnl Enable or disable debug code
AC_MSG_CHECKING(for debug mode request)
if test "x$debug" = "xyes" ; then
@@ -175,6 +196,27 @@ else
AC_MSG_RESULT(no)
fi
+dnl Set root directory
+AC_DEFINE_UNQUOTED([PM_ROOT], "$rootdir", [Location of pacman's default root directory])
+
+dnl Set database path
+AC_DEFINE_UNQUOTED([PM_DBPATH], "$dbpath", [Location of pacman database])
+
+dnl Set cache directory
+AC_DEFINE_UNQUOTED([PM_CACHEDIR], "$cachedir", [Location of pacman's package cache])
+
+dnl Set lock file location
+AC_DEFINE_UNQUOTED([PM_LOCK], "$lockfile", [Location of pacman lock file])
+
+dnl Set configuration file location
+AC_DEFINE_UNQUOTED([PM_CONF], "$configfile", [Location of pacman configuration file])
+
+dnl Set package file extension
+AC_DEFINE_UNQUOTED([PM_EXT_PKG], "$pkgext", [The file extension used by pacman packages])
+
+dnl Set database file extension
+AC_DEFINE_UNQUOTED([PM_EXT_DB], "$dbext", [The file extension used by pacman databases])
+
dnl ==========================================================================
AC_OUTPUT([
@@ -211,8 +253,17 @@ pacman-$VERSION:
libalpm version : ${LIB_VERSION}
pacman version : ${PACKAGE_VERSION}
- pacman.conf location : ${configfile}
+ Directory and file information:
+ root directory : ${rootdir}
+ database path : ${rootdir}${dbpath}
+ cache directory : ${rootdir}${cachedir}
+ lock file location : ${rootdir}${lockfile}
+ conf file location : ${rootdir}${configfile}
+ package extension : ${pkgext}
+ database extension : ${dbext}
+
+ Compilation options:
Doxygen support : ${usedoxygen}
debug support : ${debug}
fakeroot-proof support : ${fakeroot}
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 954cf96f..1d7c0004 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -34,16 +34,6 @@ extern "C" {
* Arch Linux Package Management library
*/
-/* TODO these should all be defined in config.h */
-#define PM_ROOT "/"
-#define PM_DBPATH "var/lib/pacman/"
-#define PM_CACHEDIR "var/cache/pacman/pkg/"
-#define PM_LOCK "tmp/pacman.lck"
-
-
-#define PM_EXT_PKG ".pkg.tar.gz"
-#define PM_EXT_DB ".db.tar.gz"
-
/*
* Structures
*/
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index c586aebe..add9cb93 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -510,7 +510,7 @@ int main(int argc, char *argv[])
alpm_option_set_logcb(cb_log);
if(config->configfile == NULL) {
- config->configfile = strdup(PACCONF);
+ config->configfile = strdup(PM_ROOT PM_CONF);
}
if(alpm_parse_config(config->configfile, NULL, "") != 0) {