#!/bin/bash # Builds the hand-written assets.compiled.cpp module into assets.jtc. # Mirrors build-shared.sh's compile/link tail exactly (same object cache, # same libCoreUtils_pic.a, same link line) but skips the jetc --shared # codegen step since there is no .jet source for this module. set -e JC="$(cd "/home/barant/servercore-analysis/JetCore" && pwd)" CU="$JC/../CoreUtils" HERE="$JC/jetc" STEM="assets" OUTPUT="$1" if [ -z "$OUTPUT" ]; then echo "usage: $0 " exit 1 fi echo "Building JetCore runtime objects as position-independent code..." list="" for f in "$JC"/*.cpp; do base=$(basename "$f") if [ "$base" = "jet-2.0.cpp" ]; then continue; fi obj="$HERE/${base%.cpp}.pic.o" if [ ! -f "$obj" ] || [ "$f" -nt "$obj" ]; then g++ -g -fPIC -c -std=c++23 -I"$CU" -I"$JC" "$f" -o "$obj" & fi list="$list $obj" done cu_pic_list="" cu_rebuilt=false for f in "$CU"/*.cpp; do base=$(basename "$f") obj="$HERE/cu_${base%.cpp}.pic.o" if [ ! -f "$obj" ] || [ "$f" -nt "$obj" ]; then g++ -g -fPIC -c -std=c++23 -I"$CU" "$f" -o "$obj" & cu_rebuilt=true fi cu_pic_list="$cu_pic_list $obj" done wait if [ "$cu_rebuilt" = true ] || [ ! -f "$HERE/libCoreUtils_pic.a" ]; then ar rcs "$HERE/libCoreUtils_pic.a" $cu_pic_list fi g++ -g -fPIC -c -std=c++23 -I"$CU" -I"$JC" "$HERE/$STEM.compiled.cpp" -o "$HERE/$STEM.compiled.pic.o" echo "Linking $OUTPUT..." g++ -shared -fPIC -o "$OUTPUT" "$HERE/$STEM.compiled.pic.o" $list -std=c++23 \ -L"$HERE" -lCoreUtils_pic -lmysqlclient -lcrypto echo "Built $OUTPUT"