2022-06-11 09:19:59 -04:00
|
|
|
#!/bin/bash
|
2023-11-08 12:32:59 -05:00
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
|
2022-06-11 09:19:59 -04:00
|
|
|
export PATH
|
|
|
|
|
|
|
|
|
|
curPath=`pwd`
|
|
|
|
|
rootPath=$(dirname "$curPath")
|
|
|
|
|
rootPath=$(dirname "$rootPath")
|
|
|
|
|
rootPath=$(dirname "$rootPath")
|
|
|
|
|
rootPath=$(dirname "$rootPath")
|
|
|
|
|
|
2022-06-11 09:40:01 -04:00
|
|
|
# echo $rootPath
|
2022-06-11 09:19:59 -04:00
|
|
|
|
2022-06-11 09:40:01 -04:00
|
|
|
SERVER_ROOT=$rootPath/lib
|
|
|
|
|
SOURCE_ROOT=$rootPath/source/lib
|
2022-06-11 09:19:59 -04:00
|
|
|
|
2022-12-19 07:28:12 -05:00
|
|
|
HTTP_PREFIX="https://"
|
2023-11-10 05:47:32 -05:00
|
|
|
LOCAL_ADDR=common
|
2023-09-09 00:13:16 -04:00
|
|
|
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
2023-09-15 01:28:19 -04:00
|
|
|
if [ ! -z "$cn" ] || [ "$?" == "0" ] ;then
|
2023-11-10 05:47:32 -05:00
|
|
|
LOCAL_ADDR=cn
|
2024-02-08 03:46:43 -05:00
|
|
|
HTTP_PREFIX="https://mirror.ghproxy.com/"
|
2022-12-19 07:28:12 -05:00
|
|
|
fi
|
|
|
|
|
|
2022-06-11 09:40:01 -04:00
|
|
|
if [ ! -d ${SERVER_ROOT}/icu ];then
|
2023-11-10 05:47:32 -05:00
|
|
|
|
|
|
|
|
cd ${SOURCE_ROOT}
|
|
|
|
|
|
|
|
|
|
if [ "$LOCAL_ADDR" == 'cn' ];then
|
|
|
|
|
if [ ! -f ${SOURCE_ROOT}/icu4c-52_2-src.tgz ];then
|
2023-11-30 22:43:31 -05:00
|
|
|
wget --no-check-certificate -O ${SOURCE_ROOT}/icu4c-52_2-src.tgz https://dl.midoks.icu/lib/icu4c-52_2-src.tgz -T 20
|
2023-11-10 05:47:32 -05:00
|
|
|
fi
|
|
|
|
|
fi
|
2022-06-11 09:19:59 -04:00
|
|
|
|
2022-06-11 09:40:01 -04:00
|
|
|
if [ ! -f ${SOURCE_ROOT}/icu4c-52_2-src.tgz ];then
|
2023-11-10 05:47:32 -05:00
|
|
|
wget --no-check-certificate -O ${SOURCE_ROOT}/icu4c-52_2-src.tgz https://github.com/unicode-org/icu/releases/download/release-52-2/icu4c-52_2-src.tgz
|
2022-06-11 09:19:59 -04:00
|
|
|
fi
|
|
|
|
|
|
2023-10-30 14:08:29 -04:00
|
|
|
if [ ! -d ${SERVER_ROOT}/lib/icu/lib ];then
|
2022-06-11 09:40:01 -04:00
|
|
|
cd ${SOURCE_ROOT} && tar -zxvf icu4c-52_2-src.tgz
|
2022-06-11 09:19:59 -04:00
|
|
|
|
2022-06-11 09:40:01 -04:00
|
|
|
cd ${SOURCE_ROOT}/icu/source
|
|
|
|
|
./runConfigureICU Linux --prefix=${SERVER_ROOT}/icu && make CXXFLAGS="-g -O2 -std=c++11" && make install
|
2023-10-30 11:47:23 -04:00
|
|
|
|
|
|
|
|
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/www/server/lib/icu/lib
|
|
|
|
|
if [ -d /etc/ld.so.conf.d ];then
|
|
|
|
|
echo "/www/server/lib/icu/lib" > /etc/ld.so.conf.d/mw-icu.conf
|
2024-12-14 13:00:38 -05:00
|
|
|
elif [ -f /etc/ld.so.conf ]; then
|
2023-10-30 11:47:23 -04:00
|
|
|
echo "/www/server/lib/icu/lib" >> /etc/ld.so.conf
|
2023-10-30 13:45:41 -04:00
|
|
|
fi
|
2023-10-30 11:47:23 -04:00
|
|
|
|
|
|
|
|
ldconfig
|
2023-10-30 14:08:29 -04:00
|
|
|
|
2023-10-31 09:01:21 -04:00
|
|
|
cd $SOURCE_ROOT && rm -rf ${SOURCE_ROOT}/icu
|
2023-10-30 11:47:23 -04:00
|
|
|
fi
|
2022-06-11 09:19:59 -04:00
|
|
|
|
|
|
|
|
fi
|