Skip to contentSkip to conversation

libselinux: fix PREFIX argument to Makefiles

PATCH In review Eamon Walsh 2 participants 2 messages Aug 1, 2007 – Aug 2, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: fix PREFIX argument to Makefiles

This makes the PREFIX argument to the library Makefiles actually work for installing to e.g. /usr/local.

It would be a lot cleaner if the default destination for the .so file was /usr/lib instead of /lib. This special case makes the conditionals necessary.

---

libselinux/man/Makefile  |    7 ++++---
libselinux/src/Makefile  |    8 ++++++++
libsemanage/man/Makefile |    3 ++-
libsemanage/src/Makefile |    8 ++++++++
libsepol/man/Makefile    |    5 +++--
libsepol/src/Makefile    |    8 ++++++++
6 files changed, 33 insertions(+), 6 deletions(-)
src/Makefile (working copy) renamed from src/Makefile (revision 2506) +0 -0
Index: libsemanage/src/Makefile
===================================================================
@@ -1,7 +1,11 @@

# Installation directories.
PREFIX ?= $(DESTDIR)/usr
LIBDIR ?= $(PREFIX)/lib
+ifeq ($(PREFIX),$(DESTDIR)/usr)
SHLIBDIR ?= $(DESTDIR)/lib
+else
+SHLIBDIR ?= $(LIBDIR)
+endif
INCLUDEDIR ?= $(PREFIX)/include
PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]') PYINC ?= /usr/include/${PYLIBVER}
@@ -83,7 +87,11 @@

    test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
    install -m 755 $(LIBSO) $(SHLIBDIR)
    test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D 
semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
+ifeq ($(PREFIX),$(DESTDIR)/usr)
    cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)

+else
+ cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+endif

install-pywrap: pywrap

    test -d $(PYLIBDIR)/site-packages || install -m 755 -d 

$(PYLIBDIR)/site-packages

man/Makefile (working copy) renamed from man/Makefile (revision 2506) +0 -0
Index: libsemanage/man/Makefile
===================================================================
@@ -1,5 +1,6 @@

# Installation directories.
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= $(DESTDIR)/usr
+MAN3DIR ?= $(PREFIX)/share/man/man3

install:

    mkdir -p $(MAN3DIR)
src/Makefile (working copy) renamed from src/Makefile (revision 2506) +0 -0
Index: libsepol/src/Makefile
===================================================================
@@ -1,7 +1,11 @@

# Installation directories.
PREFIX ?= $(DESTDIR)/usr
LIBDIR ?= $(PREFIX)/lib
+ifeq ($(PREFIX),$(DESTDIR)/usr)
SHLIBDIR ?= $(DESTDIR)/lib
+else
+SHLIBDIR ?= $(LIBDIR)
+endif

LIBVERSION = 1

@@ -34,7 +38,11 @@

    install -m 644 $(LIBA) $(LIBDIR)
    test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
    install -m 755 $(LIBSO) $(SHLIBDIR)
+ifeq ($(PREFIX),$(DESTDIR)/usr)
    cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)

+else
+ cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+endif

relabel:

    /sbin/restorecon $(SHLIBDIR)/$(LIBSO)
man/Makefile (working copy) renamed from man/Makefile (revision 2506) +0 -0
Index: libsepol/man/Makefile
===================================================================
@@ -1,6 +1,7 @@

# Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= $(DESTDIR)/usr
+MAN8DIR ?= $(PREFIX)/share/man/man8
+MAN3DIR ?= $(PREFIX)/share/man/man3

install:

    mkdir -p $(MAN3DIR)
src/Makefile (working copy) renamed from src/Makefile (revision 2506) +0 -0
Index: libselinux/src/Makefile
===================================================================
@@ -1,7 +1,11 @@

# Installation directories.
PREFIX ?= $(DESTDIR)/usr
LIBDIR ?= $(PREFIX)/lib
+ifeq ($(PREFIX),$(DESTDIR)/usr)
SHLIBDIR ?= $(DESTDIR)/lib
+else
+SHLIBDIR ?= $(LIBDIR)
+endif
INCLUDEDIR ?= $(PREFIX)/include
PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % sys.version_info[0:2]') PYINC ?= /usr/include/$(PYLIBVER)
@@ -80,7 +84,11 @@

    install -m 644 $(LIBA) $(LIBDIR)
    test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
    install -m 755 $(LIBSO) $(SHLIBDIR)
+ifeq ($(PREFIX),$(DESTDIR)/usr)
    cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)

+else
+ cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+endif

install-pywrap: pywrap

    test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d 

$(PYTHONLIBDIR)/site-packages

man/Makefile (working copy) renamed from man/Makefile (revision 2506) +0 -0
Index: libselinux/man/Makefile
===================================================================
@@ -1,7 +1,8 @@

# Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= $(DESTDIR)/usr
+MAN8DIR ?= $(PREFIX)/share/man/man8
+MAN5DIR ?= $(PREFIX)/share/man/man5
+MAN3DIR ?= $(PREFIX)/share/man/man3

install:

    mkdir -p $(MAN3DIR)
Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 25 lines · Eamon Walsh

This makes the PREFIX argument to the library Makefiles actually work for installing to e.g. /usr/local.

