Skip to content

Commit

Permalink
Add CMake support
Browse files Browse the repository at this point in the history
Adds CMake tooling for libmspack to the project.
This attempts to replicate every feature available in the autotools
tooling and includes support for building on Windows.

Adds a mspack-version.h header file, generated from mspack-version.h.in.
mspack-version.h is to be installed alongside mspack.h so that application
developers can use the version numbers and strings in the event that the API
is modified and the application must maintain backwards compatibility.

Adds error handling to autogen.sh.

Reformats libmspack's README as Markdown.

Adds mspack_error_msg() and MSPACK_ERROR() macro to mspack.h API.
The new API is a cross between the cab_error() function previously found
in cabextract and error_msg() found in test/error.h.  This removes the
need the examples to depend on test/error.h, a header not exported by
any build target, and removes the code duplication with cabextract.

Fixes __func__ macro for Windows.
  • Loading branch information
micahsnyder committed Jun 7, 2020
1 parent 7e63519 commit 11f1f14
Show file tree
Hide file tree
Showing 79 changed files with 2,614 additions and 212 deletions.
6 changes: 5 additions & 1 deletion cabextract/autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
# Runs the autoreconf tool, creating the configure script

autoreconf -i -W all
echo you can now run ./configure
rc=$?; if [[ $rc != 0 ]]; then
echo "Error: Failed to generate autojunk!"; exit $rc
else
echo "You can now run ./configure"
fi
2 changes: 1 addition & 1 deletion cabextract/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#endif

#ifdef HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#endif

#if !defined __STDC__ || !__STDC__
Expand Down
2 changes: 1 addition & 1 deletion cabextract/getopt1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Boston, MA 02111-1307, USA. */

#ifdef HAVE_CONFIG_H
#include <config.h>
#include "config.h"
#endif

#include "getopt.h"
Expand Down
4 changes: 2 additions & 2 deletions cabextract/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */

#ifdef HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#endif

#include <sys/types.h>
#include <stdlib.h>
#include <string.h>

#include <md5.h>
#include "md5.h"

#ifdef _LIBC
# include <endian.h>
Expand Down
11 changes: 7 additions & 4 deletions cabextract/src/cabextract.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define _GNU_SOURCE 1

#if HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#endif

#include <sys/types.h>
Expand Down Expand Up @@ -76,8 +76,12 @@

#include "getopt.h"

#include <mspack.h>
#include <md5.h>
#include "mspack.h"
#include "md5.h"

#if !defined(S_ISDIR)
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif

/* structures and global variables */
struct option optlist[] = {
Expand Down Expand Up @@ -184,7 +188,6 @@ static void forget_files(struct file_mem **fml);
static void add_filter(char *arg);
static void free_filters();
static int ensure_filepath(char *path);
static char *cab_error(struct mscab_decompressor *cd);

static struct mspack_file *cabx_open(struct mspack_system *this,
const char *filename, int mode);
Expand Down
2 changes: 1 addition & 1 deletion cabextract/src/cabinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

#ifdef HAVE_CONFIG_H
# include <config.h>
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
Expand Down
116 changes: 97 additions & 19 deletions libmspack/.gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,100 @@
# Logs
*.log

# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake

# http://www.gnu.org/software/automake
.deps
.dirstamp
.libs
INSTALL
/Makefile
Makefile.in
aclocal.m4
ar-lib
/ar-lib
/mdate-sh
/py-compile
/test-driver
/ylwrap

# http://www.gnu.org/software/autoconf
autom4te.cache
compile
config.*
configure
depcomp
install-sh
lib*.la
libmspack-*.tar.gz
libmspack.pc
libtool
ltmain.sh
m4
missing
stamp-h1
test-driver
test-suite.log
/autoscan.log
/autoscan-*.log
/aclocal.m4
/compile
/config.guess
/config.h.in
/config.log
/config.status
/config.sub
/configure
/configure.scan
/depcomp
/install-sh
/missing
/stamp-h1

# https://www.gnu.org/software/libtool/
/ltmain.sh

# http://www.gnu.org/software/texinfo
/texinfo.tex

# http://www.gnu.org/software/m4/
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
Loading

0 comments on commit 11f1f14

Please sign in to comment.