Skip to content

Commit 11f1f14

Browse files
committed
Add CMake support
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.
1 parent 7e63519 commit 11f1f14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2614
-212
lines changed

cabextract/autogen.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
# Runs the autoreconf tool, creating the configure script
33

44
autoreconf -i -W all
5-
echo you can now run ./configure
5+
rc=$?; if [[ $rc != 0 ]]; then
6+
echo "Error: Failed to generate autojunk!"; exit $rc
7+
else
8+
echo "You can now run ./configure"
9+
fi

cabextract/getopt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#endif
2929

3030
#ifdef HAVE_CONFIG_H
31-
# include <config.h>
31+
# include "config.h"
3232
#endif
3333

3434
#if !defined __STDC__ || !__STDC__

cabextract/getopt1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
Boston, MA 02111-1307, USA. */
2020

2121
#ifdef HAVE_CONFIG_H
22-
#include <config.h>
22+
#include "config.h"
2323
#endif
2424

2525
#include "getopt.h"

cabextract/md5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
/* Written by Ulrich Drepper <[email protected]>, 1995. */
2222

2323
#ifdef HAVE_CONFIG_H
24-
# include <config.h>
24+
# include "config.h"
2525
#endif
2626

2727
#include <sys/types.h>
2828
#include <stdlib.h>
2929
#include <string.h>
3030

31-
#include <md5.h>
31+
#include "md5.h"
3232

3333
#ifdef _LIBC
3434
# include <endian.h>

cabextract/src/cabextract.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define _GNU_SOURCE 1
2424

2525
#if HAVE_CONFIG_H
26-
# include <config.h>
26+
# include "config.h"
2727
#endif
2828

2929
#include <sys/types.h>
@@ -76,8 +76,12 @@
7676

7777
#include "getopt.h"
7878

79-
#include <mspack.h>
80-
#include <md5.h>
79+
#include "mspack.h"
80+
#include "md5.h"
81+
82+
#if !defined(S_ISDIR)
83+
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
84+
#endif
8185

8286
/* structures and global variables */
8387
struct option optlist[] = {
@@ -184,7 +188,6 @@ static void forget_files(struct file_mem **fml);
184188
static void add_filter(char *arg);
185189
static void free_filters();
186190
static int ensure_filepath(char *path);
187-
static char *cab_error(struct mscab_decompressor *cd);
188191

189192
static struct mspack_file *cabx_open(struct mspack_system *this,
190193
const char *filename, int mode);

cabextract/src/cabinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
#ifdef HAVE_CONFIG_H
20-
# include <config.h>
20+
# include "config.h"
2121
#endif
2222
#include <stdio.h>
2323
#include <stdlib.h>

libmspack/.gitignore

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,100 @@
1+
# Logs
2+
*.log
3+
4+
# Prerequisites
5+
*.d
6+
7+
# Object files
8+
*.o
9+
*.ko
10+
*.obj
11+
*.elf
12+
13+
# Linker output
14+
*.ilk
15+
*.map
16+
*.exp
17+
18+
# Precompiled Headers
19+
*.gch
20+
*.pch
21+
22+
# Libraries
23+
*.lib
24+
*.a
25+
*.la
26+
*.lo
27+
28+
# Shared objects (inc. Windows DLLs)
29+
*.dll
30+
*.so
31+
*.so.*
32+
*.dylib
33+
34+
# Executables
35+
*.exe
36+
*.out
37+
*.app
38+
*.i*86
39+
*.x86_64
40+
*.hex
41+
42+
# Debug files
43+
*.dSYM/
44+
*.su
45+
*.idb
46+
*.pdb
47+
48+
# CMake
49+
CMakeLists.txt.user
50+
CMakeCache.txt
51+
CMakeFiles
52+
CMakeScripts
53+
Testing
54+
Makefile
55+
cmake_install.cmake
56+
install_manifest.txt
57+
compile_commands.json
58+
CTestTestfile.cmake
59+
60+
# http://www.gnu.org/software/automake
61+
.deps
62+
.dirstamp
163
.libs
2-
INSTALL
3-
/Makefile
464
Makefile.in
5-
aclocal.m4
6-
ar-lib
65+
/ar-lib
66+
/mdate-sh
67+
/py-compile
68+
/test-driver
69+
/ylwrap
70+
71+
# http://www.gnu.org/software/autoconf
772
autom4te.cache
8-
compile
9-
config.*
10-
configure
11-
depcomp
12-
install-sh
13-
lib*.la
14-
libmspack-*.tar.gz
15-
libmspack.pc
16-
libtool
17-
ltmain.sh
18-
m4
19-
missing
20-
stamp-h1
21-
test-driver
22-
test-suite.log
73+
/autoscan.log
74+
/autoscan-*.log
75+
/aclocal.m4
76+
/compile
77+
/config.guess
78+
/config.h.in
79+
/config.log
80+
/config.status
81+
/config.sub
82+
/configure
83+
/configure.scan
84+
/depcomp
85+
/install-sh
86+
/missing
87+
/stamp-h1
88+
89+
# https://www.gnu.org/software/libtool/
90+
/ltmain.sh
91+
92+
# http://www.gnu.org/software/texinfo
93+
/texinfo.tex
94+
95+
# http://www.gnu.org/software/m4/
96+
m4/libtool.m4
97+
m4/ltoptions.m4
98+
m4/ltsugar.m4
99+
m4/ltversion.m4
100+
m4/lt~obsolete.m4

0 commit comments

Comments
 (0)