aboutsummaryrefslogtreecommitdiffhomepage
path: root/compile.sh
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-06-01 14:45:21 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2015-06-01 15:50:49 +0000
commiteb6e90397eff1083f0574b6cbd94eb9f42d2d239 (patch)
tree7eac158033f6db031ea5ac167f75fd3ff800c4a1 /compile.sh
parent14b437bf749baf0488cfc7e4ed7589dc4af9bec3 (diff)
Use the ijar ZIP implementation in Blaze instead of libarchive
This ZIP implementation is lightweight and rely on zlib for compression. libarchive was a bit tricky to set-up so it's better to use that one. -- Change-Id: I607b492998572e834e095a4606eeb77c0b574542 Reviewed-on: https://bazel-review.googlesource.com/#/c/1410/ MOS_MIGRATED_REVID=94910072
Diffstat (limited to 'compile.sh')
-rwxr-xr-xcompile.sh84
1 files changed, 4 insertions, 80 deletions
diff --git a/compile.sh b/compile.sh
index f7edfd56c5..695b3288b7 100755
--- a/compile.sh
+++ b/compile.sh
@@ -71,58 +71,6 @@ function log() {
fi
}
-function write_fromhost_build() {
- case "${PLATFORM}" in
- linux)
- cat << EOF > fromhost/BUILD
-package(default_visibility = ["//visibility:public"])
-cc_library(
- name = "libarchive",
- srcs = [],
- hdrs = [],
-)
-EOF
-
- ;;
- darwin)
- if [[ -e $homebrew_header ]]; then
- rm -f fromhost/*.[ah]
- touch fromhost/empty.c
- # For use with Homebrew.
- archive_dir=$(dirname $(dirname $homebrew_header))
- cp ${archive_dir}/lib/*.a ${archive_dir}/include/*.h fromhost/
- cat << EOF > fromhost/BUILD
-package(default_visibility = ["//visibility:public"])
-cc_library(
- name = "libarchive",
- srcs = glob(["*.a"]) + ["empty.c"],
- hdrs = glob(["*.h"]),
- includes = ["."],
- linkopts = ["-lxml2", "-liconv", "-lbz2", "-lz", ],
-)
-EOF
-
- elif [[ -e $macports_header ]]; then
- # For use with Macports.
- archive_dir=$(dirname $(dirname $macports_header))
- rm -f fromhost/*.[ah]
- touch fromhost/empty.c
- cp "${archive_dir}"/include/{archive.h,archive_entry.h} fromhost/
- cp "${archive_dir}"/lib/{libarchive,liblzo2,liblzma,libcharset,libbz2,libxml2,libz,libiconv}.a \
- fromhost/
- cat << EOF > fromhost/BUILD
-package(default_visibility = ["//visibility:public"])
-cc_library(
- name = "libarchive",
- srcs = glob(["*.a"]) + ["empty.c"],
- hdrs = glob(["*.h"]),
- includes = ["."],
-)
-EOF
- fi
- esac
-}
-
# Create symlinks so we can use tools and examples from the base_workspace.
base_workspace=$(pwd)/base_workspace
mkdir -p "$base_workspace"
@@ -133,7 +81,7 @@ rm -f "${base_workspace}/examples" && ln -s "$(pwd)/examples" "${base_workspace}
case "${PLATFORM}" in
linux)
# Sorry, no static linking on linux for now.
- LDFLAGS="$(pkg-config libarchive --libs) -lrt $LDFLAGS"
+ LDFLAGS="-lz -lrt $LDFLAGS"
JNILIB="libunix.so"
MD5SUM="md5sum"
# JAVA_HOME must point to a Java 8 installation.
@@ -144,33 +92,13 @@ linux)
darwin)
JNILIB="libunix.dylib"
MD5SUM="md5"
+ LDFLAGS="-lz $LDFLAGS"
if [[ -z "$JAVA_HOME" ]]; then
JAVA_HOME="$(/usr/libexec/java_home -v 1.8+ 2> /dev/null)" \
|| fail "Could not find JAVA_HOME, please ensure a JDK (version 1.8+) is installed."
fi
PROTOC=${PROTOC:-third_party/protobuf/protoc.darwin}
- homebrew_header=$(ls -1 $(brew --prefix libarchive 2>/dev/null)/include/archive.h 2>/dev/null | head -n1)
- macports_header=$(port contents libarchive 2>/dev/null | grep /archive.h$ | xargs)
- if [[ -e $homebrew_header ]]; then
- # For use with Homebrew.
- archive_dir=$(dirname $(dirname $homebrew_header))
- ARCHIVE_CFLAGS="-I${archive_dir}/include"
- LDFLAGS="-L${archive_dir}/lib -larchive $LDFLAGS"
-
- elif [[ -e $macports_header ]]; then
- # For use with Macports.
- ARCHIVE_CFLAGS="-Ifromhost"
- # Link libarchive statically
- LDFLAGS="fromhost/libarchive.a fromhost/liblzo2.a \
- fromhost/liblzma.a fromhost/libcharset.a \
- fromhost/libbz2.a fromhost/libxml2.a \
- fromhost/libz.a fromhost/libiconv.a \
- $LDFLAGS"
- else
- log "WARNING: Could not find libarchive installation, proceeding bravely."
- fi
-
;;
msys*|mingw*)
@@ -178,7 +106,7 @@ msys*|mingw*)
PLATFORM="mingw"
# Workaround for msys issue which causes omission of std::to_string.
CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_DYNAMIC"
- LDFLAGS="-larchive ${LDFLAGS}"
+ LDFLAGS="-lz $LDFLAGS"
MD5SUM="md5sum"
EXE_EXT=".exe"
PATHSEP=";"
@@ -207,11 +135,6 @@ esac
[[ -x "${PROTOC-}" ]] \
|| fail "Protobuf compiler not found in ${PROTOC-}"
-mkdir -p fromhost
-if [ ! -f fromhost/BUILD ]; then
- write_fromhost_build
-fi
-
test -z "$JAVA_HOME" && fail "JDK not found, please set \$JAVA_HOME."
rm -f tools/jdk/jdk && ln -s "${JAVA_HOME}" tools/jdk/jdk
@@ -239,6 +162,7 @@ src/main/cpp/util/md5.cc
src/main/cpp/util/numbers.cc
src/main/cpp/util/port.cc
src/main/cpp/util/strings.cc
+third_party/ijar/zip.cc
)
NATIVE_CC_FILES=(