diff options
author | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2014-03-23 11:15:37 (GMT) |
---|---|---|
committer | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2014-03-23 11:15:37 (GMT) |
commit | 848fdf3c15e6e7c2a24a868ace02dc3180f5275c (patch) | |
tree | d379e2f07c92e4b4cdeeeaf540c35631c384785c | |
parent | a9d8640c1f3898cd47eb1faf22db013e8b9911db (diff) | |
download | lz4-848fdf3c15e6e7c2a24a868ace02dc3180f5275c.zip lz4-848fdf3c15e6e7c2a24a868ace02dc3180f5275c.tar.gz lz4-848fdf3c15e6e7c2a24a868ace02dc3180f5275c.tar.bz2 |
Added : lz4cat utility for posx systems
OS-X compatible dynamic library, thanks to Jan Stepien
corrected : relative symbolic link for versioned library
git-svn-id: https://lz4.googlecode.com/svn/trunk@115 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
-rw-r--r-- | Makefile | 39 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | programs/Makefile | 2 | ||||
-rw-r--r-- | programs/lz4cli.c | 9 |
4 files changed, 38 insertions, 16 deletions
@@ -30,7 +30,7 @@ # - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c # ################################################################ -export RELEASE=r114 +export RELEASE=r115 LIBVER_MAJOR=1 LIBVER_MINOR=0 LIBVER_PATCH=0 @@ -54,6 +54,16 @@ else EXT = endif +# OS X linker doesn't support -soname, and use different extension +# see : https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html +ifeq ($(shell uname), Darwin) + SONAME_FLAGS = + SHARED_EXT = dylib +else + SONAME_FLAGS = -Wl,-soname=liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) + SHARED_EXT = so +endif + TEXT = lz4.c lz4.h lz4hc.c lz4hc.h \ lz4_format_description.txt Makefile NEWS LICENSE \ cmake_unofficial/CMakeLists.txt \ @@ -71,7 +81,7 @@ default: liblz4 all: liblz4 lz4programs -liblz4: liblz4.a liblz4.so +liblz4: liblz4.a liblz4.$(SHARED_EXT) lz4programs: lz4.c lz4hc.c @cd $(PRGDIR); $(MAKE) -e all @@ -80,14 +90,14 @@ liblz4.a: lz4.c lz4hc.c $(CC) $(CFLAGS) -c $^ ar rcs liblz4.a lz4.o lz4hc.o -liblz4.so: lz4.c lz4hc.c - $(CC) $(CFLAGS) -shared $^ -fPIC -Wl,-soname=liblz4.so.$(LIBVER_MAJOR) -o $@.$(LIBVER) +liblz4.$(SHARED_EXT): lz4.c lz4hc.c + $(CC) $(CFLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(LIBVER) @ln -s $@.$(LIBVER) $@.$(LIBVER_MAJOR) @ln -s $@.$(LIBVER) $@ clean: - @rm -f core *.o *.a *.so *.so.* $(DISTRIBNAME) - @cd $(PRGDIR); make clean + @rm -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* $(DISTRIBNAME) *.sha1 + @cd $(PRGDIR); $(MAKE) clean @echo Cleaning completed @@ -97,23 +107,23 @@ ifneq (,$(filter $(shell uname),Linux Darwin)) install: liblz4 @install -d -m 755 $(DESTDIR)$(LIBDIR)/ $(DESTDIR)$(INCLUDEDIR)/ @install -m 755 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a - @install -m 755 liblz4.so.$(LIBVER) $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) - @install -m 755 liblz4.so.$(LIBVER_MAJOR) $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) - @install -m 755 liblz4.so $(DESTDIR)$(LIBDIR)/liblz4.so + @install -m 755 liblz4.$(SHARED_EXT).$(LIBVER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER) + @cp -a liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) $(DESTDIR)$(LIBDIR) + @cp -a liblz4.$(SHARED_EXT) $(DESTDIR)$(LIBDIR) @install -m 755 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h @install -m 755 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h @echo lz4 static and shared library installed - @cd $(PRGDIR); make install + @cd $(PRGDIR); $(MAKE) -e install uninstall: [ -x $(DESTDIR)$(LIBDIR)/liblz4.a ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.a - [ -x $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER) - [ -x $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so.$(LIBVER_MAJOR) - [ -x $(DESTDIR)$(LIBDIR)/liblz4.so ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so + rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT) + rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER_MAJOR) + [ -x $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT).$(LIBVER) [ -f $(DESTDIR)$(INCLUDEDIR)/lz4.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4.h [ -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h @echo lz4 libraries successfully uninstalled - @cd $(PRGDIR); make uninstall + @cd $(PRGDIR); $(MAKE) uninstall dist: clean @install -dD -m 700 lz4-$(RELEASE)/programs/ @@ -128,6 +138,7 @@ dist: clean done @tar -czf $(DISTRIBNAME) lz4-$(RELEASE)/ @rm -rf lz4-$(RELEASE) + @sha1sum $(DISTRIBNAME) > $(DISTRIBNAME).sha1 @echo Distribution $(DISTRIBNAME) built endif @@ -1,3 +1,7 @@ +r115: +Added : lz4cat utility, installed on POSX systems (issue 118) +OS-X compatible compilation of dynamic library (issue 115) + r114: Makefile : library correctly compiled with -O3 switch (issue 114) Makefile : library compilation compatible with clang diff --git a/programs/Makefile b/programs/Makefile index 868c5fb..54a19cf 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -86,11 +86,13 @@ ifneq (,$(filter $(shell uname),Linux Darwin)) install: lz4 lz4c @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/ @install -m 755 lz4 $(DESTDIR)$(BINDIR)/lz4 + @ln -s $(DESTDIR)$(BINDIR)/lz4 $(DESTDIR)$(BINDIR)/lz4cat @install -m 755 lz4c $(DESTDIR)$(BINDIR)/lz4c @install -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1 @echo lz4 installation completed uninstall: + rm -f $(DESTDIR)$(BINDIR)/lz4cat [ -x $(DESTDIR)$(BINDIR)/lz4 ] && rm -f $(DESTDIR)$(BINDIR)/lz4 [ -x $(DESTDIR)$(BINDIR)/lz4c ] && rm -f $(DESTDIR)$(BINDIR)/lz4c [ -f $(DESTDIR)$(MANDIR)/lz4.1 ] && rm -f $(DESTDIR)$(MANDIR)/lz4.1 diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 26e0111..fc5bd81 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -109,11 +109,12 @@ //**************************** #define COMPRESSOR_NAME "LZ4 Compression CLI" #ifndef LZ4_VERSION -# define LZ4_VERSION "v1.1.3" +# define LZ4_VERSION "v1.1.5" #endif #define AUTHOR "Yann Collet" #define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, AUTHOR, __DATE__ #define LZ4_EXTENSION ".lz4" +#define LZ4_CAT "lz4cat" #define KB *(1U<<10) #define MB *(1U<<20) @@ -310,6 +311,10 @@ int main(int argc, char** argv) LZ4IO_setOverwrite(0); blockSize = LZ4IO_setBlockSizeID(LZ4_BLOCKSIZEID_DEFAULT); + // lz4cat behavior + if (!strcmp(programName, LZ4_CAT)) { decode=1; forceStdout=1; output_filename=stdoutmark; displayLevel=1; } + + // command switches for(i=1; i<argc; i++) { char* argument = argv[i]; @@ -335,7 +340,7 @@ int main(int argc, char** argv) if ((argument[0]=='c') && (argument[1]=='0')) { cLevel=0; argument++; continue; } // -c0 (fast compression) if ((argument[0]=='c') && (argument[1]=='1')) { cLevel=9; argument++; continue; } // -c1 (high compression) if ((argument[0]=='h') && (argument[1]=='c')) { cLevel=9; argument++; continue; } // -hc (high compression) - if (*argument=='y') { LZ4IO_setOverwrite(1); continue; } // -y (answer 'yes' to overwrite permission) + if (*argument=='y') { LZ4IO_setOverwrite(1); continue; } // -y (answer 'yes' to overwrite permission) if (*argument=='s') { displayLevel=1; continue; } // -s (silent mode) #endif // DISABLE_LZ4C_LEGACY_OPTIONS |