diff --git a/Makefile.in b/Makefile.in index 7502447..5cf987f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -167,6 +167,7 @@ SHA2ASM_OBJS = $(SHA2ASM_SRCS:.asm=.o) SHA2_OBJS = $(SHA2_SRCS:.c=.o) YASM = @YASM@ +YASM_GAS = @YASM_GAS@ LIBBSCWRAP = libbsc_compress.c LIBBSCWRAPOBJ = libbsc_compress.o LIBBSCDIR = @LIBBSCDIR@ @@ -204,7 +205,7 @@ KECCAK_OBJS = $(KECCAK_SRCS:.c=.o) KECCAK_OBJS_ASM = $(KECCAK_SRCS_ASM:.s=.o) CRYPTO_ASM_COMPILE1 = $(COMPILE) $(GEN_OPT) $(CRYPTO_CPPFLAGS) $(CPPFLAGS) -CRYPTO_ASM_COMPILE2 = $(YASM) +CRYPTO_ASM_COMPILE2 = $(YASM_GAS) CRYPTO_ASM_COMPILE = @CRYPTO_ASM_COMPILE@ BAKFILES = *~ lzma/*~ lzfx/*~ lz4/*~ rabin/*~ bsdiff/*~ filters/lzp/*~ utils/*~ crypto/sha2/*~ \ @@ -226,9 +227,11 @@ COMMON_CPPFLAGS = $(BASE_CPPFLAGS) -std=gnu99 COMMON_CPPFLAGS_cpp = $(BASE_CPPFLAGS) COMMON_VEC_FLAGS = -ftree-vectorize COMMON_LOOP_OPTFLAGS = $(VEC_FLAGS) -floop-interchange -floop-block -LDLIBS = -ldl -L./buildtmp -Wl,-R@LIBBZ2_DIR@ -lbz2 -L./buildtmp -Wl,-R@LIBZ_DIR@ -lz -lm @LIBBSCLFLAGS@ \ - -L./buildtmp -Wl,-R@OPENSSL_LIBDIR@ -lcrypto -lrt -Wl,-R@LIBARCHIVE_DIR@ -larchive $(EXTRA_LDFLAGS) \ - -Wl,-R/usr/lib,--enable-new-dtags -Wl,-R/usr/lib64,--enable-new-dtags +RPATH=@RPATH@ +DTAGS=@DTAGS@ +LDLIBS = -ldl -L./buildtmp -Wl,$(RPATH)@LIBBZ2_DIR@ -lbz2 -L./buildtmp -Wl,$(RPATH)@LIBZ_DIR@ -lz -lm @LIBBSCLFLAGS@ \ + -L./buildtmp -Wl,$(RPATH)@OPENSSL_LIBDIR@ -lcrypto @LRT@ -Wl,$(RPATH)@LIBARCHIVE_DIR@ -larchive $(EXTRA_LDFLAGS) \ + -Wl,$(RPATH)/usr/lib$(DTAGS) -Wl,$(RPATH)/usr/lib64$(DTAGS) OBJS = $(MAINOBJS) $(LZMAOBJS) $(PPMDOBJS) $(LZFXOBJS) $(LZ4OBJS) $(CRCOBJS) \ $(RABINOBJS) $(BSDIFFOBJS) $(LZPOBJS) $(DELTA2OBJS) @LIBBSCWRAPOBJ@ $(SKEINOBJS) \ $(SKEIN_BLOCK_OBJ) @SHA2ASM_OBJS@ @SHA2_OBJS@ $(KECCAK_OBJS) $(KECCAK_OBJS_ASM) \ @@ -266,10 +269,10 @@ CPPFLAGS = @CPPFLAGS@ @NO_SLAB_CPPFLAGS@ @DEBUG_STATS_CPPFLAGS@ GEN_OPT = @GEN_OPT@ @SSE_OPT_FLAGS@ BASE_OPT = @GEN_OPT@ PREFIX=@PREFIX@ -AVX_OPT_FLAG = -mavx -SSE4_OPT_FLAG = -msse4.2 -SSE3_OPT_FLAG = -mssse3 -SSE2_OPT_FLAG = -msse2 +AVX_OPT_FLAG = -mavx @USE_CLANG_AS@ +SSE4_OPT_FLAG = -msse4.2 @USE_CLANG_AS@ +SSE3_OPT_FLAG = -mssse3 @USE_CLANG_AS@ +SSE2_OPT_FLAG = -msse2 @USE_CLANG_AS@ SKEIN_FLAGS = $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) @FPTR_FLAG@ SHA2_FLAGS = $(GEN_OPT) $(VEC_FLAGS) $(CPPFLAGS) @FPTR_FLAG@ @@ -334,7 +337,7 @@ $(KECCAK_OBJS_OPT64_ASM2): $(KECCAK_SRC_OPT64_ASM2) $(COMPILE) $(KECCAK_FLAGS) $(@:.o=.s) -o $@ $(KECCAK_OBJS_OPT64_ASM3): $(KECCAK_SRC_OPT64_ASM3) - $(YASM) $(@:.o=.s) -o $@ + $(YASM_GAS) $(@:.o=.s) -o $@ $(KECCAK_OBJS_ASM): $(KECCAK_SRCS_ASM) $(KECCAK_HDRS) @@ -380,10 +383,10 @@ $(PROGOBJS): $(PROGSRCS) $(PROGHDRS) $(COMPILE) $(GEN_OPT) $(LOOP_OPTFLAGS) $(CPPFLAGS) $(@:.o=.c) -o $@ $(LIBBSCLIB): - (cd $(LIBBSCDIR); make) + (cd $(LIBBSCDIR); make CC=$(GCC)) $(LIB): $(OBJS) $(LIBBSCLIB) - $(LINK.LIB) -Wl,-soname,$(LIB).$(LIBVER) -o $(LIB).$(LIBVER) $(OBJS) $(LDLIBS) + $(LINK.LIB) -Wl,-soname$(LIB).$(LIBVER) -o $(LIB).$(LIBVER) $(OBJS) $(LDLIBS) ln -sf $(LIB).$(LIBVER) $(LIB) ./buildtmp/$(PROG): diff --git a/archive/pc_arc_filter.c b/archive/pc_arc_filter.c index 3b5b603..d0f6aa0 100644 --- a/archive/pc_arc_filter.c +++ b/archive/pc_arc_filter.c @@ -54,7 +54,7 @@ struct scratch_buffer { extern size_t packjpg_filter_process(uchar_t *in_buf, size_t len, uchar_t **out_buf); -int64_t packjpg_filter(struct filter_info *fi, void *filter_private); +ssize_t packjpg_filter(struct filter_info *fi, void *filter_private); void add_filters_by_type(struct type_data *typetab, struct filter_flags *ff) diff --git a/archive/pc_archive.c b/archive/pc_archive.c index 06f5e5b..fbc5635 100644 --- a/archive/pc_archive.c +++ b/archive/pc_archive.c @@ -1332,8 +1332,10 @@ extractor_thread_func(void *dat) { * Read archive entries and extract to disk. */ while ((rv = archive_read_next_header(arc, &entry)) != ARCHIVE_EOF) { +#ifndef __APPLE__ const char *xt_name, *xt_value; size_t xt_size; +#endif int typ; if (rv != ARCHIVE_OK) diff --git a/bsc/makefile b/bsc/makefile index 43c2cab..5fc9a3e 100644 --- a/bsc/makefile +++ b/bsc/makefile @@ -1,6 +1,5 @@ SHELL = /bin/sh -CC = g++ AR = ar RANLIB = ranlib diff --git a/config b/config index 9acbd97..170351c 100755 --- a/config +++ b/config @@ -75,7 +75,9 @@ sha256objs= keylen= yasm=yasm yasm_params_linux="-f x64 -f elf64 -X gnu -g dwarf2 -D LINUX" -yasm_params_osx="-f macho64 -X gnu -p gas" +yasm_params_osx="-f macho64" +yasm_params_gas_osx="-f macho64 -X gnu -p gas" +yasm_params_gas= keccak_srcs= keccak_hdrs= keccak_srcs_asm= @@ -92,6 +94,11 @@ salsa20_stream_asm='\$\(XSALSA20_STREAM_ASM\)' salsa20_debug= so_suffix=so crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE1\)' +use_clang_as= +soname_opt="soname," +rpath="-R" +dtag_val=',--enable-new-dtags' +lrt="-lrt" if [ -x /bin/echo ] then @@ -317,7 +324,7 @@ then elif [ "$OS" = "Darwin" ] then yasm="${yasm} ${yasm_params_osx}" - crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE2\)' + yasm_params_gas="${yasm} ${yasm_params_gas_osx}" elif [ "$OS" = "SunOS" ] then @@ -342,6 +349,16 @@ else keccak_srcs='\$\(KECCAK_SRC_OPT64\)' fi +if [ "$OS" = "Darwin" ] +then + crypto_asm_compile='\$\(CRYPTO_ASM_COMPILE2\)' + use_clang_as="-Wa,-q" + soname_opt="install_name,@rpath/" + rpath="-rpath," + dtag_val="" + lrt="" +fi + # Detect OpenSSL library echo "Checking for OpenSSL ..." for lib in "${openssl_prefix}/lib64" "${openssl_prefix}/usr/lib64" \ @@ -462,7 +479,7 @@ else fi rm -rf tst* -openssl_libdir="${openssl_libdir},--enable-new-dtags" +openssl_libdir="${openssl_libdir}${dtag_val}" # Detect other library packages for libspec in "libbz2:${bzlib_prefix}" "libz:${zlib_prefix}" "libarchive:${libarchive_prefix}" @@ -491,13 +508,13 @@ do then if [ -f "${lib}/${libname}.${so_suffix}" -o -h "${lib}/${libname}.${so_suffix}" ] then - eval "${libname}_libdir=${lib},--enable-new-dtags" + eval "${libname}_libdir=${lib}${dtag_val}" (cd ./buildtmp; ln -s ${lib}/${libname}.${so_suffix}) break else if [ -f "${lib}/${libname}.a" ] then - eval "${libname}_libdir=${lib},--enable-new-dtags" + eval "${libname}_libdir=${lib}${dtag_val}" (cd ./buildtmp; ln -s ${lib}/${libname}.a) break fi @@ -664,7 +681,13 @@ cat Makefile.in | sed " s#@GCC@#${GCC}#g s#@GPP@#${GPP}#g s#@CRYPTO_ASM_COMPILE@#${crypto_asm_compile}#g +s#@USE_CLANG_AS@#${use_clang_as}#g s#@SO_SUFFIX@#${so_suffix}#g +s#@YASM_GAS@#${yasm_params_gas}#g +s#@RPATH@#${rpath}#g +s#@LRT@#${lrt}#g +s#soname#${soname_opt}#g +s#@DTAGS@#${dtag_val}#g s#@${linkvar}@#\\\$\\(${typ}_${linkvar}\\)#g s#@${compilevar}@#\\\$\\(${typ}_${compilevar}\\)#g s#@${compilecppvar}@#\\\$\\(${typ}_${compilecppvar}\\)#g diff --git a/filters/dispack/dis.cpp b/filters/dispack/dis.cpp index eb49b09..609d01e 100644 --- a/filters/dispack/dis.cpp +++ b/filters/dispack/dis.cpp @@ -27,7 +27,9 @@ #include #include #include +#ifndef __APPLE__ #include +#endif #include #include