diff options
author | Louis P. Santillan <lpsantil@gmail.com> | 2015-05-27 05:43:03 (GMT) |
---|---|---|
committer | Louis P. Santillan <lpsantil@gmail.com> | 2015-05-27 05:43:03 (GMT) |
commit | a3a479fc2b8f0d74f952a5676c29f07f9cf3c1b0 (patch) | |
tree | 6d0b4a65eb650c43c28377f5a17fe311af38df47 | |
parent | 00b6535b4c187f97a7f54cfd1dcb38c6c030a627 (diff) | |
download | lz4-a3a479fc2b8f0d74f952a5676c29f07f9cf3c1b0.zip lz4-a3a479fc2b8f0d74f952a5676c29f07f9cf3c1b0.tar.gz lz4-a3a479fc2b8f0d74f952a5676c29f07f9cf3c1b0.tar.bz2 |
djgpp port now using the proposed contrib structure
-rw-r--r-- | READMEDJ.MD | 19 | ||||
-rw-r--r-- | contrib/djgpp/LICENSE | 24 | ||||
-rw-r--r-- | contrib/djgpp/Makefile | 130 | ||||
-rw-r--r-- | contrib/djgpp/README.MD | 21 |
4 files changed, 175 insertions, 19 deletions
diff --git a/READMEDJ.MD b/READMEDJ.MD deleted file mode 100644 index 4d6cbcd..0000000 --- a/READMEDJ.MD +++ /dev/null @@ -1,19 +0,0 @@ -# lz4 for DOS/djgpp -This file details on how to compile lz4.exe, and liblz4.a for use on DOS/djgpp using -Andrew Wu's build-djgpp cross compilers ([GH][0], [Binaries][1]) on OSX, Linux. - -## Setup -* Download a djgpp tarball [Binaries][1] for your platform. -* Extract and install it (`tar jxvf djgpp-linux64-gcc492.tar.bz2`). Note the path. We'll assume `/home/user/djgpp`. -* Add the `bin` folder to your `PATH`. In bash, do `export PATH=/home/user/djgpp/bin:$PATH`. - -## Building LZ4 binary for DOS -* Run `make` substituting the cross compiler for `CC` and `AR`, e.g., `CC=i586-pc-msdosdjgpp-gcc AR=i586-pc-msdosdjgpp-ar make lz4programs` -* `lz4` and `lz4.exe` are then in the `programs/` subfolder. - -## Building LZ4 library for DOS -* Run `make` substituting the cross compiler for `CC` and `AR`, e.g., `CC=i586-pc-msdosdjgpp-gcc AR=i586-pc-msdosdjgpp-ar make lz4lib-djgpp` -* `liblz4.z`, `lz4.h`, `lz4hc.h`, `lz4frame.h`, and `xxhash.h` are then in the `lib/` subfolder. - -[0]: https://github.com/andrewwutw/build-djgpp -[1]: https://github.com/andrewwutw/build-djgpp/releases diff --git a/contrib/djgpp/LICENSE b/contrib/djgpp/LICENSE new file mode 100644 index 0000000..fee0d3b --- /dev/null +++ b/contrib/djgpp/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2014, lpsantil +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/contrib/djgpp/Makefile b/contrib/djgpp/Makefile new file mode 100644 index 0000000..8cd3580 --- /dev/null +++ b/contrib/djgpp/Makefile @@ -0,0 +1,130 @@ +# Copyright (c) 2015, Louis P. Santillan <lpsantil@gmail.com> +# All rights reserved. +# See LICENSE for licensing details. +DESTDIR ?= /opt/local + +# Pulled the code below from lib/Makefile. Might be nicer to derive this somehow without sed +# Version numbers +VERSION ?= 129 +RELEASE ?= r$(VERSION) +LIBVER_MAJOR=$(shell sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h) +LIBVER_MINOR=$(shell sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h) +LIBVER_PATCH=$(shell sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lib/lz4.h) +LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH) + +###################################################################### + +CROSS ?= i586-pc-msdosdjgpp +CC = $(CROSS)-gcc +AR = $(CROSS)-ar +LD = $(CROSS)-gcc + +CFLAGS ?= -O3 -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic -DLZ4_VERSION=\"$(RELEASE)\" +LDFLAGS ?= -s +SRC = programs/bench.c programs/lz4io.c programs/lz4cli.c +OBJ = $(SRC:.c=.o) +SDEPS = $(SRC:.c=.d) +IDIR = lib +EDIR = . +EXE = lz4.exe +LNK = lz4 +LDIR = lib +LSRC = lib/lz4.c lib/lz4hc.c lib/lz4frame.c lib/xxhash.c +INC = $(LSRC:.c=.h) +LOBJ = $(LSRC:.c=.o) +LSDEPS = $(LSRC:.c=.d) +LIB = $(LDIR)/lib$(LNK).a + +# Since LDFLAGS defaults to "-s", probably better to override unless +# you have a default you would like to maintain +ifeq ($(WITH_DEBUG), 1) + CFLAGS += -g + LDFLAGS += -g +endif + +# Since LDFLAGS defaults to "-s", probably better to override unless +# you have a default you would like to maintain +ifeq ($(WITH_PROFILING), 1) + CFLAGS += -pg + LDFLAGS += -pg +endif + +%.o: %.c $(INC) Makefile + $(CC) $(CFLAGS) -MMD -MP -I$(IDIR) -c $< -o $@ + +%.exe: %.o $(LIB) Makefile + $(LD) $< -L$(LDIR) -l$(LNK) $(LDFLAGS) $(LIBDEP) -o $@ + +###################################################################### +######################## DO NOT MODIFY BELOW ######################### +###################################################################### + +.PHONY: all install uninstall showconfig gstat gpush + +all: $(LIB) $(EXE) + +$(LIB): $(LOBJ) + $(AR) -rcs $@ $^ + +$(EXE): $(LOBJ) $(OBJ) + $(LD) $(LDFLAGS) $(LOBJ) $(OBJ) -o $(EDIR)/$@ + +clean: + rm -f $(OBJ) $(EXE) $(LOBJ) $(LIB) *.tmp $(SDEPS) $(LSDEPS) $(TSDEPS) + +install: $(INC) $(LIB) $(EXE) + mkdir -p $(DESTDIR)/bin $(DESTDIR)/include $(DESTDIR)/lib + rm -f .footprint + echo $(DESTDIR)/bin/$(EXE) >> .footprint + cp -v $(EXE) $(DESTDIR)/bin/ + @for T in $(LIB); \ + do ( \ + echo $(DESTDIR)/$$T >> .footprint; \ + cp -v --parents $$T $(DESTDIR) \ + ); done + @for T in $(INC); \ + do ( \ + echo $(DESTDIR)/include/`basename -a $$T` >> .footprint; \ + cp -v $$T $(DESTDIR)/include/ \ + ); done + +uninstall: .footprint + @for T in $(shell cat .footprint); do rm -v $$T; done + +-include $(SDEPS) $(LSDEPS) + +showconfig: + @echo "PWD="$(PWD) + @echo "VERSION="$(VERSION) + @echo "RELEASE="$(RELEASE) + @echo "LIBVER_MAJOR="$(LIBVER_MAJOR) + @echo "LIBVER_MINOR="$(LIBVER_MINOR) + @echo "LIBVER_PATCH="$(LIBVER_PATCH) + @echo "LIBVER="$(LIBVER) + @echo "CROSS="$(CROSS) + @echo "CC="$(CC) + @echo "AR="$(AR) + @echo "LD="$(LD) + @echo "DESTDIR="$(DESTDIR) + @echo "CFLAGS="$(CFLAGS) + @echo "LDFLAGS="$(LDFLAGS) + @echo "SRC="$(SRC) + @echo "OBJ="$(OBJ) + @echo "IDIR="$(IDIR) + @echo "INC="$(INC) + @echo "EDIR="$(EDIR) + @echo "EXE="$(EXE) + @echo "LDIR="$(LDIR) + @echo "LSRC="$(LSRC) + @echo "LOBJ="$(LOBJ) + @echo "LNK="$(LNK) + @echo "LIB="$(LIB) + @echo "SDEPS="$(SDEPS) + @echo "LSDEPS="$(LSDEPS) + +gstat: + git status + +gpush: + git commit + git push diff --git a/contrib/djgpp/README.MD b/contrib/djgpp/README.MD new file mode 100644 index 0000000..ff78902 --- /dev/null +++ b/contrib/djgpp/README.MD @@ -0,0 +1,21 @@ +# lz4 for DOS/djgpp +This file details on how to compile lz4.exe, and liblz4.a for use on DOS/djgpp using +Andrew Wu's build-djgpp cross compilers ([GH][0], [Binaries][1]) on OSX, Linux. + +## Setup +* Download a djgpp tarball [binaries][1] for your platform. +* Extract and install it (`tar jxvf djgpp-linux64-gcc492.tar.bz2`). Note the path. We'll assume `/home/user/djgpp`. +* Add the `bin` folder to your `PATH`. In bash, do `export PATH=/home/user/djgpp/bin:$PATH`. +* The `Makefile` in `contrib/djgpp/` sets up `CC`, `AR`, `LD` for you. So, `CC=i586-pc-msdosdjgpp-gcc`, `AR=i586-pc-msdosdjgpp-ar`, `LD=i586-pc-msdosdjgpp-gcc`. + +## Building LZ4 for DOS +In the base dir of lz4 and with `contrib/djgpp/Makefile`, try: +Try: +* `make -f contrib/djgpp/Makefile` +* `make -f contrib/djgpp/Makefile liblz4.a` +* `make -f contrib/djgpp/Makefile lz4.exe` +* `make -f contrib/djgpp/Makefile DESTDIR=/home/user/dos install`, however it doesn\'t make much sense on a \*nix. +* You can also do `make -f contrib/djgpp/Makefile uninstall` + +[0]: https://github.com/andrewwutw/build-djgpp +[1]: https://github.com/andrewwutw/build-djgpp/releases |