|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | + |
| 20 | +set -x |
| 21 | + |
| 22 | +pacman --sync --noconfirm ccache |
| 23 | + |
| 24 | +wget https://raw.githubusercontent.com/r-windows/rtools-backports/master/pacman.conf |
| 25 | +cp -f pacman.conf /etc/pacman.conf |
| 26 | + |
| 27 | +pacman --noconfirm -Scc |
| 28 | +pacman --noconfirm -Syyu |
| 29 | +pacman --noconfirm --needed -S git base-devel binutils zip |
| 30 | + |
| 31 | +# Install core build stuff |
| 32 | +pacman --noconfirm --needed -S mingw-w64-{i686,x86_64}-{toolchain,crt,winpthreads,gcc,libtre,pkg-config,xz} |
| 33 | + |
| 34 | +# Force static linking |
| 35 | +rm -f /mingw32/lib/*.dll.a |
| 36 | +rm -f /mingw64/lib/*.dll.a |
| 37 | +export PKG_CONFIG="/${MINGW_PREFIX}/bin/pkg-config --static" |
| 38 | + |
| 39 | +cp ci/scripts/PKGBUILD . |
| 40 | +export PKGEXT='.pkg.tar.xz' # pacman default changed to .zst in 2020, but keep the old ext for compat |
| 41 | +unset BOOST_ROOT |
| 42 | +printenv |
| 43 | +makepkg-mingw --noconfirm --noprogressbar --skippgpcheck --nocheck --syncdeps --cleanbuild |
| 44 | + |
| 45 | +# Collect the build artifacts and make the shape of zip file that rwinlib expects |
| 46 | +ls |
| 47 | +mkdir build |
| 48 | +cp mingw* build |
| 49 | +cd build |
| 50 | + |
| 51 | +# This may vary by system/CI provider |
| 52 | +MSYS_LIB_DIR="D:/a/_temp/msys/msys64" |
| 53 | + |
| 54 | +ls $MSYS_LIB_DIR/mingw64/lib/ |
| 55 | +ls $MSYS_LIB_DIR/mingw32/lib/ |
| 56 | + |
| 57 | +VERSION=$(grep Version ../r/DESCRIPTION | cut -d " " -f 2) |
| 58 | +DST_DIR="arrow-$VERSION" |
| 59 | + |
| 60 | +# Untar the two builds we made |
| 61 | +ls | xargs -n 1 tar -xJf |
| 62 | +mkdir $DST_DIR |
| 63 | +# Grab the headers from one, either one is fine |
| 64 | +mv mingw64/include $DST_DIR |
| 65 | + |
| 66 | +# Make the rest of the directory structure |
| 67 | +# lib-4.9.3 is for libraries compiled with gcc 4.9 (Rtools 3.5) |
| 68 | +mkdir -p $DST_DIR/lib-4.9.3/x64 |
| 69 | +mkdir -p $DST_DIR/lib-4.9.3/i386 |
| 70 | +# lib is for the new gcc 8 toolchain (Rtools 4.0) |
| 71 | +mkdir -p $DST_DIR/lib/x64 |
| 72 | +mkdir -p $DST_DIR/lib/i386 |
| 73 | + |
| 74 | +# Move the 64-bit versions of libarrow into the expected location |
| 75 | +mv mingw64/lib/*.a $DST_DIR/lib-4.9.3/x64 |
| 76 | +# Same for the 32-bit versions |
| 77 | +mv mingw32/lib/*.a $DST_DIR/lib-4.9.3/i386 |
| 78 | + |
| 79 | +# These are from https://dl.bintray.com/rtools/backports/ |
| 80 | +cp $MSYS_LIB_DIR/mingw64/lib/lib{thrift,snappy,boost*}.a $DST_DIR/lib-4.9.3/x64 |
| 81 | +cp $MSYS_LIB_DIR/mingw32/lib/lib{thrift,snappy,boost*}.a $DST_DIR/lib-4.9.3/i386 |
| 82 | + |
| 83 | +# These are from https://dl.bintray.com/rtools/mingw{32,64}/ |
| 84 | +cp $MSYS_LIB_DIR/mingw64/lib/lib{zstd,lz4,crypto}.a $DST_DIR/lib/x64 |
| 85 | +cp $MSYS_LIB_DIR/mingw32/lib/lib{zstd,lz4,crypto}.a $DST_DIR/lib/i386 |
| 86 | + |
| 87 | +# Create build artifact |
| 88 | +zip -r ${DST_DIR}.zip $DST_DIR |
| 89 | + |
| 90 | +# Copy that to a file name/path that does not vary by version number so we |
| 91 | +# can easily find it in the R package tests on CI |
| 92 | +cp ${DST_DIR}.zip ../libarrow.zip |
0 commit comments