<commit_before>#!/bin/sh

set -e
set -x
[ -n "$DESTDIR" ] || export DESTDIR=$HOME/prefix

rm -rf $DESTDIR || exit 1
make clean || true # ignore failures

aclocal || exit 1
libtoolize --force || exit 1
autoheader || exit 1
automake -a || exit 1
autoconf || exit 1
./configure --prefix=/usr || exit 1

# This is a complete hack, can't find an easy way to disable
# 32bit arch on OSX
# brew install pcre libyaml
if [ "$(uname -s)" = "Darwin" ]; then
  perl -pi -wle's/-arch i386//g' Makefile src/Makefile
fi
make || exit 1
make install  || exit 1
cd perl
sh ./build || exit 1
cd ..

cp -a ../root/* $DESTDIR/

# hacks to get config going
#mkdir $DESTDIR/etc
# cp ../root/etc/libcrange.conf.example $DESTDIR/etc/range.conf <commit_msg>incorporate some fixes from https://github.com/eam/libcrange/pull/2, avoid /usr/bin/perl on OSX per https://github.com/eam/libcrange/issues/7<commit_after>#!/bin/sh

set -e
set -x
[ -n "$DESTDIR" ] || export DESTDIR=$HOME/prefix

rm -rf $DESTDIR
make clean || true # ignore failures

aclocal
case "${OSTYPE}" in
  darwin*)
    glibtoolize --force # brew
    ;;
  *)
    libtoolize --force
    ;;
esac
autoheader
automake -a
autoconf

case "${OSTYPE}" in
  darwin*)

    # brewperl. /usr/bin/perl on osx results in https://github.com/eam/libcrange/issues/7
    ./configure --prefix=/usr --enable-perl=/opt/local/bin/perl

    # This is a complete hack, can't find an easy way to disable
    # 32bit arch on OSX
    perl -pi -wle's/-arch i386//g' Makefile src/Makefile
    ;;
  *)
    ./configure --prefix=/usr --enable-perl=/opt/local/bin/perl 
    ;;
esac
make
make install
cd perl
sh ./build
cd ..

cp -a ../root/* $DESTDIR/

# hacks to get config going
#mkdir $DESTDIR/etc
# cp ../root/etc/libcrange.conf.example $DESTDIR/etc/range.conf 
{'fraction_non_alphanumeric': 0.15084745762711865, 'fraction_numerical': 0.012994350282485875, 'mean_word_length': 2.87527352297593, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3547436', 'n_tokens_mistral': 704, 'n_tokens_neox': 641, 'n_words': 204}