@@ -100,6 +100,21 @@ if [[ -z "${PAWNCC_BIN}" ]]; then
100100 exit 1
101101fi
102102
103+ PAWNCC_LIB_DIR=" $( find " ${RUN_DIR} " -maxdepth 5 -type f -name libpawnc.so -printf ' %h\n' | head -n 1 || true) "
104+ if [[ -z " ${PAWNCC_LIB_DIR} " ]]; then
105+ PAWNCC_DIR=" $( dirname " ${PAWNCC_BIN} " ) "
106+ for candidate in \
107+ " ${PAWNCC_DIR} " \
108+ " ${PAWNCC_DIR} /lib" \
109+ " $( dirname " ${PAWNCC_DIR} " ) "
110+ do
111+ if [[ -f " ${candidate} /libpawnc.so" ]]; then
112+ PAWNCC_LIB_DIR=" ${candidate} "
113+ break
114+ fi
115+ done
116+ fi
117+
103118if [[ -n " ${OPEN_MP_INCLUDE_DIR} " && ! -d " ${OPEN_MP_INCLUDE_DIR} " ]]; then
104119 echo " WARNING: OPEN_MP_INCLUDE_DIR does not exist: ${OPEN_MP_INCLUDE_DIR} ; falling back to auto-detection."
105120 OPEN_MP_INCLUDE_DIR=" "
@@ -143,7 +158,19 @@ sed -E -i "s|^#define MYSQL_PASSWORD \".*\"$|#define MYSQL_PASSWORD \"${DB_PASS}
143158sed -E -i " s|^#define MYSQL_DATABASE \" .*\" $|#define MYSQL_DATABASE \" ${DB_NAME} \" |" " ${CI_UNIT_TEST_PWN} "
144159
145160echo " Compiling unit_test.pwn with ${PAWNCC_BIN} "
146- if ! " ${PAWNCC_BIN} " " ${CI_UNIT_TEST_PWN} " -D" ${ROOT_DIR} /tests" -d3 -Z \
161+ PAWNCC_ENV=()
162+ if [[ -n " ${PAWNCC_LIB_DIR} " ]]; then
163+ PAWNCC_LD_LIBRARY_PATH=" ${PAWNCC_LIB_DIR} "
164+ if [[ -n " ${LD_LIBRARY_PATH:- } " ]]; then
165+ PAWNCC_LD_LIBRARY_PATH=" ${PAWNCC_LD_LIBRARY_PATH} :${LD_LIBRARY_PATH} "
166+ fi
167+ echo " Using pawncc runtime library path: ${PAWNCC_LIB_DIR} "
168+ PAWNCC_ENV=(env " LD_LIBRARY_PATH=${PAWNCC_LD_LIBRARY_PATH} " )
169+ else
170+ echo " WARNING: libpawnc.so not found; running pawncc without extra LD_LIBRARY_PATH."
171+ fi
172+
173+ if ! " ${PAWNCC_ENV[@]} " " ${PAWNCC_BIN} " " ${CI_UNIT_TEST_PWN} " -D" ${ROOT_DIR} /tests" -d3 -Z \
147174 -i" ${ROOT_DIR} /tests/include" \
148175 -i" ${OPEN_MP_INCLUDE_DIR} " \
149176 -i" ${BUILD_DIR} /src" \
0 commit comments