Fix libmspack to compile with rbutil

The build system used by rbutil is not very robust: all the files
are eventually compiled to the same directory so we cannot have
two files with the same name (system.c would conflicts with
system.cpp) so rename one file to avoid this. Also change all
include directives to local ones because we don't have to expose
the entire mspack source to inclusion.

Change-Id: I3fe0638d69fdc30566eb9425abfe33c807678b28
Reviewed-on: http://gerrit.rockbox.org/417
Reviewed-by: Dominik Riebeling <Dominik.Riebeling@gmail.com>
diff --git a/rbutil/rbutilqt/mspack/cab.h b/rbutil/rbutilqt/mspack/cab.h
index 9f449d1..78ec8e6 100644
--- a/rbutil/rbutilqt/mspack/cab.h
+++ b/rbutil/rbutilqt/mspack/cab.h
@@ -10,9 +10,9 @@
 #ifndef MSPACK_CAB_H
 #define MSPACK_CAB_H 1
 
-#include <mszip.h>
-#include <qtm.h>
-#include <lzx.h>
+#include "mszip.h"
+#include "qtm.h"
+#include "lzx.h"
 
 /* generic CAB definitions */
 
diff --git a/rbutil/rbutilqt/mspack/cabc.c b/rbutil/rbutilqt/mspack/cabc.c
index 242e034..eb85011 100644
--- a/rbutil/rbutilqt/mspack/cabc.c
+++ b/rbutil/rbutilqt/mspack/cabc.c
@@ -9,8 +9,8 @@
 
 /* CAB compression implementation */
 
-#include <system.h>
-#include <cab.h>
+#include "system-mspack.h"
+#include "cab.h"
 
 struct mscab_compressor *
   mspack_create_cab_compressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/cabd.c b/rbutil/rbutilqt/mspack/cabd.c
index 24ff203..cf91cfb 100644
--- a/rbutil/rbutilqt/mspack/cabd.c
+++ b/rbutil/rbutilqt/mspack/cabd.c
@@ -21,8 +21,8 @@
 
 /* CAB decompression implementation */
 
-#include <system.h>
-#include <cab.h>
+#include "system-mspack.h"
+#include "cab.h"
 #include <assert.h>
 
 /* Notes on compliance with cabinet specification:
diff --git a/rbutil/rbutilqt/mspack/chm.h b/rbutil/rbutilqt/mspack/chm.h
index a85d2e1..4b19f15 100644
--- a/rbutil/rbutilqt/mspack/chm.h
+++ b/rbutil/rbutilqt/mspack/chm.h
@@ -10,7 +10,7 @@
 #ifndef MSPACK_CHM_H
 #define MSPACK_CHM_H 1
 
-#include <lzx.h>
+#include "lzx.h"
 
 /* generic CHM definitions */
 
diff --git a/rbutil/rbutilqt/mspack/chmc.c b/rbutil/rbutilqt/mspack/chmc.c
index 72f6c5b..b9a1d88 100644
--- a/rbutil/rbutilqt/mspack/chmc.c
+++ b/rbutil/rbutilqt/mspack/chmc.c
@@ -9,8 +9,8 @@
 
 /* CHM compression implementation */
 
-#include <system.h>
-#include <chm.h>
+#include "system-mspack.h"
+#include "chm.h"
 
 struct mschm_compressor *
   mspack_create_chm_compressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/chmd.c b/rbutil/rbutilqt/mspack/chmd.c
index 6e4a1bf..416156e 100644
--- a/rbutil/rbutilqt/mspack/chmd.c
+++ b/rbutil/rbutilqt/mspack/chmd.c
@@ -9,8 +9,8 @@
 
 /* CHM decompression implementation */
 
-#include <system.h>
-#include <chm.h>
+#include "system-mspack.h"
+#include "chm.h"
 
 /* prototypes */
 static struct mschmd_header * chmd_open(
diff --git a/rbutil/rbutilqt/mspack/hlp.h b/rbutil/rbutilqt/mspack/hlp.h
index b7486fa..a6e3abc 100644
--- a/rbutil/rbutilqt/mspack/hlp.h
+++ b/rbutil/rbutilqt/mspack/hlp.h
@@ -10,7 +10,7 @@
 #ifndef MSPACK_HLP_H
 #define MSPACK_HLP_H 1
 
-#include <lzss.h>
+#include "lzss.h"
 
 /* generic HLP definitions */
 
diff --git a/rbutil/rbutilqt/mspack/hlpc.c b/rbutil/rbutilqt/mspack/hlpc.c
index 60eabfe..b33e499f 100644
--- a/rbutil/rbutilqt/mspack/hlpc.c
+++ b/rbutil/rbutilqt/mspack/hlpc.c
@@ -9,8 +9,8 @@
 
 /* HLP compression implementation */
 
-#include <system.h>
-#include <hlp.h>
+#include "system-mspack.h"
+#include "hlp.h"
 
 struct mshlp_compressor *
   mspack_create_hlp_compressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/hlpd.c b/rbutil/rbutilqt/mspack/hlpd.c
index 43354f0..ae1f2ef 100644
--- a/rbutil/rbutilqt/mspack/hlpd.c
+++ b/rbutil/rbutilqt/mspack/hlpd.c
@@ -9,8 +9,8 @@
 
 /* HLP decompression implementation */
 
-#include <system.h>
-#include <hlp.h>
+#include "system-mspack.h"
+#include "hlp.h"
 
 struct mshlp_decompressor *
   mspack_create_hlp_decompressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/kwaj.h b/rbutil/rbutilqt/mspack/kwaj.h
index 09673c0..75425d9 100644
--- a/rbutil/rbutilqt/mspack/kwaj.h
+++ b/rbutil/rbutilqt/mspack/kwaj.h
@@ -10,7 +10,7 @@
 #ifndef MSPACK_KWAJ_H
 #define MSPACK_KWAJ_H 1
 
-#include <lzss.h>
+#include "lzss.h"
 
 /* generic KWAJ definitions */
 #define kwajh_Signature1 (0x00)
diff --git a/rbutil/rbutilqt/mspack/kwajc.c b/rbutil/rbutilqt/mspack/kwajc.c
index b88ed76..52ca294 100644
--- a/rbutil/rbutilqt/mspack/kwajc.c
+++ b/rbutil/rbutilqt/mspack/kwajc.c
@@ -9,8 +9,8 @@
 
 /* KWAJ compression implementation */
 
-#include <system.h>
-#include <kwaj.h>
+#include "system-mspack.h"
+#include "kwaj.h"
 
 struct mskwaj_compressor *
   mspack_create_kwaj_compressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/kwajd.c b/rbutil/rbutilqt/mspack/kwajd.c
index d891b6a..440f1dc 100644
--- a/rbutil/rbutilqt/mspack/kwajd.c
+++ b/rbutil/rbutilqt/mspack/kwajd.c
@@ -12,8 +12,8 @@
 
 /* KWAJ decompression implementation */
 
-#include <system.h>
-#include <kwaj.h>
+#include "system-mspack.h"
+#include "kwaj.h"
 
 /* prototypes */
 static struct mskwajd_header *kwajd_open(
@@ -361,7 +361,7 @@
     }							\
     INJECT_BITS(*i_ptr++, 8);				\
 } while (0)
-#include <readbits.h>
+#include "readbits.h"
 
 /* import huffman-reading macros and code */
 #define TABLEBITS(tbl)      KWAJ_TABLEBITS
@@ -369,7 +369,7 @@
 #define HUFF_TABLE(tbl,idx) lzh->tbl##_table[idx]
 #define HUFF_LEN(tbl,idx)   lzh->tbl##_len[idx]
 #define HUFF_ERROR          return MSPACK_ERR_DATAFORMAT
-#include <readhuff.h>
+#include "readhuff.h"
 
 /* In the KWAJ LZH format, there is no special 'eof' marker, it just
  * ends. Depending on how many bits are left in the final byte when
diff --git a/rbutil/rbutilqt/mspack/lit.h b/rbutil/rbutilqt/mspack/lit.h
index 79ba44d..2ccc7dd 100644
--- a/rbutil/rbutilqt/mspack/lit.h
+++ b/rbutil/rbutilqt/mspack/lit.h
@@ -10,9 +10,9 @@
 #ifndef MSPACK_LIT_H
 #define MSPACK_LIT_H 1
 
-#include <lzx.h>
-#include <des.h>
-#include <sha.h>
+#include "lzx.h"
+#include "des.h"
+#include "sha.h"
 
 /* generic LIT definitions */
 
diff --git a/rbutil/rbutilqt/mspack/litc.c b/rbutil/rbutilqt/mspack/litc.c
index a8a709a..4959a81 100644
--- a/rbutil/rbutilqt/mspack/litc.c
+++ b/rbutil/rbutilqt/mspack/litc.c
@@ -9,8 +9,8 @@
 
 /* LIT compression implementation */
 
-#include <system.h>
-#include <lit.h>
+#include "system-mspack.h"
+#include "lit.h"
 
 struct mslit_compressor *
   mspack_create_lit_compressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/litd.c b/rbutil/rbutilqt/mspack/litd.c
