<commit_before>#!/bin/sh

# A script to bootstrap cabal-install.

# It works by downloading and installing the Cabal, zlib and
# HTTP packages. It then installs cabal-install itself.
# It expects to be run inside the cabal-install directory.

# Install settings, you can override these by setting environment vars. E.g. if
# you don't want profiling and dynamic versions of libraries to be installed in
# addition to vanilla, run 'EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh'

#VERBOSE
DEFAULT_CONFIGURE_OPTS="--enable-library-profiling --enable-shared"
EXTRA_CONFIGURE_OPTS=${EXTRA_CONFIGURE_OPTS-$DEFAULT_CONFIGURE_OPTS}
#EXTRA_BUILD_OPTS
#EXTRA_INSTALL_OPTS

die() {
    printf "\nError during cabal-install bootstrap:\n%s\n" "$1" >&2
    exit 2
}

# programs, you can override these by setting environment vars
GHC="${GHC:-ghc}"
GHC_PKG="${GHC_PKG:-ghc-pkg}"
GHC_VER="$(${GHC} --numeric-version)"
HADDOCK=${HADDOCK:-haddock}
WGET="${WGET:-wget}"
CURL="${CURL:-curl}"
FETCH="${FETCH:-fetch}"
TAR="${TAR:-tar}"
GZIP_PROGRAM="${GZIP_PROGRAM:-gzip}"

# The variable SCOPE_OF_INSTALLATION can be set on the command line to
# use/install the libaries needed to build cabal-install to a custom package
# database instead of the user or global package database.
#
# Example:
#
# $ ghc-pkg init /my/package/database
# $ SCOPE_OF_INSTALLATION='--package-db=/my/package/database' ./bootstrap.sh
#
# You can also combine SCOPE_OF_INSTALLATION with PREFIX:
#
# $ ghc-pkg init /my/prefix/packages.conf.d
# $ SCOPE_OF_INSTALLATION='--package-db=/my/prefix/packages.conf.d' \
#   PREFIX=/my/prefix ./bootstrap.sh
#
# If you use the --global,--user or --sandbox arguments, this will
# override the SCOPE_OF_INSTALLATION setting and not use the package
# database you pass in the SCOPE_OF_INSTALLATION variable.

SCOPE_OF_INSTALLATION="${SCOPE_OF_INSTALLATION:---user}"
DEFAULT_PREFIX="${HOME}/.cabal"

# Try to respect $TMPDIR.
[ -"$TMPDIR"- = -""- ] &&
  export TMPDIR=/tmp/cabal-$(echo $(od -XN4 -An /dev/random)) && mkdir $TMPDIR

# Check for a C compiler, using user-set $CC, if any, first.
for c in $CC gcc clang cc icc; do
  $c --version 1>/dev/null 2>&1 && CC=$c &&
  echo "Using $c for C compiler. If this is not what you want, set CC." >&2 &&
  break
done

# None found.
[ -"$CC"- = -""- ] && die 'C compiler not found (or could not be run).
  If a C compiler is installed make sure it is on your PATH, or set $CC.'<commit_msg>bootstrap.sh: assign first and use later<commit_after>#!/bin/sh

# A script to bootstrap cabal-install.

# It works by downloading and installing the Cabal, zlib and
# HTTP packages. It then installs cabal-install itself.
# It expects to be run inside the cabal-install directory.

# Install settings, you can override these by setting environment vars. E.g. if
# you don't want profiling and dynamic versions of libraries to be installed in
# addition to vanilla, run 'EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh'

#VERBOSE
DEFAULT_CONFIGURE_OPTS="--enable-library-profiling --enable-shared"
EXTRA_CONFIGURE_OPTS=${EXTRA_CONFIGURE_OPTS-$DEFAULT_CONFIGURE_OPTS}
#EXTRA_BUILD_OPTS
#EXTRA_INSTALL_OPTS

die() {
    printf "\nError during cabal-install bootstrap:\n%s\n" "$1" >&2
    exit 2
}

# programs, you can override these by setting environment vars
GHC="${GHC:-ghc}"
GHC_PKG="${GHC_PKG:-ghc-pkg}"
GHC_VER="$(${GHC} --numeric-version)"
HADDOCK=${HADDOCK:-haddock}
WGET="${WGET:-wget}"
CURL="${CURL:-curl}"
FETCH="${FETCH:-fetch}"
TAR="${TAR:-tar}"
GZIP_PROGRAM="${GZIP_PROGRAM:-gzip}"

# The variable SCOPE_OF_INSTALLATION can be set on the command line to
# use/install the libaries needed to build cabal-install to a custom package
# database instead of the user or global package database.
#
# Example:
#
# $ ghc-pkg init /my/package/database
# $ SCOPE_OF_INSTALLATION='--package-db=/my/package/database' ./bootstrap.sh
#
# You can also combine SCOPE_OF_INSTALLATION with PREFIX:
#
# $ ghc-pkg init /my/prefix/packages.conf.d
# $ SCOPE_OF_INSTALLATION='--package-db=/my/prefix/packages.conf.d' \
#   PREFIX=/my/prefix ./bootstrap.sh
#
# If you use the --global,--user or --sandbox arguments, this will
# override the SCOPE_OF_INSTALLATION setting and not use the package
# database you pass in the SCOPE_OF_INSTALLATION variable.

SCOPE_OF_INSTALLATION="${SCOPE_OF_INSTALLATION:---user}"
DEFAULT_PREFIX="${HOME}/.cabal"

TMPDIR=$(mktemp -d -p /tmp -t cabal-XXXXXXX)
export TMPDIR

# Check for a C compiler, using user-set $CC, if any, first.
for c in $CC gcc clang cc icc; do
  $c --version 1>/dev/null 2>&1 && CC=$c &&
  echo "Using $c for C compiler. If this is not what you want, set CC." >&2 &&
  break
done

# None found.
[ -"$CC"- = -""- ] && die 'C compiler not found (or could not be run).
  If a C compiler is installed make sure it is on your PATH, or set $CC.'
{'fraction_non_alphanumeric': 0.13546232519307033, 'fraction_numerical': 0.0031308703819661866, 'mean_word_length': 4.348214285714286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1750047', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1622, 'n_words': 521}