summaryrefslogtreecommitdiffstats
path: root/src/arrow/ci/scripts/PKGBUILD
blob: 975d1514f9342c7f394caea4bf3be457b812f708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

_realname=arrow
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=6.0.1
pkgrel=8000
pkgdesc="Apache Arrow is a cross-language development platform for in-memory data (mingw-w64)"
arch=("any")
url="https://arrow.apache.org/"
license=("Apache-2.0")
depends=("${MINGW_PACKAGE_PREFIX}-aws-sdk-cpp"
         "${MINGW_PACKAGE_PREFIX}-libutf8proc"
         "${MINGW_PACKAGE_PREFIX}-re2"
         "${MINGW_PACKAGE_PREFIX}-thrift"
         "${MINGW_PACKAGE_PREFIX}-snappy"
         "${MINGW_PACKAGE_PREFIX}-zlib"
         "${MINGW_PACKAGE_PREFIX}-lz4"
         "${MINGW_PACKAGE_PREFIX}-zstd")
makedepends=("${MINGW_PACKAGE_PREFIX}-ccache"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-gcc")
options=("staticlibs" "strip" "!buildflags")

# For installing from a local checkout, set source_dir to . and don't include
# a "source" param below
source_dir="$ARROW_HOME"
# else
# source_dir=apache-${_realname}-${pkgver}

# For released version:
#source=("https://archive.apache.org/dist/arrow/arrow-${pkgver}/apache-arrow-${pkgver}.tar.gz")
#sha256sums=("ac2a77dd9168e9892e432c474611e86ded0be6dfe15f689c948751d37f81391a")
# For github dev version:
# Append `#commit=54b1b2f688e5e84b4c664b1e12a95f93b94ab2f3` to the URL to select a revision
# source=("${source_dir}"::"git+https://github.com/apache/arrow")
# sha256sums=("SKIP")
# source_dir="${APPVEYOR_BUILD_FOLDER}/${source_dir}"

cpp_build_dir=build-${CARCH}-cpp

pkgver() {
  # The only purpose of this here is to cause the job to error if the
  # version in pkgver is different from what is in r/DESCRIPTION
  grep Version "${source_dir}/r/DESCRIPTION" | cut -d " " -f 2
}

build() {
  ARROW_CPP_DIR="${source_dir}/cpp"
  [[ -d ${cpp_build_dir} ]] && rm -rf ${cpp_build_dir}
  mkdir -p ${cpp_build_dir}
  pushd ${cpp_build_dir}

  # The Rtools libutf8proc is a static lib, but Findutf8proc.cmake doesn't
  # set the appropriate compiler definition.
  export CPPFLAGS="-DUTF8PROC_STATIC"

  # This is the difference between rtools-packages and rtools-backports
  # Remove this when submitting to rtools-packages
  if [ "$RTOOLS_VERSION" = "35" ]; then
    export CC="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin/gcc"
    export CXX="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin/g++"
    export PATH="/C/Rtools${MINGW_PREFIX/mingw/mingw_}/bin:$PATH"
    export CPPFLAGS="${CPPFLAGS} -I${MINGW_PREFIX}/include"
    export LIBS="-L${MINGW_PREFIX}/libs"
    export ARROW_S3=OFF
    export ARROW_WITH_RE2=OFF
    # Without this, some dataset functionality segfaults
    export CMAKE_UNITY_BUILD=ON
  else
    export ARROW_S3=ON
    export ARROW_WITH_RE2=ON
    # Without this, some compute functionality segfaults in tests
    export CMAKE_UNITY_BUILD=OFF
  fi

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
    ${MINGW_PREFIX}/bin/cmake.exe \
    ${ARROW_CPP_DIR} \
    -G "MSYS Makefiles" \
    -DARROW_BUILD_SHARED=OFF \
    -DARROW_BUILD_STATIC=ON \
    -DARROW_BUILD_UTILITIES=OFF \
    -DARROW_COMPUTE=ON \
    -DARROW_CSV=ON \
    -DARROW_DATASET=ON \
    -DARROW_FILESYSTEM=ON \
    -DARROW_HDFS=OFF \
    -DARROW_JEMALLOC=OFF \
    -DARROW_JSON=ON \
    -DARROW_LZ4_USE_SHARED=OFF \
    -DARROW_MIMALLOC=ON \
    -DARROW_PACKAGE_PREFIX="${MINGW_PREFIX}" \
    -DARROW_PARQUET=ON \
    -DARROW_S3="${ARROW_S3}" \
    -DARROW_SNAPPY_USE_SHARED=OFF \
    -DARROW_USE_GLOG=OFF \
    -DARROW_WITH_LZ4=ON \
    -DARROW_WITH_RE2="${ARROW_WITH_RE2}" \
    -DARROW_WITH_SNAPPY=ON \
    -DARROW_WITH_ZLIB=ON \
    -DARROW_WITH_ZSTD=ON \
    -DARROW_ZSTD_USE_SHARED=OFF \
    -DARROW_CXXFLAGS="${CPPFLAGS}" \
    -DCMAKE_BUILD_TYPE="release" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \
    -DCMAKE_VERBOSE_MAKEFILE=ON

  make -j3
  popd
}

package() {
  make -C ${cpp_build_dir} DESTDIR="${pkgdir}" install

  local PREFIX_DEPS=$(cygpath -am ${MINGW_PREFIX})
  pushd "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig"
  for pc in *.pc; do
    sed -s "s|${PREFIX_DEPS}|${MINGW_PREFIX}|g" -i $pc
  done
  popd
}