diff --git a/Makefile b/Makefile index 09c2c1e3..f71faab2 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ all install relabel clean test indent: (cd $$subdir && $(MAKE) $@) || exit 1; \ done -install-pywrap swigify: +install-pywrap install-rubywrap swigify: @for subdir in $(PYSUBDIRS); do \ (cd $$subdir && $(MAKE) $@) || exit 1; \ done diff --git a/libselinux/src/.gitignore b/libselinux/src/.gitignore index ff0c7c2d..4dcc3b3b 100644 --- a/libselinux/src/.gitignore +++ b/libselinux/src/.gitignore @@ -1,3 +1,4 @@ selinux.py selinuxswig_wrap.c selinuxswig_python_exception.i +selinuxswig_ruby_wrap.c diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile index a0840ae0..b333f07f 100644 --- a/libselinux/src/Makefile +++ b/libselinux/src/Makefile @@ -3,6 +3,8 @@ # targets with "PYPREFIX": PYTHON ?= python PYPREFIX ?= $(notdir $(PYTHON)) +RUBY ?= ruby +RUBYPREFIX ?= $(notdir $(RUBY)) # Installation directories. PREFIX ?= $(DESTDIR)/usr @@ -13,9 +15,10 @@ PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_i PYINC ?= $(shell pkg-config --cflags $(PYPREFIX)) PYTHONLIBDIR ?= $(shell pkg-config --libs $(PYPREFIX)) PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER) -RUBYLIBVER ?= $(shell ruby -e 'print RUBY_VERSION.split(".")[0..1].join(".")') -RUBYPLATFORM ?= $(shell ruby -e 'print RUBY_PLATFORM') -RUBYINC ?= -I$(LIBDIR)/ruby/$(RUBYLIBVER)/$(RUBYPLATFORM) +RUBYLIBVER ?= $(shell $(RUBY) -e 'print RUBY_VERSION.split(".")[0..1].join(".")') +RUBYPLATFORM ?= $(shell $(RUBY) -e 'print RUBY_PLATFORM') +RUBYINC ?= $(shell pkg-config --cflags ruby-$(RUBYLIBVER)) +RUBYLIBDIR ?= $(shell pkg-config --libs ruby-$(RUBYLIBVER)) RUBYINSTALL ?= $(LIBDIR)/ruby/site_ruby/$(RUBYLIBVER)/$(RUBYPLATFORM) LIBBASE=$(shell basename $(LIBDIR)) @@ -33,7 +36,7 @@ SWIGLOBJ:= $(patsubst %.c,$(PYPREFIX)%.lo,$(SWIGCOUT)) SWIGRUBYLOBJ:= $(patsubst %.c,%.lo,$(SWIGRUBYCOUT)) SWIGSO=$(PYPREFIX)_selinux.so SWIGFILES=$(SWIGSO) selinux.py -SWIGRUBYSO=_rubyselinux.so +SWIGRUBYSO=$(RUBYPREFIX)_selinux.so LIBSO=$(TARGET).$(LIBVERSION) AUDIT2WHYLOBJ=$(PYPREFIX)audit2why.lo AUDIT2WHYSO=$(PYPREFIX)audit2why.so @@ -166,7 +169,7 @@ relabel: /sbin/restorecon $(SHLIBDIR)/$(LIBSO) clean: - -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(TARGET) $(AUDIT2WHYSO) *.o *.lo *~ + -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGRUBYLOBJ) $(SWIGSO) $(TARGET) $(AUDIT2WHYSO) *.o *.lo *~ distclean: clean rm -f $(GENERATED) $(SWIGFILES) diff --git a/libsemanage/src/.gitignore b/libsemanage/src/.gitignore index b1d65181..dc87c598 100644 --- a/libsemanage/src/.gitignore +++ b/libsemanage/src/.gitignore @@ -1,3 +1,4 @@ semanageswig_wrap.c semanageswig_python_exception.i semanage.py +semanageswig_ruby_wrap.c diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile index aaa98d12..fc649198 100644 --- a/libsemanage/src/Makefile +++ b/libsemanage/src/Makefile @@ -17,8 +17,10 @@ PYTHONLIBDIR ?= $(shell pkg-config --libs $(PYPREFIX)) PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER) RUBYLIBVER ?= $(shell $(RUBY) -e 'print RUBY_VERSION.split(".")[0..1].join(".")') RUBYPLATFORM ?= $(shell $(RUBY) -e 'print RUBY_PLATFORM') -RUBYINC ?= $(LIBDIR)/ruby/$(RUBYLIBVER)/$(RUBYPLATFORM) +RUBYINC ?= $(shell pkg-config --cflags ruby-$(RUBYLIBVER)) +RUBYLIBDIR ?= $(shell pkg-config --libs ruby-$(RUBYLIBVER)) RUBYINSTALL ?= $(LIBDIR)/ruby/site_ruby/$(RUBYLIBVER)/$(RUBYPLATFORM) + LIBBASE=$(shell basename $(LIBDIR)) DEFAULT_SEMANAGE_CONF_LOCATION=$(DESTDIR)/etc/selinux/semanage.conf @@ -47,7 +49,7 @@ SWIGLOBJ:= $(patsubst %.c,$(PYPREFIX)%.lo,$(SWIGCOUT)) SWIGRUBYLOBJ:= $(patsubst %.c,$(RUBYPREFIX)%.lo,$(SWIGRUBYCOUT)) SWIGSO=$(PYPREFIX)_semanage.so SWIGFILES=$(SWIGSO) semanage.py -SWIGRUBYSO=$(RUBYPREFIX)_rubysemanage.so +SWIGRUBYSO=$(RUBYPREFIX)_semanage.so LIBSO=$(TARGET).$(LIBVERSION) GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) semanageswig_python_exception.i @@ -79,7 +81,7 @@ $(SWIGLOBJ): $(SWIGCOUT) $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(PYINC) -fPIC -DSHARED -c -o $@ $< $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT) - $(CC) $(CFLAGS) $(SWIG_CFLAGS) -I$(RUBYINC) -fPIC -DSHARED -c -o $@ $< + $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $< $(SWIGSO): $(SWIGLOBJ) $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $< -L. -lsemanage -L$(LIBDIR) -Wl,-soname,$@