building ciderpress libraries with cmake

This commit is contained in:
Shawn Quick 2023-02-04 15:34:50 -08:00
parent e74f463a1e
commit 9c66992c23
164 changed files with 104484 additions and 51 deletions

1
app_config.h Symbolic link
View File

@ -0,0 +1 @@
config.h

View File

@ -862,15 +862,8 @@ static NuError Nu_OpenTempFile(UNICHAR* fileNameUNI, FILE** pFp)
#else
char* result;
#if 1
DBUG(("+++ Using mktemp\n"));
result = mktemp(fileNameUNI);
#else
char fbuff[256];
sprintf(fbuff,"%s%s",fileNameUNI,"XXXXXX");
result=mkstemp();
#endif
if (result == NULL) {
Nu_ReportError(NU_BLOB, kNuErrNone, "mktemp failed on '%s'",
fileNameUNI);

View File

@ -0,0 +1,29 @@
Copyright (C) 2007, Andy McFadden.
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.
* Neither the name of the copyright holder nor the names of project
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
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 OWNER 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.

183
ciderpress/nufxlib/INSTALL Normal file
View File

@ -0,0 +1,183 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -1,15 +1,141 @@
.SILENT:
export CC=gcc
export CXX=g++
#
# NuFX archive manipulation library
# Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
# This is free software; you can redistribute it and/or modify it under the
# terms of the BSD License, see the file COPYING-LIB.
#
# Makefile for nufxlib (should work with non-GNU "make").
#
# You can use:
# make (builds library and sample applications)
# make shared (builds shared library if you're using GNU ld or similar)
#
# The shared library support currently leaves much to be desired.
#
# If you build with -DDEBUG_MSGS, nulib2 will be able to use the hidden
# 'g' command, which generates a verbose archive dump for debugging.
#
.PHONY: clean
# NufxLib install location.
prefix = /usr/local
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
srcdir = .
all: nufx
SHELL = /bin/sh
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
CC = gcc
AR = ar rcv
#OPT = -g -O2 -DNDEBUG
OPT = -g -O2
#OPT = -g -O2 -DDEBUG_MSGS
#OPT = -g -O2 -DDEBUG_VERBOSE
GCC_FLAGS = -Wall -Wwrite-strings -Wstrict-prototypes -Wpointer-arith -Wshadow
CFLAGS = $(OPT) $(GCC_FLAGS) -I. -DHAVE_CONFIG_H -DOPTFLAGSTR="\"$(OPT)\""
nufx:
-mkdir -p ./build
cd ./build && cmake ..
cd ./build && $(MAKE)
SRCS = Archive.c ArchiveIO.c Bzip2.c Charset.c Compress.c Crc16.c \
Debug.c Deferred.c Deflate.c Entry.c Expand.c FileIO.c Funnel.c \
Lzc.c Lzw.c MiscStuff.c MiscUtils.c Record.c SourceSink.c \
Squeeze.c Thread.c Value.c Version.c
OBJS = Archive.o ArchiveIO.o Bzip2.o Charset.o Compress.o Crc16.o \
Debug.o Deferred.o Deflate.o Entry.o Expand.o FileIO.o Funnel.o \
Lzc.o Lzw.o MiscStuff.o MiscUtils.o Record.o SourceSink.o \
Squeeze.o Thread.o Value.o Version.o
STATIC_PRODUCT = libnufx.a
SHARED_PRODUCT = libnufx.so
PRODUCT = $(STATIC_PRODUCT)
#
# Build stuff
#
all: $(PRODUCT) samples
@true
install: $(STATIC_PRODUCT)
$(srcdir)/mkinstalldirs $(libdir)
$(INSTALL_DATA) $(STATIC_PRODUCT) $(libdir)
$(srcdir)/mkinstalldirs $(includedir)
$(INSTALL_DATA) NufxLib.h $(includedir)
install-shared: $(SHARED_PRODUCT)
$(srcdir)/mkinstalldirs $(libdir)
$(INSTALL_DATA) $(SHARED_PRODUCT) $(libdir)
$(srcdir)/mkinstalldirs $(includedir)
$(INSTALL_DATA) NufxLib.h $(includedir)
samples::
@echo "Building samples..."
@(cd samples; set +e; unset CFLAGS OBJS; set -e; \
LIB_PRODUCT="../$(PRODUCT)" $(MAKE))
shared::
PRODUCT="$(SHARED_PRODUCT)" $(MAKE) -e
$(STATIC_PRODUCT): $(OBJS)
-rm -f $(STATIC_PRODUCT) $(SHARED_PRODUCT)
$(AR) $@ $(OBJS)
ranlib $@
# BUG: we need -fPIC, maybe -D_REENTRANT when compiling for this.
# BUG: for Linux we may want -Wl,-soname,libnufx.so.1 on the link line.
$(SHARED_PRODUCT): $(OBJS)
-rm -f $(STATIC_PRODUCT) $(SHARED_PRODUCT)
$(CC) -shared -o $@ $(OBJS) -lz
clean:
-rm -rf ./build
(cd samples; make clean)
-rm -f *.o core
-rm -f $(SHARED_PRODUCT) $(STATIC_PRODUCT)
# build tags; assumes fancy GNU tag generation
tags::
@ctags -R --totals *
@#ctags *.[ch]
distclean: clean
(cd samples; make distclean)
-rm -f Makefile Makefile.bak
-rm -f config.log config.cache config.status config.h
-rm -f tags
# Make a tarfile with a backup of the essential files. We include "Makefile"
# so that we can do a "make distclean" during packaging.
baktar:
@tar cvf nufxlib.tar *.txt COPYING-LIB INSTALL configure *.in Makefile \
Makefile.msc Makefile.dll install-sh config.guess config.sub \
mkinstalldirs *.[ch] samples/*.txt samples/Makefile* samples/*.[ch]
@gzip -9 nufxlib.tar
@mv -i nufxlib.tar.gz /home/fadden/BAK/
# dependency info
COMMON_HDRS = NufxLibPriv.h NufxLib.h MiscStuff.h SysDefs.h
Archive.o: Archive.c $(COMMON_HDRS)
ArchiveIO.o: ArchiveIO.c $(COMMON_HDRS)
Bzip2.o: Bzip2.c $(COMMON_HDRS)
Charset.o: Charset.c $(COMMON_HDRS)
Compress.o: Compress.c $(COMMON_HDRS)
Crc16.o: Crc16.c $(COMMON_HDRS)
Debug.o: Debug.c $(COMMON_HDRS)
Deferred.o: Deferred.c $(COMMON_HDRS)
Deflate.o: Deflate.c $(COMMON_HDRS)
Entry.o: Entry.c $(COMMON_HDRS)
Expand.o: Expand.c $(COMMON_HDRS)
FileIO.o: FileIO.c $(COMMON_HDRS)
Funnel.o: Funnel.c $(COMMON_HDRS)
Lzc.o: Lzc.c $(COMMON_HDRS)
Lzw.o: Lzw.c $(COMMON_HDRS)
MiscStuff.o: MiscStuff.c $(COMMON_HDRS)
MiscUtils.o: MiscUtils.c $(COMMON_HDRS)
Record.o: Record.c $(COMMON_HDRS)
SourceSink.o: SourceSink.c $(COMMON_HDRS)
Squeeze.o: Squeeze.c $(COMMON_HDRS)
Thread.o: Thread.c $(COMMON_HDRS)
Value.o: Value.c $(COMMON_HDRS)
Version.o: Version.c $(COMMON_HDRS) Makefile

View File

@ -0,0 +1,141 @@
#
# NuFX archive manipulation library
# Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
# This is free software; you can redistribute it and/or modify it under the
# terms of the BSD License, see the file COPYING-LIB.
#
# Makefile for nufxlib (should work with non-GNU "make").
#
# You can use:
# make (builds library and sample applications)
# make shared (builds shared library if you're using GNU ld or similar)
#
# The shared library support currently leaves much to be desired.
#
# If you build with -DDEBUG_MSGS, nulib2 will be able to use the hidden
# 'g' command, which generates a verbose archive dump for debugging.
#
# NufxLib install location.
prefix = @prefix@
exec_prefix = @exec_prefix@
includedir = @includedir@
libdir = @libdir@
srcdir = @srcdir@
SHELL = @SHELL@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
CC = @CC@
AR = ar rcv
#OPT = @CFLAGS@ -DNDEBUG
OPT = @CFLAGS@
#OPT = @CFLAGS@ -DDEBUG_MSGS
#OPT = @CFLAGS@ -DDEBUG_VERBOSE
GCC_FLAGS = -Wall -Wwrite-strings -Wstrict-prototypes -Wpointer-arith -Wshadow
CFLAGS = @BUILD_FLAGS@ -I. @DEFS@ -DOPTFLAGSTR="\"$(OPT)\""
SRCS = Archive.c ArchiveIO.c Bzip2.c Charset.c Compress.c Crc16.c \
Debug.c Deferred.c Deflate.c Entry.c Expand.c FileIO.c Funnel.c \
Lzc.c Lzw.c MiscStuff.c MiscUtils.c Record.c SourceSink.c \
Squeeze.c Thread.c Value.c Version.c
OBJS = Archive.o ArchiveIO.o Bzip2.o Charset.o Compress.o Crc16.o \
Debug.o Deferred.o Deflate.o Entry.o Expand.o FileIO.o Funnel.o \
Lzc.o Lzw.o MiscStuff.o MiscUtils.o Record.o SourceSink.o \
Squeeze.o Thread.o Value.o Version.o
STATIC_PRODUCT = libnufx.a
SHARED_PRODUCT = libnufx.so
PRODUCT = $(STATIC_PRODUCT)
#
# Build stuff
#
all: $(PRODUCT) samples
@true
install: $(STATIC_PRODUCT)
$(srcdir)/mkinstalldirs $(libdir)
$(INSTALL_DATA) $(STATIC_PRODUCT) $(libdir)
$(srcdir)/mkinstalldirs $(includedir)
$(INSTALL_DATA) NufxLib.h $(includedir)
install-shared: $(SHARED_PRODUCT)
$(srcdir)/mkinstalldirs $(libdir)
$(INSTALL_DATA) $(SHARED_PRODUCT) $(libdir)
$(srcdir)/mkinstalldirs $(includedir)
$(INSTALL_DATA) NufxLib.h $(includedir)
samples::
@echo "Building samples..."
@(cd samples; set +e; unset CFLAGS OBJS; set -e; \
@SET_MAKE@ LIB_PRODUCT="../$(PRODUCT)" $(MAKE))
shared::
PRODUCT="$(SHARED_PRODUCT)" $(MAKE) -e
$(STATIC_PRODUCT): $(OBJS)
-rm -f $(STATIC_PRODUCT) $(SHARED_PRODUCT)
$(AR) $@ $(OBJS)
@RANLIB@ $@
# BUG: we need -fPIC, maybe -D_REENTRANT when compiling for this.
# BUG: for Linux we may want -Wl,-soname,libnufx.so.1 on the link line.
$(SHARED_PRODUCT): $(OBJS)
-rm -f $(STATIC_PRODUCT) $(SHARED_PRODUCT)
$(CC) @SHARE_FLAGS@ -o $@ $(OBJS) @LIBS@
clean:
(cd samples; make clean)
-rm -f *.o core
-rm -f $(SHARED_PRODUCT) $(STATIC_PRODUCT)
# build tags; assumes fancy GNU tag generation
tags::
@ctags -R --totals *
@#ctags *.[ch]
distclean: clean
(cd samples; make distclean)
-rm -f Makefile Makefile.bak
-rm -f config.log config.cache config.status config.h
-rm -f tags
# Make a tarfile with a backup of the essential files. We include "Makefile"
# so that we can do a "make distclean" during packaging.
baktar:
@tar cvf nufxlib.tar *.txt COPYING-LIB INSTALL configure *.in Makefile \
Makefile.msc Makefile.dll install-sh config.guess config.sub \
mkinstalldirs *.[ch] samples/*.txt samples/Makefile* samples/*.[ch]
@gzip -9 nufxlib.tar
@mv -i nufxlib.tar.gz /home/fadden/BAK/
# dependency info
COMMON_HDRS = NufxLibPriv.h NufxLib.h MiscStuff.h SysDefs.h
Archive.o: Archive.c $(COMMON_HDRS)
ArchiveIO.o: ArchiveIO.c $(COMMON_HDRS)
Bzip2.o: Bzip2.c $(COMMON_HDRS)
Charset.o: Charset.c $(COMMON_HDRS)
Compress.o: Compress.c $(COMMON_HDRS)
Crc16.o: Crc16.c $(COMMON_HDRS)
Debug.o: Debug.c $(COMMON_HDRS)
Deferred.o: Deferred.c $(COMMON_HDRS)
Deflate.o: Deflate.c $(COMMON_HDRS)
Entry.o: Entry.c $(COMMON_HDRS)
Expand.o: Expand.c $(COMMON_HDRS)
FileIO.o: FileIO.c $(COMMON_HDRS)
Funnel.o: Funnel.c $(COMMON_HDRS)
Lzc.o: Lzc.c $(COMMON_HDRS)
Lzw.o: Lzw.c $(COMMON_HDRS)
MiscStuff.o: MiscStuff.c $(COMMON_HDRS)
MiscUtils.o: MiscUtils.c $(COMMON_HDRS)
Record.o: Record.c $(COMMON_HDRS)
SourceSink.o: SourceSink.c $(COMMON_HDRS)
Squeeze.o: Squeeze.c $(COMMON_HDRS)
Thread.o: Thread.c $(COMMON_HDRS)
Value.o: Value.c $(COMMON_HDRS)
Version.o: Version.c $(COMMON_HDRS) Makefile

View File

@ -0,0 +1,160 @@
# Makefile for NufxLib using Microsoft Visual C++. This builds the library
# as a static lib and as a DLL, and builds all samples. The test-basic
# sample is built twice, once with the static lib, and once with the DLL.
#
# Tested with VS 2013 Pro. From the "VS2013 x86 Native Tools Command
# Prompt", run "nmake -f makefile.msc".
#
# If you're including zlib support, place copies of zlib.h, zconf.h,
# and the zlib library in this directory.
#
# Adapted from zlib's Makefile.msc.
#
TOP = .
STATICLIB = nufxlib2.lib
SHAREDLIB = nufxlib2.dll
IMPLIB = nufxdll.lib
CC = cl
LD = link
AR = lib
# C compiler flags
# -Fd: rename PDB file from "VCx0.pdb" (where 'x' is the version number);
# allows DLL debug info to be separate from app debug info
# -Ox: full optimization
# -Oy-: disable frame pointer omission (for easier debugging)
# -MD: create a multithreaded DLL using MSVCRT.lib; alternatively,
# use -MDd to create a debug executable with MSVCRTD.lib
# -nologo: suppress display of copyright banner
# -W3: set warning level to 3 (all production-level warnings)
# -Zi: generate a PDB file with full debugging info
#
# The OPTFLAGSTR define is used by Version.c to show how the library was
# built. Defining NUFXLIB_EXPORTS enables the __declspec(dllexport)
# macros that are required for creating the DLL.
OPTFLAGS = -Ox -Oy-
CFLAGS = -nologo -MD -W3 $(OPTFLAGS) -Zi -Fd"nufxlib"
LIB_CFLAGS = -DOPTFLAGSTR="\"$(OPTFLAGS)\"" #-DNUFXLIB_EXPORTS
# Warning suppression flags
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
# Linker flags
# -debug: creates debugging info for EXE or DLL in PDB file
# -incremental:no: disable incremental linking, making the resulting library
# a tad smaller
# -nologo: suppress display of copyright banner
# -opt:ref: eliminates unreferenced functions and data (default for non-debug
# builds, but we've enabled debug info)
LDFLAGS = -nologo -debug -incremental:no -opt:ref
# Library creator flags
ARFLAGS = -nologo
ZLIB=1
!ifdef ZLIB
# enable deflate support; requires zlib
CFLAGS = $(CFLAGS) -DENABLE_DEFLATE
LDFLAGS = $(LDFLAGS) zlib.lib
!endif
# object files
OBJS = Archive.obj ArchiveIO.obj Bzip2.obj Charset.obj Compress.obj \
Crc16.obj Debug.obj Deferred.obj Deflate.obj Entry.obj Expand.obj \
FileIO.obj Funnel.obj Lzc.obj Lzw.obj MiscStuff.obj MiscUtils.obj \
Record.obj SourceSink.obj Squeeze.obj Thread.obj Value.obj Version.obj
# build targets -- static library, dynamic library, and test programs
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
exerciser.exe imgconv.exe launder.exe test-basic.exe test-basic-d.exe \
test-extract.exe test-names.exe test-simple.exe test-twirl.exe
clean:
-del *.obj *.pdb *.exp
-del $(STATICLIB) $(SHAREDLIB) $(IMPLIB)
$(STATICLIB): $(OBJS)
$(AR) $(ARFLAGS) -out:$@ $(OBJS)
$(IMPLIB): $(SHAREDLIB)
$(SHAREDLIB): $(OBJS)
$(LD) $(LDFLAGS) -dll -def:nufxlib.def -implib:$(IMPLIB) -out:$@ \
$(OBJS)
exerciser.exe: Exerciser.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ Exerciser.obj $(STATICLIB)
imgconv.exe: ImgConv.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ ImgConv.obj $(STATICLIB)
launder.exe: Launder.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ Launder.obj $(STATICLIB)
test-basic.exe: TestBasic.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ TestBasic.obj $(STATICLIB)
test-basic-d.exe: TestBasic.obj $(IMPLIB)
$(LD) $(LDFLAGS) -out:$@ TestBasic.obj $(IMPLIB)
test-extract.exe: TestExtract.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ TestExtract.obj $(STATICLIB)
test-names.exe: TestNames.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ TestNames.obj $(STATICLIB)
test-simple.exe: TestSimple.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ TestSimple.obj $(STATICLIB)
test-twirl.exe: TestTwirl.obj $(STATICLIB)
$(LD) $(LDFLAGS) -out:$@ TestTwirl.obj $(STATICLIB)
# generic rules
{$(TOP)}.c.obj:
$(CC) -c $(WFLAGS) $(CFLAGS) $(LIB_CFLAGS) $<
{$(TOP)/samples}.c.obj:
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
# dependency info
COMMON_HDRS = NufxLibPriv.h NufxLib.h MiscStuff.h SysDefs.h
Archive.obj: Archive.c $(COMMON_HDRS)
ArchiveIO.obj: ArchiveIO.c $(COMMON_HDRS)
Bzip2.obj: Bzip2.c $(COMMON_HDRS)
Charset.obj: Charset.c $(COMMON_HDRS)
Compress.obj: Compress.c $(COMMON_HDRS)
Crc16.obj: Crc16.c $(COMMON_HDRS)
Debug.obj: Debug.c $(COMMON_HDRS)
Deferred.obj: Deferred.c $(COMMON_HDRS)
Deflate.obj: Deflate.c $(COMMON_HDRS)
Entry.obj: Entry.c $(COMMON_HDRS)
Expand.obj: Expand.c $(COMMON_HDRS)
FileIO.obj: FileIO.c $(COMMON_HDRS)
Funnel.obj: Funnel.c $(COMMON_HDRS)
Lzc.obj: Lzc.c $(COMMON_HDRS)
Lzw.obj: Lzw.c $(COMMON_HDRS)
MiscStuff.obj: MiscStuff.c $(COMMON_HDRS)
MiscUtils.obj: MiscUtils.c $(COMMON_HDRS)
Record.obj: Record.c $(COMMON_HDRS)
SourceSink.obj: SourceSink.c $(COMMON_HDRS)
Squeeze.obj: Squeeze.c $(COMMON_HDRS)
Thread.obj: Thread.c $(COMMON_HDRS)
Value.obj: Value.c $(COMMON_HDRS)
Version.obj: Version.c $(COMMON_HDRS)
Exerciser.obj: samples/Exerciser.c $(COMMON_HDRS)
ImgConv.obj: samples/ImgConv.c $(COMMON_HDRS)
Launder.obj: samples/Launder.c $(COMMON_HDRS)
TestBasic.obj: samples/TestBasic.c $(COMMON_HDRS)
TestExtract.obj: samples/TestExtract.c $(COMMON_HDRS)
TestNames.obj: samples/TestNames.c $(COMMON_HDRS)
TestSimple.obj: samples/TestSimple.c $(COMMON_HDRS)
TestTwirl.obj: samples/TestTwirl.c $(COMMON_HDRS)

339
ciderpress/nufxlib/NOTES.md Normal file
View File

@ -0,0 +1,339 @@
NufxLib NOTES
=============
Last revised: 2015/01/04
The interface is documented in "nufxlibapi.html", available from the
http://www.nulib.com/ web site. This discusses some of the internal
design that may be of interest.
Some familiarity with the NuFX file format is assumed.
- - -
### Read-Write Data Structures ###
For both read-only and read-write files (but not streaming read-only files),
the archive is represented internally as a linked list of Records, each
of which has an array of Threads attached. No attempt is made to
optimize searches by filename, so use of the "replace existing entry when
filenames match" option should be restricted to situations where it is
necessary. Otherwise, O(N^2) behavior can result.
Modifications, such as deletions, changes to filename threads, and
additions of new records, are queued up in a separate list until a NuFlush
call is issued. The list works much the same way as the temporary file:
when the operation completes, the "new" list becomes the "original" list.
If the operation is aborted, the "new" list is scrubbed, and the "original"
list remains unmodified.
Just as it is inefficient to write data to the temp file when it's not
necessary to do so, it is inefficient to allocate a complete copy of the
records from the original list if none are changed. As a result, there are
actually two "new" lists, one with a copy of the original record list, and
one with new additions. The "copy" list starts out uninitialized, and
remains that way until one of the entries from the original list is
modified. When that happens, the entire original list is duplicated, and
the changes are made directly to members of the "copy" list. (This is
important for really large archives, like a by-file archive with the
entire contents of a hard drive, where the record index could be several
megabytes in size.)
It would be more *memory* efficient to simply maintain a list of what
has changed. However, we can't disturb the "original" list in any way or
we lose the ability to roll back quickly if the operation is aborted.
Consequently, we need to create a new list of records that reflects
the state of the new archive, so that when we rename the temp file over
the original, we can simply "rename" the new record list over the original.
Since we're going to need the new list eventually, we might as well create
it as soon as it is needed, and deal with memory allocation failures up
front rather than during the update process. (Some items, such as the
record's file offset in the archive, have to be updated even for records
that aren't themselves changing... which means we potentially need to
modify all existing record structures, so we need a complete copy of the
record list regardless of how little or how much has changed.)
This also ties into the "modify original archive file directly if possible"
option, which avoids the need for creating and renaming a temp file. If
the only changes are updates to pre-sized records (e.g. renaming a file
inside the archive, or updating a comment), or adding new records onto the
end, there is little risk and possibly a huge efficiency gain in just
modifying the archive in place. If none of the operations caused the
"copy" list to be initialized, then clearly there's no need to write to a
temp file. (It's not actually this simple, because updates to pre-sized
threads are annotated in the "copy" list.)
One of the goals was to be able to execute a sequence of operations like:
open original archive
read original archive
modify archive
flush (success)
modify archive
flush (failure, rollback)
modify archive
flush (success)
close archive
The archive is opened at the start and held open across many operations.
There is never a need to re-read the entire archive. We could avoid the
need to allocate two complete Record lists by requiring that the archive be
re-scanned after changes are aborted; if we did that, we could just modify
the original record list in place, and let the changes become "permanent"
after a successful write. In many ways, though, its cleaner to have two
lists.
Archives with several thousand entries should be sufficiently rare, and
virtual memory should be sufficiently plentiful, that this won't be a
problem for anyone. Scanning repeatedly through a 15MB archive stored on a
CD-ROM is likely to be very annoying though, so the design makes every
attempt to avoid repeated scans of the archive. And in any event, this
only applies to archive updates. The memory requirements for simple file
extraction are minimal.
In summary:
- "orig" list has original set of records, and is not disturbed until
the changes are committed.
- "copy" list is created on first add/update/delete operation, and
initially contains a complete copy of "orig".
- "new" list contains all new additions to the archive, including
new additions that replace existing entries (the existing entry
is deleted from "copy" and then added to "new").
Each Record in the list has a "thread modification" list attached to it.
Any changes to the record header or additions to the thread mod list are
made in the "copy" set; the "original" set remains untouched. The thread
mod list can have the following items in it:
- delete thread (NuThreadIdx)
- add thread (type, otherSize, format, +contents)
- update pre-sized thread (NuThreadIdx, +contents)
Contents are specified with a NuDataSource, which allows the application
to indicate that the data is already compressed. This is useful for
copying parts of records between archives without having to expand and
recompress the data.
Some interactions and concepts that are important to understand:
When a file is added, the file type information will be placed in the
"new" Record immediately (subject to some restrictions: adding a data
fork always causes the type info to be updated, adding a rsrc fork only
updates the type info if a data fork is not already present).
Deleting a record results in the Record being removed from the "copy"
list immediately. Future modify operations on that NuRecordIdx will
fail. Future read operations will work just fine until the next
NuFlush is issued, because read operations use the "original" list.
Deleting all threads from a record results in the record being
deleted, but not until the NuFlush call is issued. It is possible to
delete all the existing threads and then add new ones.
It is *not* allowed to delete a modified thread, modify a deleted thread,
or delete a record that has been modified. This limitation was added to
keep the system simple. Note this does not mean you can't delete a data
fork and add a data fork; doing so results in operations on two threads
with different NuThreadIdx values. What you can't do is update the
filename thread and then delete it, or vice-versa. (If anyone can think
of a reason why you'd want to rename a file and then delete it with the
same NuFlush call, I'll figure out a way to support it.)
Updating a filename thread is intercepted, and causes the Record's
filename cache to be updated as well. Adding a filename thread for
records where the filename is stored in the record itself cause the
"in-record" filename to be zeroed. Adding a filename thread to a
record that already has one isn't allowed; nufxlib restricts you to
a single filename thread per record.
Some actions on an archive are allowed but strongly discouraged. For
example, deleting a filename thread but leaving the data threads behind
is a valid thing to do, but leaves most archivers in a state of mild
confusion. Deleting the data threads but leaving the filename thread is
similarly perplexing.
You can't call "update thread" on a thread that doesn't yet exist,
even if an "add thread" call has been made. You can, however, call
"add thread" on a newly created Record.
When a new record is created because of a "create record" call, a filename
thread is created automatically. It is not necessary to explicitly add the
filename.
Failures encountered while committing changes to a record cause all
operations on that record to be rolled back. If, during a NuFlush, a
file add fails, the user is given the option of aborting the entire
operation or skipping the file in question (and perhaps retrying or other
options as well). Aborting the flush causes a complete rollback. If only
the thread mod operation is canceled, then all thread mods for that record
are ignored. The temp file (or archive file) will have its file pointer
reset to the original start of the record, and if the record already
existed in the original archive, the full original record will be copied
over. This may seem drastic, but it helps ensure that you don't end up
with a record in a partially created state.
If a failure occurs during an "update in place", it isn't possible to
roll back all changes. If the failure was due to a bug in NufxLib, it
is possible that the archive could be unrecoverably damaged. NufxLib
tries to identify such situations, and will leave the archive open in
read-only mode after rolling back any new file additions.
- - -
### Updating Filenames ###
Updating filenames is a small nightmare, because the filename can be
either in the record header or in a filename thread. It's possible,
but illogical, to have a single record with a filename in the record
header and two or more filenames in threads.
NufxLib will not automatically "fix" broken records, but it will prevent
applications from creating situations that should not exist.
- When reading an archive, NufxLib will use the filename from the
first filename thread found. If no filename threads are found, the
filename from the record header will be used.
- If you add a filename thread to a record that has a filename in the
record header, the header name will be removed.
- If you update a filename thread in a record that has a filename in
the record header, the header name will be left untouched.
- Adding a filename thread is only allowed if no filename thread exists,
or all existing filename threads have been deleted.
- - -
### Unicode Filenames ###
Modern operating systems support filenames with a broader range of
characters than the Apple II did. This presents problems and opportunities.
#### Background ####
The Apple IIgs and old Macintoshes use the Mac OS Roman ("MOR") character
set. This defines a set of characters outside the ASCII range, i.e.
byte values with the high bit set. In addition to the usual collection
of vowels with accents and umlauts, MOR has some less-common characters,
including the Apple logo.
On Windows, the high-ASCII values are generally interpreted according
to Windows Code Page 1252 ("CP-1252"), which defines a similar set
of vowels with accents and miscellaneous symbols. MOR and CP-1252
have some overlap, but you can't really translate one into the other.
The standards-approved equivalent of CP-1252 is ISO-8859-1, though
according to [wikipedia](http://en.wikipedia.org/wiki/Windows-1252)
there was some confusion between the two.
Modern operating systems support the Unicode Universal Character Set.
This system allows for a very large number of characters (over a million),
and includes definitions for all of the symbols in MOR and CP-1252.
Each character is assigned a "code point", which is a numeric value between
zero and 0x10FFFF. Most of the characters used in modern languages can
be found in the Basic Multilingual Plane (BMP), which uses code points
between zero and 0xFFFF (requiring only 16 bits).
There are different ways of encoding code points. Consider, for example,
Unicode LATIN SMALL LETTER A WITH ACUTE:
MOR: 0x87
CP-1252: 0xE1
Unicode: U+00E1
UTF-16: 0x00E1
UTF-8: 0xC3 0xA1
Or the humble TRADE MARK SIGN:
MOR: 0xAA
CP-1252: 0x99
Unicode: U+2122
UTF-16: 0x2122
UTF-8: 0xE2 0x84 0xA2
Modern Linux and Mac OS X use UTF-8 encoding in filenames. Because it's a
byte-oriented encoding, and 7-bit ASCII values are trivially represented
as 7-bit ASCII values, all of the existing system and library calls work
as they did before (i.e. if they took a `char*`, they still do).
Windows uses UTF-16, which requires at least 16 bits per code point.
Filenames are now "wide" strings, based on `wchar_t*`. Windows includes
an elaborate system of defines based around the `TCHAR` type, which can
be either `char` or `wchar_t` depending on whether a program is compiled
with `_MBCS` (Multi-Byte Character System) or `_UNICODE`. A set of
preprocessor definitions is provided that will map I/O function names,
so you can call `_tfopen(TCHAR* ...)`, and the compiler will turn it into
either `fopen(char* ...)` or `_wfopen(wchar_t* ...)`. MBCS is deprecated
in favor of Unicode, so any new code should be strictly UTF-16 based.
This means that, for code to work on both Linux and Windows, it has to
work with incompatible filename string types and different I/O functions.
#### Opening Archive Files ####
On Linux and Mac OS X, NuLib2 can open any file named on the command line.
On Windows, it's a bit trickier.
The problem is that NuLib2 provides a `main()` function that is passed a
vector of "narrow" strings. The filenames provided on the command line
will be converted from wide to narrow, so unless the filename is entirely
composed of ASCII or CP-1252 characters, some information will be lost
and it will be impossible to open the file.
NuLib2 must instead provide a `wmain()` function that takes wide strings.
The strings must be stored and passed around as wide throughout the
program, and passed into NufxLib this way (because NufxLib issues the
actual _wopen call). This means that NufxLib API must take narrow strings
when built for Linux, and wide strings when built for Windows.
#### Adding/Extracting Mac OS Roman Files ####
GS/ShrinkIt was designed to handle GS/OS files from HFS volumes, so NuFX
archive filenames use the MOR character set. To preserve the encoding
we could simply extract the values as-is and let them appear as whatever
values happen to line up in CP-1252, which is what pre-3.0 NuLib2 did.
It's much nicer to translate from MOR to Unicode when extracting, and
convert back from Unicode to MOR when adding files to an archive.
The key consideration is that the character set associated with a
filename must be tracked. The code can't simply extract a filename from
the archive and pass it to a 'creat()` call. Character set conversions
must take place at appropriate times.
With Windows it's a bit harder to confuse MOR and Unicode names, because
one uses 8-bit characters and the other uses UTF-16, but the compiler
doesn't catch everything.
#### Current State ####
NufxLib defines the UNICHAR type, which has a role very like TCHAR:
it can be `char*` or `wchar_t*`, and can be accompanied by a set of
preprocessor mappings that switch between I/O functions. The UNICHAR
type will be determined based on a define provided from the compiler
command line (perhaps `-DUSE_UTF16_FILENAMES`).
The current version of NufxLib (v3.0.0) takes the first step, defining
all filename strings as either UNICHAR or MOR, and converting between them
as necessary. This, plus a few minor tweaks to NuLib2, was enough to
get Unicode filename support working on Linux and Mac OS X.
None of the work needed to make Windows work properly has been done.
The string conversion functions are no-ops for Win32. As a result,
NuLib2 for Windows treats filenames the same way in 3.x as it did in 2.x.
There are some situations where things can go awry even with UNICHAR,
most notably printf-style arguments. These are checked by gcc, but
not by Visual Studio unless you run the static analyzer. A simple
`printf("filename=%s\n", filename)` would be correct for narrow strings
but wrong for wide strings. It will likely be necessary to define a
filename format string (similar to `PRI64d` for 64-bit values) and switch
between "%s" and "%ls".
This is a fair bit of work and requires some amount of uglification to
NuLib2 and NufxLib. Since Windows users can use CiderPress, and the
vast majority of NuFX archives use ASCII-only ProDOS file names, it's
not clear that the effort would be worthwhile.

View File

@ -0,0 +1,119 @@
NufxLib README, updated 2014/12/23
http://www.nulib.com/
See "COPYING-LIB" for distribution restrictions.
UNIX
====
Run the "configure" script. Read through "INSTALL" if you haven't used
one of these before, especially if you want to use a specific compiler
or a particular set of compiler flags.
You can disable specific compression methods with "--disable-METHOD"
(run "sh ./configure --help" to see the possible options). By default,
all methods are enabled except bzip2.
Run "make depend" if you have makedepend, and then type "make". This will
build the library and all of the programs in the "samples" directory.
There are some useful programs in "samples", described in a README.txt
file there. In particular, you should run samples/test-basic to verify
that things are more or less working.
If you want to install the library and header file into standard system
locations (usually /usr/local), run "make install". To learn how to
specify different locations, read the INSTALL document.
There are some flags in "OPT" you may want to use. The "autoconf" default
for @CFLAGS@ is "-g -O2".
-DNDEBUG
Disable assert() calls and extra tests. This will speed things up,
but errors won't get caught until later on, making the root cause
harder to locate.
-DDEBUG_MSGS
Enable debug messages. This increases the size of the executable,
but shouldn't affect performance. When errors occur, more output is
produced. The "debug dump" feature is enabled by this flag.
-DDEBUG_VERBOSE
(Implicitly sets DEBUG_MSGS.) Spray lots of debugging output.
If you want to do benchmarks, use "-O2 -DNDEBUG". The recommended
configuration is "-g -O2 -DDEBUG_MSGS", so that verbose debug output is
available when errors occur.
BeOS
====
This works just like the UNIX version, but certain defaults have been
changed. Running configure without arguments under BeOS is equivalent to:
./configure --prefix=/boot --includedir='${prefix}/develop/headers'
--libdir='${exec_prefix}/home/config/lib' --mandir='/tmp'
--bindir='${exec_prefix}/home/config/bin'
If you're using BeOS/PPC, it will also do:
CC=cc CFLAGS='-proc 603 -opt full'
Mac OS X
========
This works just like the UNIX version, but includes support for resource
forks and Finder file/aux types.
Tested with Xcode v5.1.1 and Mac OS 10.8.5.
Win32
=====
If you're using an environment that supports "configure" scripts, such as
DJGPP, follow the UNIX instructions.
NufxLib has been tested with Microsoft Visual C++ 12 (Visual Studio 2013).
To build NufxLib, run the "Visual Studio 2013 x86 Native Tools Command
Prompt" shortcut to get a shell. Change to the nufxlib directory, then:
nmake -f makefile.msc
When the build finishes, run "test-basic.exe" to confirm things are working.
If you want to have zlib support enabled, you will need to have zlib.h,
zconf.h, and zlib.lib copied into the directory. See "makefile.msc" for
more details.
The makefile builds NufxLib as a static library and as a DLL.
Other Notes
===========
If you want to use the library in a multithreaded application, you should
define "USE_REENTRANT_CALLS" to tell it to use reentrant versions of
certain library calls. This defines _REENTRANT, which causes Solaris to
add the appropriate goodies. (Seems to me you'd always want this on, but
for some reason Solaris makes you take an extra step, so I'm not going to
define it by default.)
Originally, NufxLib / NuLib2 were intended to be usable natively on the
Apple IIgs, so some of the design decisions were influenced by the need
to minimize memory usage (e.g. being able to get a directory listing
without holding the entire directory in memory) and interact with GS/OS
(forked files have a single filename, files have type/auxtype). The IIgs
port was never started.
Legalese
========
NufxLib, a NuFX archive manipulation library.
Copyright (C) 2000-2014 by Andy McFadden, All Rights Reserved.
See COPYING for license.

View File

@ -72,40 +72,6 @@
# define vsnprintf _vsnprintf
# endif
#else
# ifndef HAVE_CONFIG_H
# define HAVE_FCNTL_H
# define HAVE_MALLOC_H
# define HAVE_STDLIB_H
# define HAVE_SYS_STAT_H
# undef HAVE_SYS_TIME_H
# define HAVE_SYS_TYPES_H
# define HAVE_UNISTD_H
# define HAVE_UTIME_H
# undef HAVE_SYS_UTIME_H
# define HAVE_FDOPEN
# undef HAVE_FTRUNCATE
# define HAVE_MEMMOVE
# undef HAVE_MKSTEMP
# define HAVE_MKTIME
# define HAVE_SNPRINTF
# undef HAVE_STRCASECMP
# undef HAVE_STRNCASECMP
# define HAVE_STRERROR
# define HAVE_STRTOUL
# define HAVE_VSNPRINTF
# define SNPRINTF_DECLARED
# define VSNPRINTF_DECLARED
# define SPRINTF_RETURNS_INT
# define inline /*Visual C++6.0 can't inline ".c" files*/
# define ENABLE_SQ
# define ENABLE_LZW
# define ENABLE_LZC
/*# define ENABLE_DEFLATE*/
/*# define ENABLE_BZIP2*/
# endif
#endif
#ifdef HAVE_MALLOC_H

1466
ciderpress/nufxlib/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,134 @@
/*
* NuFX archive manipulation library
* Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
* This is free software; you can redistribute it and/or modify it under the
* terms of the BSD License, see the file COPYING-LIB.
*/
/* config.h.in. */
/* Define to empty if the keyword does not work. */
#undef const
/* Define to empty if the keyword does not work. */
#undef inline
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the fdopen function. */
#undef HAVE_FDOPEN
/* Define if you have the ftruncate function. */
#undef HAVE_FTRUNCATE
/* Define if you have the localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the mkdir function. */
#undef HAVE_MKDIR
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the snprintf function. */
#undef HAVE_SNPRINTF
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strncasecmp function. */
#undef HAVE_STRNCASECMP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strtoul function. */
#undef HAVE_STRTOUL
/* Define if you have the timelocal function. */
#undef HAVE_TIMELOCAL
/* Define if you have the vsnprintf function. */
#undef HAVE_VSNPRINTF
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <sys/utime.h> header file. */
#undef HAVE_SYS_UTIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define if sprintf returns an int. */
#undef SPRINTF_RETURNS_INT
/* Define if SNPRINTF is declared in stdio.h. */
#undef SNPRINTF_DECLARED
/* Define if VSNPRINTF is declared in stdio.h. */
#undef VSNPRINTF_DECLARED
/* Define to include SQ (Huffman+RLE) compression. */
#undef ENABLE_SQ
/* Define to include LZW (ShrinkIt LZW/1 and LZW/2) compression. */
#undef ENABLE_LZW
/* Define to include LZC (12-bit and 16-bit UNIX "compress") compression. */
#undef ENABLE_LZC
/* Define to include deflate (zlib) compression (also need -l in Makefile). */
#undef ENABLE_DEFLATE
/* Define to include bzip2 (libbz2) compression (also need -l in Makefile). */
#undef ENABLE_BZIP2
/* Define if we want to use the dmalloc library (also need -l in Makefile). */
#undef USE_DMALLOC

1579
ciderpress/nufxlib/config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

5503
ciderpress/nufxlib/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,218 @@
dnl NuFX archive manipulation library
dnl Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
dnl This is free software; you can redistribute it and/or modify it under the
dnl terms of the BSD License, see the file COPYING-LIB.
dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(NufxLibPriv.h)
AC_CONFIG_HEADER(config.h)
dnl Checks for programs.
AC_CANONICAL_HOST
dnl AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
dnl Checks for header files.
AC_CHECK_HEADERS(fcntl.h malloc.h stdlib.h sys/stat.h sys/time.h sys/types.h \
sys/utime.h unistd.h utime.h)
LIBS=""
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
dnl Checks for library functions.
AC_CHECK_FUNCS(fdopen ftruncate memmove mkdir mkstemp mktime timelocal \
localtime_r snprintf strcasecmp strncasecmp strtoul strerror vsnprintf)
dnl Kent says: snprintf doesn't always have a declaration
AC_MSG_CHECKING(if snprintf is declared)
AC_CACHE_VAL(nufxlib_cv_snprintf_in_header, [
AC_EGREP_HEADER(snprintf, stdio.h,
[nufxlib_cv_snprintf_in_header=yes],
[nufxlib_cv_snprintf_in_header=no])
])
if test $nufxlib_cv_snprintf_in_header = "yes"; then
AC_DEFINE(SNPRINTF_DECLARED)
fi
AC_MSG_RESULT($nufxlib_cv_snprintf_in_header)
dnl Kent says: vsnprintf doesn't always have a declaration
AC_MSG_CHECKING(if vsnprintf is declared)
AC_CACHE_VAL(nufxlib_cv_vsnprintf_in_header, [
AC_EGREP_HEADER(vsnprintf, stdio.h,
[nufxlib_cv_vsnprintf_in_header=yes],
[nufxlib_cv_vsnprintf_in_header=no])
])
if test $nufxlib_cv_vsnprintf_in_header = "yes"; then
AC_DEFINE(VSNPRINTF_DECLARED)
fi
AC_MSG_RESULT($nufxlib_cv_vsnprintf_in_header)
dnl if we're using gcc, include gcc-specific warning flags
if test -z "$GCC"; then
BUILD_FLAGS='$(OPT)'
else
BUILD_FLAGS='$(OPT) $(GCC_FLAGS)'
fi
dnl ---------------------------------------------------------------------------
dnl Some host-specific stuff. Variables you can test (set by the
dnl AC_CANONICAL_HOST call earlier) look like this:
dnl
dnl $host = i686-pc-linux-gnu
dnl $host_cpu = i686
dnl $host_vendor = pc
dnl $host_os = linux-gnu
dnl Figure out what the build and link flags should be; different for BeOS.
dnl (Should really use the auto-shared-lib stuff, but that adds a whole
dnl bunch of stuff.)
SHARE_FLAGS='-shared'
if test "$host_cpu" = "powerpc" -a "$host_os" = "beos"; then
dnl BeOS/PPC, with Metrowerks compiler
CC=cc
GCC=
CFLAGS='-proc 603 -opt full'
SHARE_FLAGS='-shared -nostdlib'
echo "forcing CC to \"$CC\" and CFLAGS to \"$CFLAGS\""
elif test "$host_os" = "beos"; then
dnl BeOS/x86
SHARE_FLAGS='-nostartfiles -Xlinker -soname="$@"'
fi
AC_SUBST(BUILD_FLAGS)
AC_SUBST(SHARE_FLAGS)
dnl BeOS doesn't like /usr/local/include, and gets feisty about it. If libdir
dnl and includedir are set to defaults, replace them with BeOS values. This
dnl might be going a little too far...
if test "$host_os" = "beos"; then
if test "$prefix" = "NONE" -a \
"$includedir" = '${prefix}/include' -a \
"$libdir" = '${exec_prefix}/lib' -a \
"$bindir" = '${exec_prefix}/bin' -a \
"$mandir" = '${prefix}/man'
then
echo replacing install locations with BeOS values
prefix=/boot
includedir='${prefix}/develop/headers'
libdir='${exec_prefix}/home/config/lib'
bindir='${exec_prefix}/home/config/bin'
mandir='/tmp'
AC_SUBST(prefix)
AC_SUBST(includedir)
AC_SUBST(libdir)
AC_SUBST(bindir)
AC_SUBST(mandir)
fi
fi
dnl Test to see if sprintf does something reasonable. I'm going to assume
dnl that vsprintf and (if available) vsnprintf return the same thing.
AC_MSG_CHECKING(if sprintf returns int)
AC_CACHE_VAL(nufxlib_cv_sprintf_returns_int, [
AC_TRY_RUN([
#include <stdio.h>
int main(void)
{
int count;
char buf[8];
count = sprintf(buf, "123"); /* should return three */
exit(count != 3);
}
],
[nufxlib_cv_sprintf_returns_int=yes], [nufxlib_cv_sprintf_returns_int=no],
[nufxlib_cv_sprintf_returns_int=no])
])
if test $nufxlib_cv_sprintf_returns_int = "yes"; then
AC_DEFINE(SPRINTF_RETURNS_INT)
fi
AC_MSG_RESULT($nufxlib_cv_sprintf_returns_int)
dnl
dnl Allow selective disabling of compression algorithms. By default,
dnl all are enabled. We do a little extra work for libz and libbz2
dnl because they're not built in.
dnl
dnl If we're creating a shared library, we need to explicitly link
dnl against libz and/or libbz2 when those features are enabled.
dnl
AC_ARG_ENABLE(sq,
[ --disable-sq disable SQ compression],
[ ], [ enable_sq=yes ])
if test $enable_sq = "yes"; then
AC_DEFINE(ENABLE_SQ)
fi
AC_ARG_ENABLE(lzw,
[ --disable-lzw disable LZW/1 and LZW/2 compression],
[ ], [ enable_lzw=yes ])
if test $enable_lzw = "yes"; then
AC_DEFINE(ENABLE_LZW)
fi
AC_ARG_ENABLE(lzc,
[ --disable-lzc disable 12- and 16-bit LZC compression],
[ ], [ enable_lzc=yes ])
if test $enable_lzc = "yes"; then
AC_DEFINE(ENABLE_LZC)
fi
AC_ARG_ENABLE(deflate,
[ --disable-deflate disable zlib deflate compression],
[ ], [ enable_deflate=yes ])
if test $enable_deflate = "yes"; then
dnl Check for zlib. Make sure it comes with zlib.h.
got_zlibh=false
AC_CHECK_LIB(z, deflate, got_libz=true, got_libz=false)
if $got_libz; then
AC_CHECK_HEADER(zlib.h, got_zlibh=true LIBS="$LIBS -lz")
fi
if $got_zlibh; then
echo " (found libz and zlib.h, enabling deflate)"
AC_DEFINE(ENABLE_DEFLATE)
else
echo " (couldn't find libz and zlib.h, not enabling deflate)"
fi
fi
AC_ARG_ENABLE(bzip2,
[ --enable-bzip2 enable libbz2 bzip2 compression],
[ ], [ enable_bzip2=no ])
if test $enable_bzip2 = "yes"; then
dnl Check for libbz2. Make sure it comes with bzlib.h.
dnl AC_CHECK_LIB(bz2, BZ2_bzCompress,
dnl AC_CHECK_HEADER(bzlib.h, AC_DEFINE(ENABLE_BZIP2) LIBS="$LIBS -lbz2"))
got_bzlibh=false
AC_CHECK_LIB(bz2, BZ2_bzCompress, got_libbz=true, got_libbz=false)
if $got_libbz; then
AC_CHECK_HEADER(bzlib.h, got_bzlibh=true LIBS="$LIBS -lbz2")
fi
if $got_bzlibh; then
echo " (found libbz2 and bzlib.h, enabling bzip2)"
AC_DEFINE(ENABLE_BZIP2)
else
echo " (couldn't find libbz2 and bzlib.h, not enabling bzip2)"
fi
fi
AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc do dmalloc stuff],
[ echo "--- enabling dmalloc";
LIBS="$LIBS -L/usr/local/lib -ldmalloc"; AC_DEFINE(USE_DMALLOC) ])
AC_OUTPUT(Makefile samples/Makefile)

