File ghc-socks.spec of Package ghc-socks
Source: socks-0.6.1.tar.gz
Name: ghc-socks
Version: 0.6.1
Release: 1.1
Summary: Socks proxy (ver 5)
License: BSD3
Group: Development/Libraries
BuildRequires: ghc
Requires: ghc
AutoReqProv: no
%description
Socks proxy (version 5) implementation.
%prep
%setup -q -n socks-0.6.1
%build
# Build using Cabal's Setup explicitly to avoid any RPM macros that may inject
# incompatible GHC flags (such as -fobject-determinism) on some architectures.
LANG=C.utf8
# If the Setup executable was compiled automatically, replace it with a wrapper
# that strips any -fobject-determinism occurrences from arguments passed to ghc
# via --ghc-options or as standalone args, since some GHC builds on certain
# architectures do not recognize that flag.
if [ -x Setup ]; then
mv Setup Setup.real
cat > Setup <<'EOF'
#!/bin/sh
# Wrapper to remove -fobject-determinism from arguments
newargs=""
for a in "$@"; do
if [ "$a" = "-fobject-determinism" ]; then
# skip this flag
continue
fi
case "$a" in
--ghc-options=*)
val="${a#--ghc-options=}"
cleansed="$(printf '%s' "$val" | sed -e 's/-fobject-determinism//g' -e 's/ */ /g' -e 's/^ *//;s/ *$//')"
if [ -n "$cleansed" ]; then
newargs="$newargs --ghc-options=$cleansed"
fi
;;
*)
newargs="$newargs $a"
;;
esac
done
# reset positional parameters
eval set -- "$newargs"
exec ./Setup.real "$@"
EOF
chmod +x Setup
fi
./Setup configure --prefix=/usr --libdir=/usr/lib64 --docdir=/usr/share/licenses/ghc-socks \
'--libsubdir=$compiler/lib/$pkgid' '--datasubdir=$pkgid' '--libexecsubdir=$pkgid' \
--ghc --dynlibdir=/usr/lib64/ghc-9.10.2/lib -v \
--enable-library-profiling --enable-shared --htmldir=/usr/share/doc/packages/ghc-9.10.2/html/libraries/socks-0.6.1
./Setup build
%install
# Install into RPM buildroot using Cabal's Setup copy to avoid invoking any
# packaging macros that might add unwanted GHC options.
rm -rf %{buildroot}
./Setup copy --destdir=%{buildroot} --prefix=/usr
%files
%license LICENSE
%doc README.md
/usr/lib64/ghc-*/hs-socks-0.6.1