Some initial tidbits for the start of an OSX/Windows port.
This commit is contained in:
parent
935717373b
commit
8b52f7ccb8
3 changed files with 55 additions and 20 deletions
17
Makefile.in
17
Makefile.in
|
@ -23,8 +23,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
PROG= pcompress
|
PROG= pcompress
|
||||||
LIB=libpcompress.so
|
SO_SUFFIX=@SO_SUFFIX@
|
||||||
|
LIB=libpcompress.$(SO_SUFFIX)
|
||||||
LINKLIB=pcompress
|
LINKLIB=pcompress
|
||||||
|
GCC=@GCC@
|
||||||
|
GPP=@GPP@
|
||||||
LIBVER=1
|
LIBVER=1
|
||||||
MAINSRCS = utils/utils.c allocator.c lzma_compress.c ppmd_compress.c \
|
MAINSRCS = utils/utils.c allocator.c lzma_compress.c ppmd_compress.c \
|
||||||
adaptive_compress.c lzfx_compress.c lz4_compress.c none_compress.c \
|
adaptive_compress.c lzfx_compress.c lz4_compress.c none_compress.c \
|
||||||
|
@ -225,18 +228,18 @@ $(SKEIN_BLOCK_OBJ) @SHA2ASM_OBJS@ @SHA2_OBJS@ $(KECCAK_OBJS) $(KECCAK_OBJS_ASM)
|
||||||
$(TRANSP_OBJS) $(CRYPTO_OBJS) $(ZLIB_OBJS) $(BZLIB_OBJS) $(XXHASH_OBJS) $(BLAKE2_OBJS) \
|
$(TRANSP_OBJS) $(CRYPTO_OBJS) $(ZLIB_OBJS) $(BZLIB_OBJS) $(XXHASH_OBJS) $(BLAKE2_OBJS) \
|
||||||
@CRYPTO_COMPAT_OBJS@ $(CRYPTO_ASM_OBJS) $(ARCHIVEOBJS) $(PJPGOBJS) $(DISPACKOBJS)
|
@CRYPTO_COMPAT_OBJS@ $(CRYPTO_ASM_OBJS) $(ARCHIVEOBJS) $(PJPGOBJS) $(DISPACKOBJS)
|
||||||
|
|
||||||
DEBUG_LINK = g++ -pthread @LIBBSCGEN_OPT@ @EXTRA_OPT_FLAGS@ -fopenmp -fPIC
|
DEBUG_LINK = $(GPP) -pthread @LIBBSCGEN_OPT@ @EXTRA_OPT_FLAGS@ -fopenmp -fPIC
|
||||||
DEBUG_COMPILE = gcc -g -c @EXTRA_OPT_FLAGS@ -fPIC
|
DEBUG_COMPILE = $(GCC) -g -c @EXTRA_OPT_FLAGS@ -fPIC
|
||||||
DEBUG_COMPILE_cpp = g++ -g -c @EXTRA_OPT_FLAGS@ -fPIC
|
DEBUG_COMPILE_cpp = $(GPP) -g -c @EXTRA_OPT_FLAGS@ -fPIC
|
||||||
DEBUG_VEC_FLAGS =
|
DEBUG_VEC_FLAGS =
|
||||||
DEBUG_LOOP_OPTFLAGS =
|
DEBUG_LOOP_OPTFLAGS =
|
||||||
DEBUG_GEN_OPT = -O -fno-omit-frame-pointer @LIBBSCGEN_OPT@ -fopenmp
|
DEBUG_GEN_OPT = -O -fno-omit-frame-pointer @LIBBSCGEN_OPT@ -fopenmp
|
||||||
DEBUG_CPPFLAGS = $(COMMON_CPPFLAGS)
|
DEBUG_CPPFLAGS = $(COMMON_CPPFLAGS)
|
||||||
DEBUG_FPTR_FLAG =
|
DEBUG_FPTR_FLAG =
|
||||||
|
|
||||||
RELEASE_LINK = g++ -pthread @LIBBSCGEN_OPT@ @EXTRA_OPT_FLAGS@ -fopenmp -fPIC
|
RELEASE_LINK = $(GPP) -pthread @LIBBSCGEN_OPT@ @EXTRA_OPT_FLAGS@ -fopenmp -fPIC
|
||||||
RELEASE_COMPILE = gcc -c @EXTRA_OPT_FLAGS@ -fPIC -fvisibility=hidden
|
RELEASE_COMPILE = $(GCC) -c @EXTRA_OPT_FLAGS@ -fPIC -fvisibility=hidden
|
||||||
RELEASE_COMPILE_cpp = g++ -c @EXTRA_OPT_FLAGS@ -fPIC -fvisibility=hidden
|
RELEASE_COMPILE_cpp = $(GPP) -c @EXTRA_OPT_FLAGS@ -fPIC -fvisibility=hidden
|
||||||
RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS)
|
RELEASE_VEC_FLAGS = $(COMMON_VEC_FLAGS)
|
||||||
RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS)
|
RELEASE_LOOP_OPTFLAGS = $(COMMON_LOOP_OPTFLAGS)
|
||||||
RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG
|
RELEASE_CPPFLAGS = $(COMMON_CPPFLAGS) -DNDEBUG
|
||||||
|
|
52
config
52
config
|
@ -88,6 +88,25 @@ crypto_compat_flags="-D__HASH_COMPATIBILITY_"
|
||||||
salsa20_stream_c=
|
salsa20_stream_c=
|
||||||
salsa20_stream_asm='\$\(XSALSA20_STREAM_ASM\)'
|
salsa20_stream_asm='\$\(XSALSA20_STREAM_ASM\)'
|
||||||
salsa20_debug=
|
salsa20_debug=
|
||||||
|
so_suffix=so
|
||||||
|
|
||||||
|
if [ -x /bin/echo ]
|
||||||
|
then
|
||||||
|
ECHO=/bin/echo
|
||||||
|
elif [ -x /usr/bin/echo ]
|
||||||
|
then
|
||||||
|
ECHO=/usr/bin/echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x$GCC" = "x" ]
|
||||||
|
then
|
||||||
|
GCC=gcc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x$GPP" = "x" ]
|
||||||
|
then
|
||||||
|
GPP=g++
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf ./buildtmp
|
rm -rf ./buildtmp
|
||||||
mkdir ./buildtmp
|
mkdir ./buildtmp
|
||||||
|
@ -106,7 +125,7 @@ main(void)
|
||||||
}
|
}
|
||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
gcc tst.c -o tst
|
${GCC} tst.c -o tst
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "ERROR:"
|
echo "ERROR:"
|
||||||
|
@ -123,7 +142,7 @@ bitness=`./tst`
|
||||||
if [ $bitness -lt 8 ]
|
if [ $bitness -lt 8 ]
|
||||||
then
|
then
|
||||||
# Hmmm maybe default compilation is 32-bit. Re-try with m64 flag.
|
# Hmmm maybe default compilation is 32-bit. Re-try with m64 flag.
|
||||||
gcc -m64 tst.c -o tst
|
${GCC} -m64 tst.c -o tst
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
rm -f tst tst.c
|
rm -f tst tst.c
|
||||||
|
@ -197,6 +216,10 @@ skeinblock='\$\(SKEIN_BLOCK_C\)'
|
||||||
if [ "$OS" = "Linux" ]
|
if [ "$OS" = "Linux" ]
|
||||||
then
|
then
|
||||||
plat=$(uname -m)
|
plat=$(uname -m)
|
||||||
|
elif [ "$OS" = "Darwin" ]
|
||||||
|
then
|
||||||
|
plat=$(uname -m)
|
||||||
|
so_suffix=dylib
|
||||||
elif [ "$OS" = "SunOS" ]
|
elif [ "$OS" = "SunOS" ]
|
||||||
then
|
then
|
||||||
plat=$(isainfo -v)
|
plat=$(isainfo -v)
|
||||||
|
@ -207,7 +230,7 @@ fi
|
||||||
|
|
||||||
# Check GCC version
|
# Check GCC version
|
||||||
echo "Checking GCC version ..."
|
echo "Checking GCC version ..."
|
||||||
vers=`gcc -dumpversion`
|
vers=`${GCC} -dumpversion`
|
||||||
OIFS="$IFS"
|
OIFS="$IFS"
|
||||||
IFS=.
|
IFS=.
|
||||||
set -- ${vers}
|
set -- ${vers}
|
||||||
|
@ -222,10 +245,10 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# SSE Detection
|
# SSE Detection
|
||||||
echo -n "Checking for CPU SSE version ... "
|
${ECHO} -n "Checking for CPU SSE version ... "
|
||||||
if [ $sse_detect -eq 1 ]
|
if [ $sse_detect -eq 1 ]
|
||||||
then
|
then
|
||||||
gcc -o sse_level ./utils/sse_level.c ./utils/cpuid.c -I./utils
|
${GCC} -o sse_level ./utils/sse_level.c ./utils/cpuid.c -I./utils
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "ERROR:"
|
echo "ERROR:"
|
||||||
|
@ -304,10 +327,10 @@ for lib in "${openssl_prefix}/lib64" "${openssl_prefix}/usr/lib64" \
|
||||||
do
|
do
|
||||||
if [ -d ${lib} ]
|
if [ -d ${lib} ]
|
||||||
then
|
then
|
||||||
if [ -f "${lib}/libcrypto.so" -o -h "${lib}/libcrypto.so" ]
|
if [ -f "${lib}/libcrypto.${so_suffix}" -o -h "${lib}/libcrypto.${so_suffix}" ]
|
||||||
then
|
then
|
||||||
openssl_libdir="${lib}"
|
openssl_libdir="${lib}"
|
||||||
(cd ./buildtmp; ln -s ${openssl_libdir}/libcrypto.so)
|
(cd ./buildtmp; ln -s ${openssl_libdir}/libcrypto.${so_suffix})
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
if [ -f "${lib}/libcrypto.a" ]
|
if [ -f "${lib}/libcrypto.a" ]
|
||||||
|
@ -367,7 +390,7 @@ main(void)
|
||||||
}
|
}
|
||||||
__EOF
|
__EOF
|
||||||
|
|
||||||
gcc ${extra_opt_flags} -I${openssl_incdir} -L${openssl_libdir} tst.c -o tst
|
${GCC} ${extra_opt_flags} -I${openssl_incdir} -L${openssl_libdir} tst.c -o tst
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "Unable to compile OpenSSL test program please check OpenSSL installation."
|
echo "Unable to compile OpenSSL test program please check OpenSSL installation."
|
||||||
|
@ -381,7 +404,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for HMAC_CTX_copy function
|
# Check for HMAC_CTX_copy function
|
||||||
echo -n "Checking if the OpenSSL library provides HMAC_CTX_copy function ... "
|
${ECHO} -n "Checking if the OpenSSL library provides HMAC_CTX_copy function ... "
|
||||||
cat << __EOF > tst.c
|
cat << __EOF > tst.c
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
@ -404,7 +427,7 @@ main(void)
|
||||||
}
|
}
|
||||||
__EOF
|
__EOF
|
||||||
|
|
||||||
gcc ${extra_opt_flags} -I${openssl_incdir} -L${openssl_libdir} -O0 -g tst.c -o tst -lcrypto >/dev/null 2>&1
|
${GCC} ${extra_opt_flags} -I${openssl_incdir} -L${openssl_libdir} -O0 -g tst.c -o tst -lcrypto >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
openssl_incdir="${openssl_incdir} -D__OSSL_OLD__"
|
openssl_incdir="${openssl_incdir} -D__OSSL_OLD__"
|
||||||
|
@ -441,10 +464,10 @@ do
|
||||||
do
|
do
|
||||||
if [ -d ${lib} ]
|
if [ -d ${lib} ]
|
||||||
then
|
then
|
||||||
if [ -f "${lib}/${libname}.so" -o -h "${lib}/${libname}.so" ]
|
if [ -f "${lib}/${libname}.${so_suffix}" -o -h "${lib}/${libname}.${so_suffix}" ]
|
||||||
then
|
then
|
||||||
eval "${libname}_libdir=${lib},--enable-new-dtags"
|
eval "${libname}_libdir=${lib},--enable-new-dtags"
|
||||||
(cd ./buildtmp; ln -s ${lib}/${libname}.so)
|
(cd ./buildtmp; ln -s ${lib}/${libname}.${so_suffix})
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
if [ -f "${lib}/${libname}.a" ]
|
if [ -f "${lib}/${libname}.a" ]
|
||||||
|
@ -552,7 +575,7 @@ main(void)
|
||||||
}
|
}
|
||||||
_EOF
|
_EOF
|
||||||
|
|
||||||
gcc ${extra_opt_flags} ${libarchive_inc} -L${libarchive_libdir} -O0 -g tst.c -o tst -larchive >/dev/null 2>&1
|
${GCC} ${extra_opt_flags} ${libarchive_inc} -L${libarchive_libdir} -O0 -g tst.c -o tst -larchive >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "Libarchive version 3.0 or newer is required."
|
echo "Libarchive version 3.0 or newer is required."
|
||||||
|
@ -613,6 +636,9 @@ debugstatscppflagsval=
|
||||||
[ $debug_stats -eq 1 ] && debugstatscppflagsval='\$\(DEBUG_STATS_CPPFLAGS\)'
|
[ $debug_stats -eq 1 ] && debugstatscppflagsval='\$\(DEBUG_STATS_CPPFLAGS\)'
|
||||||
|
|
||||||
cat Makefile.in | sed "
|
cat Makefile.in | sed "
|
||||||
|
s#@GCC@#${GCC}#g
|
||||||
|
s#@GPP@#${GPP}#g
|
||||||
|
s#@SO_SUFFIX@#${so_suffix}#g
|
||||||
s#@${linkvar}@#\\\$\\(${typ}_${linkvar}\\)#g
|
s#@${linkvar}@#\\\$\\(${typ}_${linkvar}\\)#g
|
||||||
s#@${compilevar}@#\\\$\\(${typ}_${compilevar}\\)#g
|
s#@${compilevar}@#\\\$\\(${typ}_${compilevar}\\)#g
|
||||||
s#@${compilecppvar}@#\\\$\\(${typ}_${compilecppvar}\\)#g
|
s#@${compilecppvar}@#\\\$\\(${typ}_${compilecppvar}\\)#g
|
||||||
|
|
|
@ -37,14 +37,20 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifndef __APPLE__
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <rabin_dedup.h>
|
#include <rabin_dedup.h>
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#include <xxhash.h>
|
#include <xxhash.h>
|
||||||
#include <pc_archive.h>
|
#include <pc_archive.h>
|
||||||
|
|
||||||
|
#ifndef __APPLE__
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
|
#else
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _IN_UTILS_
|
#define _IN_UTILS_
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
Loading…
Reference in a new issue