赞
踩
RED=$(tput setaf 1) GREEN=$(tput setaf 2) RES=$(tput sgr0) #清除颜色 function pause() { echo "${RED}Press any key to continue!${RES}" dd if=/dev/tty bs=1 count=1 2> /dev/null } function open_package() { tar_dir=$1 #压缩包路径 src_dir=$2 run_cmd=$3 #解压 if [ ! -d ./build_env/${src_dir} ] ; then echo "tar package $tar_dir" tar -xf ${tar_dir} -C ./build_env/ fi # 执行操作 $run_cmd } function build_proj() { pkg_type=$1 #安装包名称 tar_dir=$2 #压缩包路径 src_dir=$3 #configure路径 ex_config=$4 #congfiure扩展 make_config=$5 #安装路径 prefix_dir=/home/$USER/qgis_libs/${pkg_type} echo $pkg_type---$tar_dir----$src_dir----$ex_config---$make_config #判断 已安装 文件夹 if [ ! -d ${prefix_dir} ] ; then #解压 if [ ! -d ./build_env/${src_dir} ] ; then tar -xf tars/${tar_dir} -C ./build_env/ fi TEMPPWD=$PWD cd ./build_env/${src_dir}/ ./configure --prefix=${prefix_dir} ${ex_config} make -j4 $make_config make -j4 install $make_config cd $TEMPPWD fi # 不存在 安装 文件夹 if [ ! -d ${prefix_dir} ] ; then pause fi #环境变量 export PATH=$PATH:${prefix_dir}/bin export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${prefix_dir}/lib/pkgconfig export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${prefix_dir}/lib echo "${GREEN} ${pkg_type} ok ${RES}" } function cmake_proj() { pkg_type=$1 #安装包名称 src_dir=$2 #configure路径 ex_config=$3 #congfiure扩展 make_config=$4 echo $pkg_type---$src_dir---$ex_config--$make_config #安装路径 prefix_dir=/home/$USER/qgis_libs/${pkg_type} #判断 已安装 文件夹 if [ ! -d ${prefix_dir} ] ; then TEMPPWD=$PWD cd ${src_dir} #源码位置 /home/$USER/cmake-3.13.2/bin/cmake -S $PWD -B ./mybuild/ -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${prefix_dir} ${ex_config} cd ./mybuild/ make -j4 $make_config make -j4 install $make_config cd $TEMPPWD fi # 不存在 安装 文件夹 if [ ! -d ${prefix_dir} ] ; then pause fi #环境变量 export PATH=$PATH:${prefix_dir}/bin export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${prefix_dir}/lib/pkgconfig export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${prefix_dir}/lib echo "${GREEN} ${pkg_type} ok ${RES}" } ###################################### ###################################### ###################################### mkdir ./build_env #libxm build_proj libxml2 libxml2-2.7.8.tar.gz libxml2-2.7.8 #freexl build_proj freexl freexl_1.0.5.orig.tar.gz freexl-1.0.5 # #zlib build_proj zlib zlib-1.2.11.tar.gz zlib-1.2.11 #sqlite3 # /usr/lib/x86_64-linux-gnu/ # build_proj tcl envs/tcl8.6.13-src.tar.gz tcl8.6.13/unix # mkdir ./build_env/sqlite-amalgamation-3150100 # cmake_proj sqlite3 sqlite-amalgamation-3150100 #libiconv ### gets error 处理 open_package ./tars/libiconv-1.14.tar.gz libiconv-1.14 sed -i -e '/gets is a security/d' ./build_env/libiconv-1.14/srclib/stdio.in.h build_proj libiconv libiconv-1.14.tar.gz libiconv-1.14 #geos build_proj geos geos-3.5.0.tar.bz2 geos-3.5.0 #proj build_proj proj proj-4.9.3.tar.gz proj-4.9.3 #libspatialite 依赖 sqlite3/zlib/freexl/libiconv/proj/geos/libxml2 #proj_api.h not found export CPPFLAGS="-I/home/$USER/qgis_libs/proj/include -I/home/$USER/qgis_libs/freexl/include -I/home/$USER/qgis_libs/libxml2/include/libxml2 -I/home/$USER/qgis_libs/geos/include" export LDFLAGS="-L/home/$USER/qgis_libs/proj/lib -L/home/$USER/qgis_libs/freexl/lib -L/home/$USER/qgis_libs/geos/lib" build_proj libspatialite libspatialite-4.3.0.tar.gz libspatialite-4.3.0 "--with-pic" #gdal 依赖 build_proj gdal gdal-2.2.0.tar.gz gdal-2.2.0/gdal "--with-proj=~/qgis_libs/proj --with-geos=~/qgis_libs/geos" #spatialindex build_proj spatialindex spatialindex-src-1.8.0.tar.gz spatialindex-src-1.8.0 #libexpat open_package ./tars/libexpat-R_2_1_0.tar.gz libexpat-R_2_1_0 cmake_proj libexpat build_env/libexpat-R_2_1_0/expat "-DBUILD_tools=OFF" ##### QT 工程 ######## MY_QT_PATH=~/3rd_party/qt #qca open_package ./tars/qca-2.1.3.tar.xz qca-2.1.3 cmake_proj qca ./build_env/qca-2.1.3 "-DCMAKE_PREFIX_PATH=$MY_QT_PATH -DBUILD_TESTS=OFF" #qscintilla open_package ./tars/qscintilla-2.10.8.tar.gz qscintilla-2.10.8 cp ./myconfigs/qscintilla/CMakeLists.txt ./build_env/qscintilla-2.10.8/Qt4Qt5/CMakeLists.txt cmake_proj qscintilla ./build_env/qscintilla-2.10.8/Qt4Qt5 "-DCMAKE_PREFIX_PATH=$MY_QT_PATH -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON" #qwt open_package ./tars/qwt-6.1.2.tar.bz2 qwt-6.1.2 cp ./myconfigs/qwt/CMakeLists.txt ./build_env/qwt-6.1.2/CMakeLists.txt cmake_proj qwt ./build_env/qwt-6.1.2 "-DCMAKE_PREFIX_PATH=$MY_QT_PATH" ######### QGIS ####### # export PATH=$PATH:~/3rd_party/m4-1.4.18/bin export PATH=$PATH:~/3rd_party/flex-2.6.4/bin export PATH=$PATH:~/3rd_party/bison-2.7/bin #解压文件 open_package ./tars/QGIS-final-2_18_0.tar.gz QGIS-final-2_18_0 # expat.h not found export CPLUS_INCLUDE_PATH="/home/$USER/qgis_libs/libexpat/include" # invalid use of incomplete type *** #第N行添加include sed -i '52s/.*/#include <QButtonGroup>/g' ./build_env/QGIS-final-2_18_0/src/gui/symbology-ng/qgssymbollayerv2widget.cpp sed -i '29s/.*/#include <QHeaderView>/g' ./build_env/QGIS-final-2_18_0/src/gui/symbology-ng/qgsvectorgradientcolorrampv2dialog.cpp sed -i '27s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp sed -i '30s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/wms/qgswmsdataitems.cpp sed -i '32s/.*/#include <QHeaderView>/g' ./build_env/QGIS-final-2_18_0/src/gui/qgscompoundcolorwidget.cpp sed -i '19s/.*/#include <QDoubleValidator>/g' ./build_env/QGIS-final-2_18_0/src/gui/qgsextentgroupbox.cpp sed -i '18s/.*/#include <QValidator>/g' ./build_env/QGIS-final-2_18_0/src/gui/qgsgroupwmsdatadialog.cpp sed -i '36s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/gui/qgsmaptoolcapture.cpp sed -i '39s/.*/#include <QButtonGroup>/g' ./build_env/QGIS-final-2_18_0/src/gui/qgssourceselectdialog.cpp sed -i '26s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/ows/qgsowsdataitems.cpp sed -i '27s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/wcs/qgswcsdataitems.cpp sed -i '35s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/mssql/qgsmssqldataitems.cpp sed -i '28s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/wfs/qgswfsdataitems.cpp sed -i '32s/.*/#include <QAction>/g' ./build_env/QGIS-final-2_18_0/src/providers/db2/qgsdb2dataitems.cpp #find_package查询路径设置 MY_QGIS_ENV_PATH="$MY_QT_PATH;~/qgis_libs/qca;~/qgis_libs/libexpat;~/qgis_libs/proj;~/qgis_libs/qscintilla;~/qgis_libs/qwt;~/qgis_libs/spatialindex;~/qgis_libs/libspatialite" cmake_proj qgis ./build_env/QGIS-final-2_18_0 "-DCMAKE_PREFIX_PATH=$MY_QGIS_ENV_PATH -DWITH_BINDINGS=OFF -DWITH_QTWEBKIT=OFF -DENABLE_QT5=ON -WITH_GRASS=FALSE -DWITH_POSTGRESQL=FALSE -DENABLE_TESTS=FALSE -DWITH_DESKTOP=FALSE"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。