Fixing build file to utilize gcc

This commit is contained in:
vandomej 2025-09-19 11:33:56 -07:00
parent 2ba2cda772
commit 28c71177df
2 changed files with 11 additions and 15 deletions

View file

@ -1,12 +1,11 @@
FROM alpine:latest
# Install all necessary tools: git, musl-gcc (which is just gcc in Alpine), make
# Install all necessary tools: git, build tools
RUN apk add --no-cache \
git \
build-base \
musl-dev
build-base
# Create a non-root user to run the build (best practice)
# Create a non-root user to run the build
RUN adduser -D builder
USER builder
WORKDIR /home/builder

View file

@ -1,18 +1,15 @@
#!/bin/sh
# Clone the specific FANN version you want (e.g., latest from master)
# Clone the specific FANN version you want
git clone https://github.com/libfann/fann.git
cd fann/src
# Build the library exactly as you specified
musl-gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o floatfann.o floatfann.c
musl-gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o doublefann.o doublefann.c
musl-gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o fixedfann.o fixedfann.c
# Build the library with gcc (which uses musl in Alpine)
gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o floatfann.o floatfann.c
gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o doublefann.o doublefann.c
gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o fixedfann.o fixedfann.c
ar rcs libfann.a floatfann.o doublefann.o fixedfann.o
# Copy the crucial artifacts to a folder called 'output'
# TeamCity will look for files in the working directory after the build.
cp libfann.a ~/output/
cp ../src/include/fann.h ~/output/
echo "Build complete! Artifacts are in the 'output' directory."
# Copy artifacts to the output directory in the home folder
cp libfann.a /home/builder/output/
cp ../src/include/fann.h /home/builder/output/