Merge pull request #2318 from dhiltgen/more_clean
Harden generate patching model
This commit is contained in:
commit
f43dea68d1
1 changed files with 18 additions and 8 deletions
|
@ -65,6 +65,7 @@ apply_patches() {
|
||||||
echo 'include (../../../ext_server/CMakeLists.txt) # ollama' >>${LLAMACPP_DIR}/examples/server/CMakeLists.txt
|
echo 'include (../../../ext_server/CMakeLists.txt) # ollama' >>${LLAMACPP_DIR}/examples/server/CMakeLists.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$(ls -A ../patches/*.diff)" ]; then
|
||||||
# apply temporary patches until fix is upstream
|
# apply temporary patches until fix is upstream
|
||||||
for patch in ../patches/*.diff; do
|
for patch in ../patches/*.diff; do
|
||||||
for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/); do
|
for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/); do
|
||||||
|
@ -74,6 +75,7 @@ apply_patches() {
|
||||||
for patch in ../patches/*.diff; do
|
for patch in ../patches/*.diff; do
|
||||||
(cd ${LLAMACPP_DIR} && git apply ${patch})
|
(cd ${LLAMACPP_DIR} && git apply ${patch})
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Avoid duplicate main symbols when we link into the cgo binary
|
# Avoid duplicate main symbols when we link into the cgo binary
|
||||||
sed -e 's/int main(/int __main(/g' <${LLAMACPP_DIR}/examples/server/server.cpp >${LLAMACPP_DIR}/examples/server/server.cpp.tmp &&
|
sed -e 's/int main(/int __main(/g' <${LLAMACPP_DIR}/examples/server/server.cpp >${LLAMACPP_DIR}/examples/server/server.cpp.tmp &&
|
||||||
|
@ -112,4 +114,12 @@ compress_libs() {
|
||||||
# Keep the local tree clean after we're done with the build
|
# Keep the local tree clean after we're done with the build
|
||||||
cleanup() {
|
cleanup() {
|
||||||
(cd ${LLAMACPP_DIR}/examples/server/ && git checkout CMakeLists.txt server.cpp)
|
(cd ${LLAMACPP_DIR}/examples/server/ && git checkout CMakeLists.txt server.cpp)
|
||||||
|
|
||||||
|
if [ -n "$(ls -A ../patches/*.diff)" ]; then
|
||||||
|
for patch in ../patches/*.diff; do
|
||||||
|
for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/); do
|
||||||
|
(cd ${LLAMACPP_DIR}; git checkout ${file})
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue