|
From: <lab...@us...> - 2015-05-27 13:31:41
|
Revision: 1531
http://sourceforge.net/p/opengtoolkit/svn/1531
Author: labviewer
Date: 2015-05-27 13:31:38 +0000 (Wed, 27 May 2015)
Log Message:
-----------
Fix some linux compilation issues
Modified Paths:
--------------
trunk/lvzip/c_source/Makefile
trunk/lvzip/c_source/Makefile.vxworks
trunk/lvzip/c_source/aes/entropy.c
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/Makefile
===================================================================
--- trunk/lvzip/c_source/Makefile 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/Makefile 2015-05-27 13:31:38 UTC (rev 1531)
@@ -18,6 +18,7 @@
CC=gcc
+
CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
@@ -25,7 +26,7 @@
# -Wstrict-prototypes -Wmissing-prototypes
CINDIR=/usr/local/lv70/cintools
-SFLAGS=-O3 -fPIC -m64 -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
+SFLAGS=-O3 -fPIC $(CC_ARCH_SPEC) -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=gcc
@@ -58,12 +59,17 @@
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
OBJL = lvutil.o ioapi.o iomem.o mztools.o unzip.o zip.o utf.o
-OBJC = $(OBJZ) $(OBJL) $(OBJG)
+OBJE = aes/aescrypt.o aes/aeskey.o aes/aestab.o aes/entropy.o aes/filenc.o aes/hmac.o aes/prng.o aes/pwd2key.o aes/sha1.o
+OBJ2 = bzip2/blocksort.o bzip2/huffman.o bzip2/crctable.o bzip2/randtable.o bzip2/compress.o bzip2/decompress.o bzip2/bzlib.o
+OBJC = $(OBJZ) $(OBJL) $(OBJG) $(OBJ2) $(OBJE)
+
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJL = lvapi.lo lvutil.lo ioapi.lo iomem.lo mztools.lo unzip.lo zip.lo utf.lo
-PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG)
+PIC_OBJE = aes/aescrypt.lo aes/aeskey.lo aes/aestab.lo aes/entropy.lo aes/filenc.lo aes/hmac.lo aes/prng.lo aes/pwd2key.lo aes/sha1.lo
+PIC_OBJ2 = bzip2/blocksort.lo bzip2/huffman.lo bzip2/crctable.lo bzip2/randtable.lo bzip2/compress.lo bzip2/decompress.lo bzip2/bzlib.lo
+PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG) $(PIC_OBJ2) $(PIC_OBJE)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
@@ -73,9 +79,14 @@
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
-#all: static all64
-all: clean $(SHAREDLIBV)
+all: static all64
+linux32: clean
+ $(MAKE) $(SHAREDLIBV) ARCH_DIR=./Linux_x86 CC_ARCH_SPEC="-m32"
+
+linux64: clean
+ $(MAKE) $(SHAREDLIBV) ARCH_DIR=./Linux_x64 CC_ARCH_SPEC="-m64"
+
static: example$(EXE) minigzip$(EXE)
shared: examplesh$(EXE) minigzipsh$(EXE)
@@ -156,16 +167,17 @@
.SUFFIXES: .lo
.c.lo:
- -@mkdir objs 2>/dev/null || test -d objs
- $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
- -@mv objs/$*.o $@
+ -@mkdir $(ARCH_DIR) 2>/dev/null || test -d $(ARCH_DIR)
+ -@mkdir $(ARCH_DIR)/aes 2>/dev/null || test -d $(ARCH_DIR)/aes
+ -@mkdir $(ARCH_DIR)/bzip2 2>/dev/null || test -d $(ARCH_DIR)/bzip2
+ $(CC) $(SFLAGS) -DPIC -c -o $(ARCH_DIR)/$*.o $<
+ -@mv $(ARCH_DIR)/$*.o $(ARCH_DIR)/$@
placebo $(SHAREDLIBV): $(PIC_OBJS)
$(LDSHARED) $(SFLAGS) -shared -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
# ln -s $@ $(SHAREDLIB)
# ln -s $@ $(SHAREDLIBM)
- -@rmdir objs
example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
@@ -248,7 +260,7 @@
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
- rm -rf objs
+ rm -rf $(ARCH_DIR)/*.lo
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
Modified: trunk/lvzip/c_source/Makefile.vxworks
===================================================================
--- trunk/lvzip/c_source/Makefile.vxworks 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/Makefile.vxworks 2015-05-27 13:31:38 UTC (rev 1531)
@@ -19,11 +19,16 @@
# directory. Make will automatically locate the source file and
# compile it.
# $(OBJ_DIR)/gzclose.o $(OBJ_DIR)/gzlib.o $(OBJ_DIR)/gzread.o $(OBJ_DIR)/gzwrite.o
-OBJECTS := $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.o \
+OBJECTS := $(OBJ_DIR)/aes/aescrypt.o $(OBJ_DIR)/aes/aeskey.o $(OBJ_DIR)/aes/aestab.o \
+ $(OBJ_DIR)/aes/entropy.o $(OBJ_DIR)/aes/filenc.o $(OBJ_DIR)/aes/hmac.o \
+ $(OBJ_DIR)/aes/prng.o $(OBJ_DIR)/aes/pwd2key.o $(OBJ_DIR)/aes/sha1.o \
+ $(OBJ_DIR)/bzip2/bzlib.o $(OBJ_DIR)/bzip2/blocksort.o $(OBJ_DIR)/bzip2/huffman.o $(OBJ_DIR)/bzip2/crctable.o \
+ $(OBJ_DIR)/bzip2/randtable.o $(OBJ_DIR)/bzip2/compress.o $(OBJ_DIR)/bzip2/decompress.o \
+ $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.o \
$(OBJ_DIR)/inffast.o $(OBJ_DIR)/infback.o $(OBJ_DIR)/inflate.o $(OBJ_DIR)/inftrees.o \
$(OBJ_DIR)/ioapi.o $(OBJ_DIR)/iomem.o $(OBJ_DIR)/lvutil.o $(OBJ_DIR)/lvapi.o \
$(OBJ_DIR)/mztools.o $(OBJ_DIR)/trees.o $(OBJ_DIR)/uncompr.o $(OBJ_DIR)/utf.o \
- $(OBJ_DIR)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
+ $(OBJ_DIR)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
# This is the name of the output shared library.
PROJECT_TARGETS := $(OBJ_DIR)/lvzlib.out
Modified: trunk/lvzip/c_source/aes/entropy.c
===================================================================
--- trunk/lvzip/c_source/aes/entropy.c 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/aes/entropy.c 2015-05-27 13:31:38 UTC (rev 1531)
@@ -1,48 +1,49 @@
-#ifdef _WIN32
-#include <windows.h>
-#endif
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <fcntl.h>
+#endif
#if defined(__cplusplus)
extern "C"
{
#endif
-
-#ifdef _WIN32
-int entropy_fun(unsigned char buf[], unsigned int len)
-{
- HCRYPTPROV provider;
- unsigned __int64 pentium_tsc[1];
- unsigned int i;
- int result = 0;
-
-
- if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
- {
- result = CryptGenRandom(provider, len, buf);
- CryptReleaseContext(provider, 0);
- if (result)
- return len;
- }
-
- QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc);
-
- for(i = 0; i < 8 && i < len; ++i)
- buf[i] = ((unsigned char*)pentium_tsc)[i];
-
- return i;
-}
-#else
-int entropy_fun(unsigned char buf[], unsigned int len)
-{
+
+#ifdef _WIN32
+int entropy_fun(unsigned char buf[], unsigned int len)
+{
+ HCRYPTPROV provider;
+ unsigned __int64 pentium_tsc[1];
+ unsigned int i;
+ int result = 0;
+
+ if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
+ {
+ result = CryptGenRandom(provider, len, buf);
+ CryptReleaseContext(provider, 0);
+ if (result)
+ return len;
+ }
+
+ QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc);
+
+ for(i = 0; i < 8 && i < len; ++i)
+ buf[i] = ((unsigned char*)pentium_tsc)[i];
+
+ return i;
+}
+#else
+int entropy_fun(unsigned char buf[], unsigned int len)
+{
int frand = open("/dev/random", O_RDONLY);
int rlen = 0;
if (frand != -1)
{
rlen = read(frand, buf, len);
- close(frand);
- }
- return rlen;
-}
+ close(frand);
+ }
+ return rlen;
+}
#endif
#if defined(__cplusplus)
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-27 13:31:38 UTC (rev 1531)
@@ -111,14 +111,14 @@
#endif
#if HAVE_BZIP2
-void bz_internal_error(int errcode)
-{
- // if we have a debug build then print the error in the LabVIEW debug console
-#if DEBUG
- DbgPrintf("BZIP2 internal error %ld occurred!!", errcode);
-#endif
-}
+void bz_internal_error(int errcode)
+{
+ // if we have a debug build then print the error in the LabVIEW debug console
+#if DEBUG
+ DbgPrintf("BZIP2 internal error %ld occurred!!", errcode);
#endif
+}
+#endif
#if MacOS
#if usesHFSPath
@@ -1680,7 +1680,7 @@
return mgNotSupported;
}
else
-#endif
+ #endif
{
switch (openMode)
{
@@ -1710,11 +1710,19 @@
return mgArgErr;
}
- err = MakePathDSString(path, &lstr, strlen(namedResourceFork));
- if (!err && rsrc)
+ #if MacOSX
+ if (rsrc)
{
- strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), namedResourceFork);
+ err = MakePathDSString(path, &lstr, strlen(namedResourceFork));
+ if (!err)
+ {
+ strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), namedResourceFork);
+ }
}
+ else
+ #else
+ err = MakePathDSString(path, &lstr, 0);
+ #endif
if (err)
return err;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|