aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-02 10:40:08 +0000
committerRoy Marples <roy@marples.name>2008-03-02 10:40:08 +0000
commit7c092fbc7904be18510eed08c72cbad974db8adc (patch)
treeb1fc37769c6657a4bce52f56cf51e21325448c3e
parenta135d0d93b6ff1aebd0064b4b2afbc7e0313b1fd (diff)
If build in a prefix, define the system as prefix.
-rw-r--r--mk/prog.mk4
-rw-r--r--src/librc/librc.c5
-rw-r--r--src/librc/rc.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/mk/prog.mk b/mk/prog.mk
index d8c514f4..a52681f2 100644
--- a/mk/prog.mk
+++ b/mk/prog.mk
@@ -10,14 +10,14 @@ include ${MK}/sys.mk
# so we should embed it if different
# This is currently hardcoded for NetBSD which has two dynamic linkers
# and we need to use the one in /libexec instead of /usr/libexec
-_DYNLINK_SH= if test -e /libexec/ld.elf_so; then \
+_DYNLINK_SH= if test "${PREFIX}" = "" && test -e /libexec/ld.elf_so; then \
echo "-Wl,-dynamic-linker=/libexec/ld.elf_so"; \
else \
echo ""; \
fi
_DYNLINK!= ${_DYNLINK_SH}
LDFLAGS+= ${_DYNLINK}$(shell ${_DYNLINK_SH})
-LDFLAGS+= -Wl,-rpath=/${LIBNAME} -L/${LIBNAME}
+LDFLAGS+= -Wl,-rpath=${PREFIX}/${LIBNAME} -L${PREFIX}/${LIBNAME}
LDFLAGS+= ${PROGLDFLAGS}
all: depend ${PROG}
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 42779276..5525f2f3 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -186,6 +186,10 @@ static bool file_regex (const char *file, const char *regex)
const char *rc_sys (void)
{
+#ifdef PREFIX
+ return (RC_SYS_PREFIX);
+#else
+
#ifdef __FreeBSD__
int jailed = 0;
size_t len = sizeof (jailed);
@@ -208,6 +212,7 @@ const char *rc_sys (void)
#endif
return (NULL);
+#endif /* PREFIX */
}
static const char *rc_parse_service_state (rc_service_state_t state)
diff --git a/src/librc/rc.h b/src/librc/rc.h
index 87e88609..d2fde601 100644
--- a/src/librc/rc.h
+++ b/src/librc/rc.h
@@ -232,6 +232,7 @@ bool rc_service_daemons_crashed (const char *service);
* OpenRC can support some special sub system types, normally virtualization.
* Some services cannot work in these systems, or we do something else. */
#define RC_SYS_JAIL "JAIL"
+#define RC_SYS_PREFIX "PREFIX"
#define RC_SYS_UML "UML"
#define RC_SYS_VPS "VPS"
#define RC_SYS_XEN0 "XEN0"