Skip to content

Unpack: migrate internally to OsPath #51

Unpack: migrate internally to OsPath

Unpack: migrate internally to OsPath #51

Workflow file for this run

name: emulated
on:
- push
- pull_request
defaults:
run:
shell: bash
jobs:
# Emulation is incredibly slow and memory demanding. It seems that any
# executable with GHC RTS takes at least 7-8 Gb of RAM, so we can run
# `cabal` or `ghc` on their own, but cannot run them both at the same time,
# striking out `cabal test`. Instead we rely on system packages and invoke
# `ghc --make` manually, and even so `ghc -O` is prohibitively expensive.
emulated:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch: ['s390x', 'ppc64le']
steps:
- uses: actions/checkout@v3
- uses: uraimo/[email protected]
timeout-minutes: 60
with:
arch: ${{ matrix.arch }}
distro: ubuntu_rolling
githubToken: ${{ github.token }}
install: |
apt-get update -y
apt-get install -y autoconf build-essential curl ghc libghc-tasty-quickcheck-dev libghc-file-embed-dev libghc-temporary-dev
run: |
curl -s https://hackage.haskell.org/package/os-string-2.0.6/os-string-2.0.6.tar.gz | tar xz
curl -s https://hackage.haskell.org/package/filepath-1.5.3.0/filepath-1.5.3.0.tar.gz | tar xz
curl -s https://hackage.haskell.org/package/file-io-0.1.4/file-io-0.1.4.tar.gz | tar xz
curl -s https://hackage.haskell.org/package/unix-2.8.5.1/unix-2.8.5.1.tar.gz | tar xz
curl -s https://hackage.haskell.org/package/directory-1.3.8.5/directory-1.3.8.5.tar.gz | tar xz
cd unix-2.8.5.1
chmod +x configure
./configure
find /usr/lib/ghc -iname HsFFI.h
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Directory.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Directory/Common.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Directory/PosixPath.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Env/Internal.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Files/Common.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Files/PosixString.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/IO/Common.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/IO/PosixString.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/User/ByteString.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/User/Common.hsc
sed -i -e 's/MIN_VERSION_base(4, 11, 0)/1/g' System/Posix/Files.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Files.hsc
sed -i -e 's/MIN_VERSION_filepath(1, 5, 0)/1/g' System/Posix/Env/PosixString.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/Env/PosixString.hsc
sed -i -e 's/MIN_VERSION_filepath(1, 5, 0)/1/g' System/Posix/PosixPath/FilePath.hsc
sed -i -e 's/MIN_VERSION_base(4, 11, 0)/1/g' System/Posix/PosixPath/FilePath.hsc
hsc2hs -Iinclude -I$(dirname $(find /usr/lib/ghc -iname HsFFI.h)) System/Posix/PosixPath/FilePath.hsc
cd ..
cd directory-1.3.8.5
chmod +x configure
./configure
hsc2hs -I. System/Directory/Internal/Posix.hsc
cd ..
find . -iname '*.hs' -type f -exec sed -i.bck 's/import "filepath"/import/g' {} \;
find . -iname '*.hs' -type f -exec sed -i.bck 's/import "os-string"/import/g' {} \;
find . -iname '*.hs' -type f -exec sed -i.bck 's/import qualified "filepath"/import qualified/g' {} \;
find . -iname '*.hs' -type f -exec sed -i.bck 's/import qualified "os-string"/import qualified/g' {} \;
sed -i -e 's/MIN_VERSION_filepath(1, 5, 0)/1/g' file-io-0.1.4/posix/System/File/Platform.hs
sed -i -e 's/MIN_VERSION_filepath(1, 5, 0)/1/g' file-io-0.1.4/System/File/OsPath/Internal.hs
ghc --version
ghc --make -fno-safe-haskell -itest:os-string-2.0.6:filepath-1.5.3.0:file-io-0.1.4:file-io-0.1.4/posix:unix-2.8.5.1:directory-1.3.8.5 -Iunix-2.8.5.1/include:directory-1.3.8.5 -o Main test/Properties.hs +RTS -s
./Main +RTS -s