1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchurl,
6 fetchpatch,
7 cmake,
8 gtest,
9 lz4,
10 protobuf_30,
11 snappy,
12 zlib,
13 zstd,
14}:
15
16let
17 orc-format = fetchurl {
18 name = "orc-format-1.1.0.tar.gz";
19 url = "https://www.apache.org/dyn/closer.lua/orc/orc-format-1.1.0/orc-format-1.1.0.tar.gz?action=download";
20 hash = "sha256-1KesdsVEKr9xGeLLhOcbZ34HWv9TUYqoZgVeLq0EUNc=";
21 };
22in
23stdenv.mkDerivation (finalAttrs: {
24 pname = "apache-orc";
25 version = "2.1.2";
26
27 src = fetchFromGitHub {
28 owner = "apache";
29 repo = "orc";
30 tag = "v${finalAttrs.version}";
31 hash = "sha256-hNKzqNOagBJOWQRebkVHIuvqfpk9Mi30bu4z7dGbsxk=";
32 };
33
34 nativeBuildInputs = [
35 cmake
36 ];
37
38 buildInputs = [
39 gtest
40 lz4
41 protobuf_30
42 snappy
43 zlib
44 zstd
45 ];
46
47 cmakeFlags = [
48 (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
49 (lib.cmakeBool "BUILD_JAVA" false)
50 (lib.cmakeBool "STOP_BUILD_ON_WARNING" true)
51 (lib.cmakeBool "INSTALL_VENDORED_LIBS" false)
52 ]
53 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
54 # Fix (RiscV) cross-compilation
55 # See https://github.com/apache/orc/issues/2334
56 (lib.cmakeFeature "HAS_PRE_1970_EXITCODE" "0")
57 (lib.cmakeFeature "HAS_POST_2038_EXITCODE" "0")
58 (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-Wno-unused-parameter")
59 ];
60
61 env = {
62 GTEST_HOME = gtest.dev;
63 LZ4_ROOT = lz4;
64 ORC_FORMAT_URL = orc-format;
65 PROTOBUF_HOME = protobuf_30;
66 SNAPPY_ROOT = snappy.dev;
67 ZLIB_ROOT = zlib.dev;
68 ZSTD_ROOT = zstd.dev;
69 };
70
71 meta = {
72 changelog = "https://github.com/apache/orc/releases/tag/v${finalAttrs.version}";
73 description = "Smallest, fastest columnar storage for Hadoop workloads";
74 homepage = "https://github.com/apache/orc/";
75 license = lib.licenses.asl20;
76 maintainers = with lib.maintainers; [ drupol ];
77 platforms = lib.platforms.all;
78 };
79})