index 6e0dc9a..93cbf17 100644
--- a/rbutil/rbutilqt/mspack/litd.c
+++ b/rbutil/rbutilqt/mspack/litd.c
@@ -9,8 +9,8 @@
 
 /* LIT decompression implementation */
 
-#include <system.h>
-#include <lit.h>
+#include "system-mspack.h"
+#include "lit.h"
 
 struct mslit_decompressor *
   mspack_create_lit_decompressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/lzssd.c b/rbutil/rbutilqt/mspack/lzssd.c
index df294bc..f1a47c7 100644
--- a/rbutil/rbutilqt/mspack/lzssd.c
+++ b/rbutil/rbutilqt/mspack/lzssd.c
@@ -11,8 +11,8 @@
  * For further details, see the file COPYING.LIB distributed with libmspack
  */
 
-#include <system.h>
-#include <lzss.h>
+#include "system-mspack.h"
+#include "lzss.h"
 
 #define ENSURE_BYTES do {				\
     if (i_ptr >= i_end) {				\
diff --git a/rbutil/rbutilqt/mspack/lzxc.c b/rbutil/rbutilqt/mspack/lzxc.c
index 1207a0d..89d8c61 100644
--- a/rbutil/rbutilqt/mspack/lzxc.c
+++ b/rbutil/rbutilqt/mspack/lzxc.c
@@ -12,7 +12,7 @@
 
 /* LZX compression implementation */
 
-#include <system.h>
-#include <lzx.h>
+#include "system-mspack.h"
+#include "lzx.h"
 
 /* todo */
diff --git a/rbutil/rbutilqt/mspack/lzxd.c b/rbutil/rbutilqt/mspack/lzxd.c
index cebc4c2..9b26bac 100644
--- a/rbutil/rbutilqt/mspack/lzxd.c
+++ b/rbutil/rbutilqt/mspack/lzxd.c
@@ -12,8 +12,8 @@
 
 /* LZX decompression implementation */
 
-#include <system.h>
-#include <lzx.h>
+#include "system-mspack.h"
+#include "lzx.h"
 
 /* Microsoft's LZX document (in cab-sdk.exe) and their implementation
  * of the com.ms.util.cab Java package do not concur.
@@ -85,7 +85,7 @@
     READ_IF_NEEDED; b1 = *i_ptr++;	\
     INJECT_BITS((b1 << 8) | b0, 16);	\
 } while (0)
-#include <readbits.h>
+#include "readbits.h"
 
 /* import huffman-reading macros and code */
 #define TABLEBITS(tbl)      LZX_##tbl##_TABLEBITS
@@ -93,7 +93,7 @@
 #define HUFF_TABLE(tbl,idx) lzx->tbl##_table[idx]
 #define HUFF_LEN(tbl,idx)   lzx->tbl##_len[idx]
 #define HUFF_ERROR          return lzx->error = MSPACK_ERR_DECRUNCH
-#include <readhuff.h>
+#include "readhuff.h"
 
 /* BUILD_TABLE(tbl) builds a huffman lookup table from code lengths */
 #define BUILD_TABLE(tbl)						\
diff --git a/rbutil/rbutilqt/mspack/mszipc.c b/rbutil/rbutilqt/mspack/mszipc.c
index 2f1ecb2..2f14b9a 100644
--- a/rbutil/rbutilqt/mspack/mszipc.c
+++ b/rbutil/rbutilqt/mspack/mszipc.c
@@ -12,7 +12,7 @@
 
 /* MS-ZIP compression implementation */
 
-#include <system.h>
-#include <mszip.h>
+#include "system-mspack.h"
+#include "mszip.h"
 
 /* todo */
diff --git a/rbutil/rbutilqt/mspack/mszipd.c b/rbutil/rbutilqt/mspack/mszipd.c
index 5b7ef4f..3c158fb 100644
--- a/rbutil/rbutilqt/mspack/mszipd.c
+++ b/rbutil/rbutilqt/mspack/mszipd.c
@@ -12,8 +12,8 @@
 
 /* MS-ZIP decompression implementation. */
 
-#include <system.h>
-#include <mszip.h>
+#include "system-mspack.h"
+#include "mszip.h"
 
 /* import bit-reading macros and code */
 #define BITS_TYPE struct mszipd_stream
@@ -24,7 +24,7 @@
     READ_IF_NEEDED;		\
     INJECT_BITS(*i_ptr++, 8);	\
 } while (0)
-#include <readbits.h>
+#include "readbits.h"
 
 /* import huffman macros and code */
 #define TABLEBITS(tbl)      MSZIP_##tbl##_TABLEBITS
