<commit_before>FROM phusion/baseimage:latest

MAINTAINER <NAME> <<EMAIL>>

# Speed up install
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/docker && \
    echo "DPkg::Post-Invoke { \
             \"/bin/rm -f /var/cache/apt/archives/*.deb || true\"; \
         }; \
         Acquire::Languages \"none\"; \
         Acquire::GzipIndexes \"true\"; \
         Acquire::CompressionTypes::Order:: \"gz\"; \
         " > /etc/apt/apt.conf.d/docker

# Install dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -y \
    autoconf \
    bison \
    build-essential \
    flex \
    gawk \
    git \
    gperf \
    help2man \
    libexpat-dev \
    libncurses5-dev \
    libtool-bin \
    texinfo \
    wget

# Install crosstool-NG
RUN useradd -mU -d /mnt/data build && \
    git clone --branch xtensa-1.22.x --depth 1 \
        https://github.com/jcmvbkbc/crosstool-NG.git /tmp/crosstool-NG && \
    cd /tmp/crosstool-NG && \
    ./bootstrap && \
    ./configure --prefix=/usr/local && \
    make && \
    make install && \
    cp -Rf local-patches overlays \
        "/usr/local/lib/$(git rev-parse --short HEAD)" && \
    cd / && \
    rm -rf /tmp/crosstool-NG

# Build and install xtensa-lx106-elf compiler
RUN su build -c " \
        export PATH=\"/opt/crosstool-NG/bin:$PATH\" && \
        mkdir -p /tmp/xtensa-lx106-elf-build && \
        cd /tmp/xtensa-lx106-elf-build && \
        ct-ng xtensa-lx106-elf && \
        sed -i'' 's/^CT_DEBUG_gdb=y$/CT_DEBUG_gdb=n/g' .config && \
        sed -i'' \
            's/^CT_PREFIX_DIR=.*$/CT_PREFIX_DIR=\"\/tmp\/xtensa-lx106-elf\"/g' \
            .config && \
        ct-ng build \
    " && \
    cd / && \
    rm -rf /tmp/xtensa-lx106-elf-build && \
    rm /tmp/xtensa-lx106-elf/build.log.bz2 && \
    cp -Rf /tmp/xtensa-lx106-elf/* /usr/local && \
    rm -rf /tmp/xtensa-lx106-elf

# Add root directory
ADD root /

# Set up mount point for data
VOLUME /mnt/data

# Set entrypoint to run commands as build user
ENTRYPOINT ["/sbin/my_init", "--quiet", "--", "/sbin/runas", "build"]<commit_msg>Build a statically linked toolchain<commit_after>FROM phusion/baseimage:latest

MAINTAINER <NAME> <<EMAIL>>

# Speed up install
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/docker && \
    echo "DPkg::Post-Invoke { \
             \"/bin/rm -f /var/cache/apt/archives/*.deb || true\"; \
         }; \
         Acquire::Languages \"none\"; \
         Acquire::GzipIndexes \"true\"; \
         Acquire::CompressionTypes::Order:: \"gz\"; \
         " > /etc/apt/apt.conf.d/docker

# Install dependencies
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -y \
    autoconf \
    bison \
    build-essential \
    flex \
    gawk \
    git \
    gperf \
    help2man \
    libexpat-dev \
    libncurses5-dev \
    libtool-bin \
    texinfo \
    wget

# Install crosstool-NG
RUN useradd -mU -d /mnt/data build && \
    git clone --branch xtensa-1.22.x --depth 1 \
        https://github.com/jcmvbkbc/crosstool-NG.git /tmp/crosstool-NG && \
    cd /tmp/crosstool-NG && \
    ./bootstrap && \
    ./configure --prefix=/usr/local && \
    make && \
    make install && \
    cp -Rf local-patches overlays \
        "/usr/local/lib/$(git rev-parse --short HEAD)" && \
    cd / && \
    rm -rf /tmp/crosstool-NG

# Build and install xtensa-lx106-elf compiler
RUN su build -c " \
        export PATH=\"/opt/crosstool-NG/bin:$PATH\" && \
        mkdir -p /tmp/xtensa-lx106-elf-build && \
        cd /tmp/xtensa-lx106-elf-build && \
        ct-ng xtensa-lx106-elf && \
        sed -i'' 's/^CT_DEBUG_gdb=y$/CT_DEBUG_gdb=n/g' .config && \
        sed -i'' \
            's/^CT_PREFIX_DIR=.*$/CT_PREFIX_DIR=\"\/tmp\/xtensa-lx106-elf\"/g' \
            .config && \
        echo 'CT_WANTS_STATIC_LINK=y' >> .config && \
        echo 'CT_STATIC_TOOLCHAIN=y' >> .config && \
        echo 'CT_CC_GCC_STATIC_LIBSTDCXX=y' >> .config && \
        ct-ng build \
    " && \
    cd / && \
    rm -rf /tmp/xtensa-lx106-elf-build && \
    rm /tmp/xtensa-lx106-elf/build.log.bz2 && \
    cp -Rf /tmp/xtensa-lx106-elf/* /usr/local && \
    rm -rf /tmp/xtensa-lx106-elf

# Add root directory
ADD root /

# Set up mount point for data
VOLUME /mnt/data

# Set entrypoint to run commands as build user
ENTRYPOINT ["/sbin/my_init", "--quiet", "--", "/sbin/runas", "build"]
{'fraction_non_alphanumeric': 0.1734857142857143, 'fraction_numerical': 0.015542857142857143, 'mean_word_length': 1.8471047495120365, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '7083848', 'n_tokens_mistral': 1768, 'n_tokens_neox': 1644, 'n_words': 314}