It would be a lot cleaner if the default destination for the .so file was /usr/lib instead of /lib. This special case makes the conditionals necessary.

---

 libselinux/man/Makefile  |    7 ++++---
 libselinux/src/Makefile  |    8 ++++++++
 libsemanage/man/Makefile |    3 ++-
 libsemanage/src/Makefile |    8 ++++++++
 libsepol/man/Makefile    |    5 +++--
 libsepol/src/Makefile    |    8 ++++++++
 6 files changed, 33 insertions(+), 6 deletions(-)

Index: libsemanage/src/Makefile
===================================================================

src/Makefile (working copy) line 8

Quoted 8 lines
src/Makefile (working copy) renamed from src/Makefile (revision 2506) +4 -0
@@ -1,7 +1,11 @@
 # Installation directories.
 PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
+ifeq ($(PREFIX),$(DESTDIR)/usr)
 SHLIBDIR ?= $(DESTDIR)/lib
+else
+SHLIBDIR ?= $(LIBDIR)
+endif

NAK. That's too ugly to live.

Quoted 119 lines
src/Makefile (working copy) renamed from src/Makefile (revision 2506) +0 -0
 INCLUDEDIR ?= $(PREFIX)/include
 PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % 
 sys.version_info[0:2]')

PYINC ?= /usr/include/${PYLIBVER}

src/Makefile (working copy) renamed from src/Makefile (revision 2506) +4 -0
@@ -83,7 +87,11 @@
     test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
     install -m 755 $(LIBSO) $(SHLIBDIR)
     test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D 
 semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION)
+ifeq ($(PREFIX),$(DESTDIR)/usr)
     cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
+else
+    cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+endif
 
 install-pywrap: pywrap
     test -d $(PYLIBDIR)/site-packages || install -m 755 -d 

$(PYLIBDIR)/site-packages
Index: libsemanage/man/Makefile
===================================================================

man/Makefile (working copy) renamed from man/Makefile (revision 2506) +2 -1
@@ -1,5 +1,6 @@
 # Installation directories.
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= $(DESTDIR)/usr
+MAN3DIR ?= $(PREFIX)/share/man/man3
 
 install:
     mkdir -p $(MAN3DIR)

Index: libsepol/src/Makefile
===================================================================

src/Makefile (working copy) renamed from src/Makefile (revision 2506) +8 -0
@@ -1,7 +1,11 @@
 # Installation directories.
 PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
+ifeq ($(PREFIX),$(DESTDIR)/usr)
 SHLIBDIR ?= $(DESTDIR)/lib
+else
+SHLIBDIR ?= $(LIBDIR)
+endif
 
 LIBVERSION = 1
 
@@ -34,7 +38,11 @@
     install -m 644 $(LIBA) $(LIBDIR)
     test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
     install -m 755 $(LIBSO) $(SHLIBDIR)
+ifeq ($(PREFIX),$(DESTDIR)/usr)
     cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
+else
+    cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+endif
 
 relabel:
     /sbin/restorecon $(SHLIBDIR)/$(LIBSO)

Index: libsepol/man/Makefile
===================================================================

man/Makefile (working copy) renamed from man/Makefile (revision 2506) +3 -2
@@ -1,6 +1,7 @@
 # Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= $(DESTDIR)/usr
+MAN8DIR ?= $(PREFIX)/share/man/man8
+MAN3DIR ?= $(PREFIX)/share/man/man3
 
 install:
     mkdir -p $(MAN3DIR)

Index: libselinux/src/Makefile
===================================================================

src/Makefile (working copy) renamed from src/Makefile (revision 2506) +4 -0
@@ -1,7 +1,11 @@
 # Installation directories.
 PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
+ifeq ($(PREFIX),$(DESTDIR)/usr)
 SHLIBDIR ?= $(DESTDIR)/lib
+else
+SHLIBDIR ?= $(LIBDIR)
+endif
 INCLUDEDIR ?= $(PREFIX)/include
 PYLIBVER ?= $(shell python -c 'import sys;print "python%d.%d" % 
 sys.version_info[0:2]')

PYINC ?= /usr/include/$(PYLIBVER)

src/Makefile (working copy) renamed from src/Makefile (revision 2506) +4 -0
@@ -80,7 +84,11 @@
     install -m 644 $(LIBA) $(LIBDIR)
     test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
     install -m 755 $(LIBSO) $(SHLIBDIR)
+ifeq ($(PREFIX),$(DESTDIR)/usr)
     cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
+else
+    cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET)
+endif
 
 install-pywrap: pywrap
     test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d 

$(PYTHONLIBDIR)/site-packages
Index: libselinux/man/Makefile
===================================================================

man/Makefile (working copy) renamed from man/Makefile (revision 2506) +4 -3
@@ -1,7 +1,8 @@
 # Installation directories.
-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8
-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5
-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3
+PREFIX ?= $(DESTDIR)/usr
+MAN8DIR ?= $(PREFIX)/share/man/man8
+MAN5DIR ?= $(PREFIX)/share/man/man5
+MAN3DIR ?= $(PREFIX)/share/man/man3
 
 install:
     mkdir -p $(MAN3DIR)
Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.