View File

@ -0,0 +1,69 @@
; NufxLib library exported symbols
;
; This is redundant with the __declspec(dllexport) declarations enabled
; with the NUFXLIB_EXPORTS symbol. If we're just building a DLL, there's
; no need for this file. However, the objects we're building are used for
; both the static library and the dynamic library, and we don't want to
; have exports in the static library. If we do, the linker will create
; .lib and .exp files for every executable we link against it. This is
; mostly harmless, but a tad messy. I don't expect the interface to change,
; so there's not much of a maintenance burden here.
;
EXPORTS
NuAbort
NuAddFile
NuAddRecord
NuAddThread
NuClose
NuContents
NuConvertMORToUNI
NuConvertUNIToMOR
NuCreateDataSinkForBuffer
NuCreateDataSinkForFP
NuCreateDataSinkForFile
NuCreateDataSourceForBuffer
NuCreateDataSourceForFP
NuCreateDataSourceForFile
NuDataSinkGetOutCount
NuDataSourceSetRawCrc
NuDebugDumpArchive
NuDelete
NuDeleteRecord
NuDeleteThread
NuExtract
NuExtractRecord
NuExtractThread
NuFlush
NuFreeDataSink
NuFreeDataSource
NuGetAttr
NuGetExtraData
NuGetMasterHeader
NuGetRecord
NuGetRecordIdxByName
NuGetRecordIdxByPosition
NuGetValue
NuGetVersion
NuIsPresizedThreadID
NuOpenRO
NuOpenRW
NuRecordCopyAttr
NuRecordCopyThreads
NuRecordGetNumThreads
NuRename
NuSetErrorHandler
NuSetErrorMessageHandler
NuSetExtraData
NuSetGlobalErrorMessageHandler
NuSetOutputPathnameFilter
NuSetProgressUpdater
NuSetRecordAttr
NuSetSelectionFilter
NuSetValue
NuStrError
NuStreamOpenRO
NuTest
NuTestFeature
NuTestRecord
NuThreadGetByIdx
NuUpdatePresizedThread

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C48AE53B-3DCB-43B1-9207-B7C5B6BB78AF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>nufxlib</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />