<commit_before>#!/bin/bash
set -e

PREFIX=musldist
LIB=$PREFIX/lib
DRYAD=/tmp/dryad.so.1
TESTDIR=test

echo -e "PT_INTERPRETER for $TESTDIR/ binaries is $DRYAD\nBinaries prefixed with 'ld' use the system dynamic linker, ld-linux-x86-64.so.2"

echo -e "Building regular binary $TESTDIR/test with libm and libc"
gcc -lm -Wl,-I,$DRYAD $TESTDIR/test.c -o $TESTDIR/test
gcc -lm $TESTDIR/test.c -o $TESTDIR/ldtest

echo -e "Building thread local binary $TESTDIR/tlocal with pthreads and libc"
gcc -lpthread -Wl,-I,$DRYAD $TESTDIR/tlocal.c -o $TESTDIR/tlocal
gcc -lpthread $TESTDIR/tlocal.c -o $TESTDIR/ldtlocal

echo -e "Building complicated binary $TESTDIR/snappy linked with libm and snappy (on my system snappy uses libstdc++.so.6, libm.so.6, libc.so.6, and libgcc_s.so.1)"
gcc -lm -lsnappy -Wl,-I,$DRYAD $TESTDIR/snappy.c -o $TESTDIR/snappy
gcc -lm -lsnappy $TESTDIR/snappy.c -o $TESTDIR/ldsnappy

echo -e "Building a binary $TESTDIR/float with libm that performs no printing"
gcc -lm -Wl,-I,$DRYAD $TESTDIR/float.c -o $TESTDIR/float
gcc -lm $TESTDIR/float.c -o $TESTDIR/ldfloat

# uncomment this and use $LIB with a `libc.so` to create a musl binary to test with
#echo -e "Building musl linked binary $TESTDIR/musl"
#gcc -nodefaultlibs -nostdlib -Wl,-I$DRYAD -L$LIB -lc $LIB/Scrt1.o $TESTDIR/musl.c -o $TESTDIR/musl
#gcc -nodefaultlibs -nostdlib -L$LIB -lc $LIB/Scrt1.o $TESTDIR/musl.c -o $TESTDIR/ldmusl
#
#export LD_LIBRARY_PATH=/home/m4b/src/musl-1.1.14/lib<commit_msg>build, tests: put -l flags after everything because machines are jerks<commit_after>#!/bin/bash
set -e

PREFIX=musldist
LIB=$PREFIX/lib
DRYAD=/tmp/dryad.so.1
TESTDIR=test

echo -e "PT_INTERPRETER for $TESTDIR/ binaries is $DRYAD\nBinaries prefixed with 'ld' use the system dynamic linker, ld-linux-x86-64.so.2"

echo -e "Building regular binary $TESTDIR/test with libm and libc"
gcc -Wl,-I,$DRYAD $TESTDIR/test.c -o $TESTDIR/test -lm
gcc $TESTDIR/test.c -o $TESTDIR/ldtest -lm

echo -e "Building thread local binary $TESTDIR/tlocal with pthreads and libc"
gcc -Wl,-I,$DRYAD $TESTDIR/tlocal.c -o $TESTDIR/tlocal -lpthread
gcc $TESTDIR/tlocal.c -o $TESTDIR/ldtlocal -lpthread

echo -e "Building complicated binary $TESTDIR/snappy linked with libm and snappy (on my system snappy uses libstdc++.so.6, libm.so.6, libc.so.6, and libgcc_s.so.1)"
gcc -Wl,-I,$DRYAD $TESTDIR/snappy.c -o $TESTDIR/snappy -lm -lsnappy
gcc $TESTDIR/snappy.c -o $TESTDIR/ldsnappy -lm -lsnappy

echo -e "Building a binary $TESTDIR/float with libm that performs no printing"
gcc -Wl,-I,$DRYAD $TESTDIR/float.c -o $TESTDIR/float -lm
gcc $TESTDIR/float.c -o $TESTDIR/ldfloat -lm

# uncomment this and use $LIB with a `libc.so` to create a musl binary to test with
#echo -e "Building musl linked binary $TESTDIR/musl"
#gcc -nodefaultlibs -nostdlib -Wl,-I$DRYAD -L$LIB -lc $LIB/Scrt1.o $TESTDIR/musl.c -o $TESTDIR/musl
#gcc -nodefaultlibs -nostdlib -L$LIB -lc $LIB/Scrt1.o $TESTDIR/musl.c -o $TESTDIR/ldmusl
#
#export LD_LIBRARY_PATH=/home/m4b/src/musl-1.1.14/lib
{'fraction_non_alphanumeric': 0.13571190396798932, 'fraction_numerical': 0.011337112370790263, 'mean_word_length': 4.05050505050505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4348438', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1202, 'n_words': 345}