Feh / nocache

minimize caching effects
BSD 2-Clause "Simplified" License
554 stars 53 forks source link

Maybe UNIX-way name for .so library ? #16

Open pavlinux opened 11 years ago

pavlinux commented 11 years ago
diff --git a/Makefile b/Makefile
index cfb6126..502d2ef 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ CFLAGS+= -Wall
 GCC = gcc $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)

 .PHONY: all
-all: $(CACHE_BINS) nocache.so nocache
+all: $(CACHE_BINS) libnocache.so nocache

 $(CACHE_BINS):
        $(GCC) -o $@ $@.c
@@ -32,14 +32,14 @@ nocache:
        sed 's!##libdir##!$$(dirname "$$0")!' <nocache.in >$@
        chmod a+x $@

-nocache.so: $(NOCACHE_BINS)
-       $(GCC) -pthread -shared -Wl,-soname,nocache.so -o nocache.so $(NOCACHE_BINS) -ldl
+libnocache.so: $(NOCACHE_BINS)
+       $(GCC) -pthread -shared -Wl,-soname,libnocache.so -o libnocache.so $(NOCACHE_BINS) -ldl

 $(mandir) $(libdir) $(bindir):
        mkdir -v -p $@

 install: all $(mandir) $(libdir) $(bindir) nocache.global
-       install -m 0644 nocache.so $(libdir)
+       install -m 0644 libnocache.so $(libdir)
        install -m 0755 nocache.global $(bindir)/nocache
        install -m 0755 $(CACHE_BINS) $(bindir)
        install -m 0644 $(MANPAGES) $(mandir)
@@ -47,11 +47,11 @@ install: all $(mandir) $(libdir) $(bindir) nocache.global
 .PHONY: uninstall
 uninstall:
        cd $(mandir) && $(RM) -v $(notdir $(MANPAGES))
-       $(RM) -v $(bindir)/nocache $(libdir)/nocache.so
+       $(RM) -v $(bindir)/nocache $(libdir)/libnocache.so

 .PHONY: clean distclean
 clean distclean:
-       $(RM) -v $(CACHE_BINS) $(NOCACHE_BINS) nocache.so nocache nocache.global
+       $(RM) -v $(CACHE_BINS) $(NOCACHE_BINS) libnocache.so nocache nocache.global

 .PHONY: test
 test: all
Feh commented 11 years ago

This would need further changes in the documentation and the wrapper script. @onlyjob, what do you think about the general idea? Personally, I think the “lib” prefix is misleading, since the shared object only overrides functions and cannot really be “used” like another library…

pavlinux commented 11 years ago

Then better nocache-wrapper, than libnocache.so,

onlyjob commented 11 years ago

I'm with you @Feh as I also don't recognise the value of this change. I actually prefer name "nocache.so" since it is a good match for executable while it is not a library so we can't comply with policy regarding SONAME (and/or ABI/API) anyway. In Debian we install "nocache.so" to private location under /usr/lib/nocache so it is not exposed as much as other libraries hence there is no need to prefix it with "lib". Perhaps we can consider changing default install location but there is already some flexibility for that matter as location of "library" can be given at build-time... @pavlinux, what makes you think that renaming is worth it? What were you trying to achieve?

noushi commented 11 years ago

+1 for storing nocache.so (or nocache-wrapper) in /usr/lib/nocache/ . it's cleaner and it's not a regular library.

onlyjob commented 11 years ago

:) On Debian it is also a policy requirement to avoid exposing private libs globally.