Skip to content

Commit

Permalink
Enable XZ Windows Build
Browse files Browse the repository at this point in the history
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
yongtang committed Feb 17, 2020
1 parent 1a8ecad commit 743910e
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 97 deletions.
62 changes: 31 additions & 31 deletions WORKSPACE
Expand Up @@ -306,6 +306,37 @@ http_archive(
],
)

http_archive(
name = "libtiff",
build_file = "//third_party:libtiff.BUILD",
sha256 = "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634",
strip_prefix = "tiff-4.1.0",
urls = [
"https://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz",
],
)

http_archive(
name = "xz",
build_file = "//third_party:xz.BUILD",
sha256 = "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145",
strip_prefix = "xz-5.2.4",
urls = [
"https://tukaani.org/xz/xz-5.2.4.tar.gz",
],
)

http_archive(
name = "util_linux",
build_file = "//third_party:uuid.BUILD",
sha256 = "2483d5a42bc39575fc215c6994554f5169db777262d606ebe9cd8d5f37557f72",
strip_prefix = "util-linux-2.32.1",
urls = [
"https://github.com/karelzak/util-linux/archive/v2.32.1.tar.gz",
"https://mirror.bazel.build/github.com/karelzak/util-linux/archive/v2.32.1.tar.gz",
],
)

http_archive(
name = "ffmpeg_2_8",
build_file = "//third_party:ffmpeg_2_8.BUILD",
Expand All @@ -328,27 +359,6 @@ http_archive(
],
)

http_archive(
name = "libtiff",
build_file = "//third_party:libtiff.BUILD",
sha256 = "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634",
strip_prefix = "tiff-4.1.0",
urls = [
"https://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz",
],
)

http_archive(
name = "util_linux",
build_file = "//third_party:uuid.BUILD",
sha256 = "2483d5a42bc39575fc215c6994554f5169db777262d606ebe9cd8d5f37557f72",
strip_prefix = "util-linux-2.32.1",
urls = [
"https://github.com/karelzak/util-linux/archive/v2.32.1.tar.gz",
"https://mirror.bazel.build/github.com/karelzak/util-linux/archive/v2.32.1.tar.gz",
],
)