@@ -32,7 +32,7 @@
 #define HUFF_TABLE(tbl,idx) zip->tbl##_table[idx]
 #define HUFF_LEN(tbl,idx)   zip->tbl##_len[idx]
 #define HUFF_ERROR          return INF_ERR_HUFFSYM
-#include <readhuff.h>
+#include "readhuff.h"
 
 #define FLUSH_IF_NEEDED do {				\
     if (zip->window_posn == MSZIP_FRAME_SIZE) {		\
diff --git a/rbutil/rbutilqt/mspack/qtmd.c b/rbutil/rbutilqt/mspack/qtmd.c
index 12b27f5..0fb20da 100644
--- a/rbutil/rbutilqt/mspack/qtmd.c
+++ b/rbutil/rbutilqt/mspack/qtmd.c
@@ -20,8 +20,8 @@
  * http://www.speakeasy.org/~russotto/quantumcomp.html
  */
 
-#include <system.h>
-#include <qtm.h>
+#include "system-mspack.h"
+#include "qtm.h"
 
 /* import bit-reading macros and code */
 #define BITS_TYPE struct qtmd_stream
@@ -33,7 +33,7 @@
     READ_IF_NEEDED; b1 = *i_ptr++;	\
     INJECT_BITS((b0 << 8) | b1, 16);	\
 } while (0)
-#include <readbits.h>
+#include "readbits.h"
 
 /* Quantum static data tables:
  *
diff --git a/rbutil/rbutilqt/mspack/system.c b/rbutil/rbutilqt/mspack/system-mspack.c
similarity index 99%
rename from rbutil/rbutilqt/mspack/system.c
rename to rbutil/rbutilqt/mspack/system-mspack.c
index f3f0019..a7f4a5c 100644
--- a/rbutil/rbutilqt/mspack/system.c
+++ b/rbutil/rbutilqt/mspack/system-mspack.c
@@ -11,7 +11,7 @@
 # include <config.h>
 #endif
 
-#include <system.h>
+#include "system-mspack.h"
 
 #ifndef LARGEFILE_SUPPORT
 const char *largefile_msg = "library not compiled to support large files.";
diff --git a/rbutil/rbutilqt/mspack/system.h b/rbutil/rbutilqt/mspack/system-mspack.h
similarity index 98%
rename from rbutil/rbutilqt/mspack/system.h
rename to rbutil/rbutilqt/mspack/system-mspack.h
index 4a40085..dd3c325 100644
--- a/rbutil/rbutilqt/mspack/system.h
+++ b/rbutil/rbutilqt/mspack/system-mspack.h
@@ -19,7 +19,7 @@
 # include <config.h>
 #endif
 
-#include <mspack.h>
+#include "mspack.h"
 
 /* fix for problem with GCC 4 and glibc (thanks to Ville Skytta)
  * http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=150429
diff --git a/rbutil/rbutilqt/mspack/szdd.h b/rbutil/rbutilqt/mspack/szdd.h
index e07c6b7..b9936b4 100644
--- a/rbutil/rbutilqt/mspack/szdd.h
+++ b/rbutil/rbutilqt/mspack/szdd.h
@@ -10,7 +10,7 @@
 #ifndef MSPACK_SZDD_H
 #define MSPACK_SZDD_H 1
 
-#include <lzss.h>
+#include "lzss.h"
 
 /* input buffer size during decompression - not worth parameterising IMHO */
 #define SZDD_INPUT_SIZE (2048)
diff --git a/rbutil/rbutilqt/mspack/szddc.c b/rbutil/rbutilqt/mspack/szddc.c
index cdd39a6..6ad6501 100644
--- a/rbutil/rbutilqt/mspack/szddc.c
+++ b/rbutil/rbutilqt/mspack/szddc.c
@@ -9,8 +9,8 @@
 
 /* SZDD compression implementation */
 
-#include <system.h>
-#include <szdd.h>
+#include "system-mspack.h"
+#include "szdd.h"
 
 struct msszdd_compressor *
   mspack_create_szdd_compressor(struct mspack_system *sys)
diff --git a/rbutil/rbutilqt/mspack/szddd.c b/rbutil/rbutilqt/mspack/szddd.c
index 99c5aa4..af77f15 100644
--- a/rbutil/rbutilqt/mspack/szddd.c
+++ b/rbutil/rbutilqt/mspack/szddd.c
@@ -13,8 +13,8 @@
 
 /* SZDD decompression implementation */
 
-#include <system.h>
-#include <szdd.h>
+#include "system-mspack.h"
+#include "szdd.h"
 
 /* prototypes */
 static struct msszddd_header *szddd_open(