http_archive(
name = "rules_python",
sha256 = "c911dc70f62f507f3a361cbc21d6e0d502b91254382255309bc60b7a0f48de28",
Expand Down Expand Up @@ -665,16 +675,6 @@ http_archive(
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz"],
)

http_archive(
name = "xz",
build_file = "//third_party:xz.BUILD",
sha256 = "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145",
strip_prefix = "xz-5.2.4",
urls = [
"https://tukaani.org/xz/xz-5.2.4.tar.gz",
],
)

http_archive(
name = "com_grail_bazel_toolchain",
strip_prefix = "bazel-toolchain-0.4.4",
Expand Down
1 change: 0 additions & 1 deletion tensorflow_io/core/BUILD
Expand Up @@ -536,7 +536,6 @@ cc_binary(
"//tensorflow_io/gcs:gcs_config_ops",
"//tensorflow_io/ignite:ignite_ops",
"@libarchive",
"@xz//:lzma",
],
}),
)
Expand Down
159 changes: 94 additions & 65 deletions third_party/xz.BUILD
Expand Up @@ -80,20 +80,13 @@ cc_library(
"src/liblzma/simple/x86.c",
],
hdrs = glob(["src/**/*.h"]) + ["config.h"],
copts = ["-std=c99"],
defines = select({
"@bazel_tools//src/conditions:darwin": [
"TUKLIB_CPUCORES_SYSCTL=1",
],
copts = select({
"@bazel_tools//src/conditions:windows": [],
"//conditions:default": [
"TUKLIB_CPUCORES_SCHED_GETAFFINITY=1",
"HAVE_BSWAP_16=1",
"HAVE_BSWAP_32=1",
"HAVE_BSWAP_64=1",
"HAVE_BYTESWAP_H=1",
"HAVE_PTHREAD_CONDATTR_SETCLOCK=1",
"-std=c99",
],
}) + [
}),
defines = [
"HAVE_CONFIG_H",
],
includes = [
Expand All @@ -120,15 +113,100 @@ genrule(
cmd = "\n".join([
"cat <<'EOF' >$@",
"",
"#define ASSUME_RAM 128",
"#if defined(_MSC_VER)",
"",
"#define HAVE_VISIBILITY 0",
"#define MYTHREAD_VISTA 1",
"",
"#elif defined(__APPLE__)",
"",
"#define TUKLIB_CPUCORES_SYSCTL 1",
"#define ENABLE_NLS 1",
"#define HAVE_CHECK_CRC32 1",
"#define HAVE_CHECK_CRC64 1",
"#define HAVE_CHECK_SHA256 1",
"#define HAVE_CLOCK_GETTIME 1",
"#define HAVE_DCGETTEXT 1",
"#define HAVE_DECL_CLOCK_MONOTONIC 1",
"#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1",
"#define HAVE_DLFCN_H 1",
"#define HAVE_FCNTL_H 1",
"#define HAVE_FUTIMENS 1",
"#define HAVE_GETOPT_H 1",
"#define HAVE_GETOPT_LONG 1",
"#define HAVE_GETTEXT 1",
"#define HAVE_IMMINTRIN_H 1",
"#define HAVE_MBRTOWC 1",
"#define HAVE_MEMORY_H 1",
"#define HAVE_POSIX_FADVISE 1",
"#define HAVE_PTHREAD_PRIO_INHERIT 1",
"#define HAVE_STRINGS_H 1",
"#define HAVE_SYS_TIME_H 1",
"#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1",
"#define HAVE_SYS_PARAM_H 1",
"#define HAVE_SYS_STAT_H 1",
"#define HAVE_SYS_TYPES_H 1",
"#define HAVE_UINTPTR_T 1",
"#define HAVE_UNISTD_H 1",
"#define HAVE_WCWIDTH 1",
"#define HAVE__MM_MOVEMASK_EPI8 1",
"#define HAVE_VISIBILITY 1",
"#define MYTHREAD_POSIX 1",
"",
"#define _ALL_SOURCE 1",
"#define _GNU_SOURCE 1",
"#define _POSIX_PTHREAD_SEMANTICS 1",
"#define _TANDEM_SOURCE 1",
"#define __EXTENSIONS__ 1",
"",
"#define _DARWIN_USE_64_BIT_INODE 1",
"",
"#else",
"",
"#define TUKLIB_CPUCORES_SCHED_GETAFFINITY 1",
"#define ENABLE_NLS 1",
"#define HAVE_BSWAP_16 1",
"#define HAVE_BSWAP_32 1",
"#define HAVE_BSWAP_64 1",
"#define HAVE_BYTESWAP_H 1",
"#define HAVE_CLOCK_GETTIME 1",
"#define HAVE_DCGETTEXT 1",
"#define HAVE_DECL_CLOCK_MONOTONIC 1",
"#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1",
"#define HAVE_DLFCN_H 1",
"#define HAVE_FCNTL_H 1",
"#define HAVE_FUTIMENS 1",
"#define HAVE_GETOPT_H 1",
"#define HAVE_GETOPT_LONG 1",
"#define HAVE_GETTEXT 1",
"#define HAVE_IMMINTRIN_H 1",
"#define HAVE_MBRTOWC 1",
"#define HAVE_MEMORY_H 1",
"#define HAVE_POSIX_FADVISE 1",
"#define HAVE_PTHREAD_PRIO_INHERIT 1",
"#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1",
"#define HAVE_STRINGS_H 1",
"#define HAVE_SYS_TIME_H 1",
"#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1",
"#define HAVE_SYS_PARAM_H 1",
"#define HAVE_SYS_STAT_H 1",
"#define HAVE_SYS_TYPES_H 1",
"#define HAVE_UINTPTR_T 1",
"#define HAVE_UNISTD_H 1",
"#define HAVE_WCWIDTH 1",
"#define HAVE__MM_MOVEMASK_EPI8 1",
"#define HAVE_VISIBILITY 1",
"#define MYTHREAD_POSIX 1",
"",
"#define _ALL_SOURCE 1",
"#define _GNU_SOURCE 1",
"#define _POSIX_PTHREAD_SEMANTICS 1",
"#define _TANDEM_SOURCE 1",
"#define __EXTENSIONS__ 1",
"",
"#endif",
"",
"#define ASSUME_RAM 128",
"#define HAVE_CHECK_CRC32 1",
"#define HAVE_CHECK_CRC64 1",
"#define HAVE_CHECK_SHA256 1",
"#define HAVE_DECODERS 1",
"#define HAVE_DECODER_ARM 1",
"#define HAVE_DECODER_ARMTHUMB 1",
Expand All @@ -139,7 +217,6 @@ genrule(
"#define HAVE_DECODER_POWERPC 1",
"#define HAVE_DECODER_SPARC 1",
"#define HAVE_DECODER_X86 1",
"#define HAVE_DLFCN_H 1",
"#define HAVE_ENCODERS 1",
"#define HAVE_ENCODER_ARM 1",
"#define HAVE_ENCODER_ARMTHUMB 1",
Expand All @@ -150,41 +227,19 @@ genrule(
"#define HAVE_ENCODER_POWERPC 1",
"#define HAVE_ENCODER_SPARC 1",
"#define HAVE_ENCODER_X86 1",
"#define HAVE_FCNTL_H 1",
"#define HAVE_FUTIMENS 1",
"#define HAVE_GETOPT_H 1",
"#define HAVE_GETOPT_LONG 1",
"#define HAVE_GETTEXT 1",
"#define HAVE_IMMINTRIN_H 1",
"#define HAVE_INTTYPES_H 1",
"#define HAVE_LIMITS_H 1",
"#define HAVE_MBRTOWC 1",
"#define HAVE_MEMORY_H 1",
"#define HAVE_MF_BT2 1",
"#define HAVE_MF_BT3 1",
"#define HAVE_MF_BT4 1",
"#define HAVE_MF_HC3 1",
"#define HAVE_MF_HC4 1",
"#define HAVE_POSIX_FADVISE 1",
"#define HAVE_PTHREAD_PRIO_INHERIT 1",
"#define HAVE_STDBOOL_H 1",
"#define HAVE_STDINT_H 1",
"#define HAVE_STDLIB_H 1",
"#define HAVE_STRINGS_H 1",
"#define HAVE_STRING_H 1",
"#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1",
"#define HAVE_SYS_PARAM_H 1",
"#define HAVE_SYS_STAT_H 1",
"#define HAVE_SYS_TIME_H 1",
"#define HAVE_SYS_TYPES_H 1",
"#define HAVE_UINTPTR_T 1",
"#define HAVE_UNISTD_H 1",
"#define HAVE_VISIBILITY 1",
"#define HAVE_WCWIDTH 1",
"#define HAVE__BOOL 1",
"#define HAVE__MM_MOVEMASK_EPI8 1",
"#define LT_OBJDIR \".libs/\"",
"#define MYTHREAD_POSIX 1",
"#define NDEBUG 1",
"#define PACKAGE \"xz\"",
"#define PACKAGE_BUGREPORT \"lasse.collin@tukaani.org\"",
Expand All @@ -197,33 +252,7 @@ genrule(
"#define STDC_HEADERS 1",
"#define TUKLIB_FAST_UNALIGNED_ACCESS 1",
"#define TUKLIB_PHYSMEM_SYSCONF 1",
"#ifndef _ALL_SOURCE",
"# define _ALL_SOURCE 1",
"#endif",
"#ifndef _GNU_SOURCE",
"# define _GNU_SOURCE 1",
"#endif",
"#ifndef _POSIX_PTHREAD_SEMANTICS",
"# define _POSIX_PTHREAD_SEMANTICS 1",
"#endif",
"#ifndef _TANDEM_SOURCE",
"# define _TANDEM_SOURCE 1",
"#endif",
"#ifndef __EXTENSIONS__",
"# define __EXTENSIONS__ 1",
"#endif",
"#define VERSION \"5.2.4\"",
"#if defined AC_APPLE_UNIVERSAL_BUILD",
"# if defined __BIG_ENDIAN__",
"# define WORDS_BIGENDIAN 1",
"# endif",
"#else",
"# ifndef WORDS_BIGENDIAN",
"# endif",
"#endif",
"#ifndef _DARWIN_USE_64_BIT_INODE",
"# define _DARWIN_USE_64_BIT_INODE 1",
"#endif",
"",
"EOF",
]),
Expand Down

0 comments on commit 743910e

Please sign in to comment.