差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:openlitespeed:fedora_support_for_build_scripts [2022/10/05 12:59] – 削除 - 外部編集 (Unknown date) 非ログインユーザーlinux:openlitespeed:fedora_support_for_build_scripts [2023/04/18 00:25] (現在) – [Fedora 対応後のビルドスクリプト] ともやん
行 1: 行 1:
 +====== OpenLiteSpeed ビルドスクリプトの Fedora 対応🤤 ======
 +[[https://openlitespeed.org/kb/install-openlitespeed-from-source-with-build-script/|Install OpenLiteSpeed from Source with Build Script for OLS 1.6 and above – OpenLiteSpeed]]\\ \\
 +
 +<wrap em>2022/09/27 時点の内容🤔</wrap>\\
 +
 +ソースコードのダウンロード🤤\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b clas=HIY>cd</b> ~/work
 +<b class=GRN>$</b> <b clas=HIY>git</b> clone --depth 1 https://github.com/litespeedtech/openlitespeed.git
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +Cloning into 'openlitespeed'...
 +remote: Enumerating objects: 1888, done.
 +remote: Counting objects: 100% (1888/1888), done.
 +remote: Compressing objects: 100% (1739/1739), done.
 +remote: Total 1888 (delta 679), reused 572 (delta 108), pack-reused 0
 +Receiving objects: 100% (1888/1888), 7.97 MiB | 2.20 MiB/s, done.
 +Resolving deltas: 100% (679/679), done.
 +</pre></html></WRAP>
 +</WRAP>
 +
 +現時点の最新ソースコードの LSWS バージョンは...🤔\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b clas=HIY>cd</b> openlitespeed
 +<b class=GRN>$</b> <b clas=HIY>cat</b> CMakeLists.txt | grep "openlitespeed_.*_VERSION "
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +set(<b class=RED>openlitespeed_MAJOR_VERSION</b> 1)
 +set(<b class=RED>openlitespeed_MINOR_VERSION</b> 7)
 +set(<b class=RED>openlitespeed_PATCH_VERSION</b> 16)
 +</pre></html></WRAP>
 +</WRAP>
 +
 +Linux を最新に更新する🤔
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +$ sudo dnf update -y
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +</pre></html></WRAP>
 +</WRAP>
 +
 +しかし、これは Fedora 36 向けには作られていない😅
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b clas=HIY>sudo</b> ./build.sh
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +OS is Linux, APP_MGR_CMD is dnf.
 +メタデータの期限切れの最終確認: 0:22:36 時間前の 2022年09月27日 06時27分22秒 に実施しました。
 +依存関係が解決しました。
 +行うべきことはありません。
 +完了しました!
 +メタデータの期限切れの最終確認: 0:22:43 時間前の 2022年09月27日 06時27分22秒 に実施しました。
 +一致した引数がありません: epel-release
 +エラー: 一致するものが見つかりません: epel-release
 +This script only works on 7/8/9 for centos family._Static_assert
 +</pre></html></WRAP>
 +</WRAP>
 +<WRAP mincode><code>
 +This script only works on 7/8/9 for centos family._Static_assert
 +このスクリプトは、centos ファミリの 7/8/9 でのみ機能します。_Static_assert😥
 +</code></WRAP>
 +
 +===== build.sh の修正 =====
 +
 +==== Fedora で動作しない原因を探る ====
 +まずは、シェルスクリプトをバックアップします...🤔\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>cp</b> build.sh build.sh.org
 +</pre></html></WRAP>
 +<WRAP color_result><html><pre>
 +</pre></html></WRAP>
 +</WRAP>
 +
 +シェルスクリプトを直します...🤔\\
 +直すには動きを理解する必要があるので、''bash -x''でシェルスクリプトの実行順序を調べる🤤\\
 +**/bin/sh -> bash** ''/bin/sh'' は ''bash'' へのシンボルリンクなので ''/bin/sh -x'' に直すだけです😉\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>nano</b> build.sh
 +</pre></html></WRAP>
 +<WRAP color_code><code bash>
 +#!/bin/sh
 +</code></WRAP>
 +
 +<WRAP color_code><code bash>
 +#!/bin/sh -x
 +</code></WRAP>
 +<WRAP color_command><html><pre>
 +$ ll /bin/sh
 +</pre></html></WRAP>
 +<WRAP color_command><html><pre>
 +lrwxrwxrwx. 1 root root 4  1月 20  2022 <b class=HIC>/bin/sh</b> -> <b class=GRN>bash</b>
 +</pre></html></WRAP>
 +</WRAP>
 +
 +直したシェルスクリプトを実行します🤤\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>sudo</b> ./build.sh
 +</pre></html></WRAP>
 +<WRAP color_result_long><html><pre>
 ++ VERSION=1.0.1
 ++ moduledir='modreqparser modinspector uploadprogress '
 +++ uname
 ++ OS=Linux
 +++ arch
 ++ ARCH=x86_64
 ++ ISLINUX=no
 ++ VERSIONNUMBER=
 ++ '[' Linux = FreeBSD ']'
 ++ '[' Linux = Linux ']'
 ++ APP_MGRS='apt apt-get dnf yum zypper apk'
 ++ APP_MGR_CMD=
 ++ for APP_MGR in ${APP_MGRS}
 +++ which apt
 ++ APP_MGR_CHECK=
 ++ '[' 1 -eq 0 ']'
 ++ for APP_MGR in ${APP_MGRS}
 +++ which apt-get
 ++ APP_MGR_CHECK=
 ++ '[' 1 -eq 0 ']'
 ++ for APP_MGR in ${APP_MGRS}
 +++ which dnf
 ++ APP_MGR_CHECK=
 ++ '[' 0 -eq 0 ']'
 ++ APP_MGR_CMD=dnf
 ++ break
 ++ echo OS is Linux, APP_MGR_CMD is dnf.
 +OS is Linux, APP_MGR_CMD is dnf.
 ++ '[' xdnf = x ']'
 +++ dirname ./build.sh
 ++ cd .
 +++ pwd
 ++ CURDIR=/home/tomoyan/work/openlitespeed
 ++ '[' Linux = FreeBSD ']'
 ++ '[' Linux = Linux ']'
 ++ ISLINUX=yes
 ++ prepareLinux
 ++ OSTYPE=unknownlinux
 ++ '[' -f /etc/redhat-release ']'
 ++ OSTYPE=CENTOS
 ++ yum update -y
 +メタデータの期限切れの最終確認: 0:34:56 時間前の 2022年09月27日 22時02分24秒 に実施しました。
 ++ yum install -y epel-release
 +メタデータの期限切れの最終確認: 0:37:46 時間前の 2022年09月27日 22時02分24秒 に実施しました。
 +一致した引数がありません: epel-release
 +エラー: 一致するものが見つかりません: epel-release
 +++ cat /etc/redhat-release
 ++ output='Fedora release 36 (Thirty Six)'
 ++ echo Fedora release 36 '(Thirty' 'Six)'
 ++ grep ' 7.'
 ++ echo Fedora release 36 '(Thirty' 'Six)'
 ++ grep ' 8.'
 ++ echo Fedora release 36 '(Thirty' 'Six)'
 ++ grep ' 9.'
 ++ '[' CENTOS = CENTOS7 ']'
 ++ '[' CENTOS = CENTOS8 ']'
 ++ '[' CENTOS = CENTOS9 ']'
 ++ echo This script only works on 7/8/9 for centos family._Static_assert
 +This script only works on 7/8/9 for centos family._Static_assert
 ++ exit 1
 +</pre></html></WRAP>
 +</WRAP>
 +
 +
 +==== 最低限の対応でスクリプトをデバッグする ====
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>diff</b> build.sh build.sh.org
 +</pre></html></WRAP>
 +<WRAP color_result><code diff>
 +1c1
 +< #!/bin/sh -x
 +---
 +> #!/bin/sh
 +162c162
 +<         #yum install -y epel-release 
 +---
 +>         yum install -y epel-release 
 +164,166c164
 +<         if echo $output | grep "Fedora"; then
 +<             OSTYPE=FEDORA
 +<         elif echo $output | grep " 7."; then
 +---
 +>         if echo $output | grep " 7."; then
 +174,177d171
 +<         if [ ! "${OSTYPE}" = "FEDORA" ] ; then
 +<             yum install -y epel-release
 +<         fi
 +<         
 +193,194c187
 +<         #elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 +<         elif [ "${OSTYPE}" = "FEDORA" ] || ["${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 +---
 +>         elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 +</code></WRAP>
 +</WRAP>
 +
 +シェルスクリプトのデバッグ...🤔\\
 +[[+tab|.fedora_support_for_scripts:script_debug_001|001 最低限の対応スクリプト (実行結果)🤤]]\\
 +
 +**golang** パッケージがインストールされていない🤔\\
 +<WRAP color_term>
 +<WRAP color_result><html><pre>
 +-- Checking for module 'libunwind-generic'
 +--   Package 'libunwind-generic', required by 'virtual:world', not found
 +libunwind not found. Disabling unwind tests.
 +<b class=RED>CMake Error at CMakeLists.txt:51 (message):
 +  Could not find Go
 +
 +</b>
 +-- Configuring incomplete, errors occurred!
 +</pre></html></WRAP>
 +</WRAP>
 +
 +**autoheader** は **autoconf** パッケージに含まれる...🤔\\
 +**go** で **golang** パッケージがインストールされない...😢\\
 +<wrap em>※以下を修正すると **clang**、**llvm** もインストールされるようになる😍</wrap>\\
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +</pre></html></WRAP>
 +<WRAP color_code><html><pre>
 +198c207,208
 +<         yum -y install libtool autoconf autoheader automake wget go clang patch expat-devel
 +---
 +>         #yum -y install libtool autoconf autoheader automake wget go clang patch expat-devel
 +>         yum -y install libtool autoconf automake wget golang clang patch expat-devel
 +</pre></html></WRAP>
 +</WRAP>
 +
 +[[+tab|.fedora_support_for_scripts:script_debug_002|002 不足パッケージ対応済みスクリプト (実行結果)🤤]]\\
 +
 +===== Fedora 対応後のビルドスクリプト =====
 +修正後の build.sh は、以下の内容です🤤\\
 +<html>
 +<div class="embed_codemirror001">
 +  <style>
 +    @import '/_media/javascript/codemirror/5.65.12/lib/codemirror.css';
 +    @import '/_media/javascript/codemirror/5.65.12/theme/cobalt.css';
 + 
 +    .dokuwiki pre {
 +      box-shadow: unset;
 +    }
 +    div.embed_codemirror001 div.CodeMirror * {
 +      font-family: "HackGen Console NFJ", Arial, monospace;
 +      font-size: 10px;
 +    }
 +    div.embed_codemirror001 div.CodeMirror {
 +      height: 480px;
 +    }
 +    .select-theme .form-control { width: auto; display: inline-block; }
 +  </style>
 + 
 +  <script src="/_media/javascript/codemirror/5.65.12/lib/codemirror.js"></script>
 +  <!-- 言語に応じたjsファイルを読み込む -->
 +  <script src="/_media/javascript/codemirror/5.65.12/mode/shell/shell.js"></script>
 + 
 +  <textarea id="CodeMirror001">
 +#!/bin/sh -x
 +##############################################################################
 +#    Open LiteSpeed is an open source HTTP server.                           #
 +#    Copyright (C) 2013 - 2022 LiteSpeed Technologies, Inc.                  #
 +#                                                                            #
 +#    This program is free software: you can redistribute it and/or modify    #
 +#    it under the terms of the GNU General Public License as published by    #
 +#    the Free Software Foundation, either version 3 of the License, or       #
 +#    (at your option) any later version.                                     #
 +#                                                                            #
 +#    This program is distributed in the hope that it will be useful,         #
 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of          #
 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            #
 +#    GNU General Public License for more details.                            #
 +#                                                                            #
 +#    You should have received a copy of the GNU General Public License       #
 +#    along with this program. If not, see http://www.gnu.org/licenses/     #
 +##############################################################################
 +
 +###    Author: dxu@litespeedtech.com (David Shue)
 +
 +VERSION=1.0.1
 +moduledir="modreqparser modinspector uploadprogress "
 +OS=`uname`
 +ARCH=`arch`
 +ISLINUX=no
 +VERSIONNUMBER=
 +
 +if [ "${OS}" = "FreeBSD" ] ; then
 +    APP_MGRS="pkg"
 +elif [ "${OS}" = "Linux" ] ; then
 +    APP_MGRS="apt apt-get dnf yum zypper apk"
 +elif [ "${OS}" = "Darwin" ] ; then
 +    APP_MGRS="port brew"
 +else
 +    echo 'Operating System not Linux, Mac and FreeBSD, quit.'
 +    exit 1
 +fi
 +
 +APP_MGR_CMD=
 +for APP_MGR in ${APP_MGRS}; do
 +  APP_MGR_CHECK=`which ${APP_MGR} &>/dev/null`
 +  if [ $? -eq 0 ] ; then
 +    APP_MGR_CMD="${APP_MGR}"
 +    break
 +  fi
 +done
 +
 +echo OS is ${OS}, APP_MGR_CMD is ${APP_MGR_CMD}.
 +if [ "x${APP_MGR_CMD}" = "x" ] ; then 
 +    echo 'Can not find package installation command, quit.'
 +    exit 1
 +fi
 +
 +# getVersionNumber0()
 +# {
 +#     STRING=$1
 +#     VERSIONNUMBER=1000000
 +#     IFS='.';
 +#     parts=( ${STRING} )
 +#     unset IFS;
 +#     if [ x${parts[2]} = 'x' ] ; then
 +#         VERSIONNUMBER=$(( 1000000 * ${parts[0]} + 1000 * ${parts[1]} ))
 +#     else
 +#     #When x${parts[2]} is not empty, add 1 more to make sure 1.5 and 1.5.0 is not same
 +#         VERSIONNUMBER=$(( 1000000 * ${parts[0]} + 1000 * ${parts[1]} + ${parts[2]} + 1 ))
 +#     fi
 +# }
 +
 +getVersionNumber()
 +{
 +    STRING=$1
 +    VER1=`echo $STRING | awk -F. '{ printf("%d", $1); }'`
 +    VER2=`echo $STRING | awk -F. '{ printf("%d", $2); }'`
 +    VER3=`echo $STRING | awk -F. '{ printf("%d", $3); }'`
 +    VERSIONNUMBER=$(( 1000000 * ${VER1} + 1000 * ${VER2} + ${VER3} + 1 ))
 +}
 +
 +installCmake()
 +{
 +    if [ "${APP_MGR_CMD}" = "apk" ] ; then
 +        ${APP_MGR_CMD} add --update git cmake
 +    else
 +        ${APP_MGR_CMD} install -y git cmake
 +    fi
 +    
 +    CMAKEVER=`cmake --version | grep version | awk  '{print $3}'`
 +    getVersionNumber $CMAKEVER
 +        
 +    if [ $VERSIONNUMBER -gt 3000000 ] ; then
 +        echo cmake installed.
 +        return
 +    fi
 +    
 +    version=3.14
 +    build=5
 +    mkdir cmaketemp
 +    CURDIR=`pwd`
 +    cd ./cmaketemp
 +    wget https://cmake.org/files/v${version}/cmake-${version}.${build}.tar.gz
 +    tar -xzvf cmake-${version}.${build}.tar.gz
 +    cd cmake-${version}.${build}/
 +    
 +    ./bootstrap
 +    jobs=$(nproc)
 +    make -j${jobs}
 +    make install
 +    cmake --version
 +    cd ${CURDIR}
 +}
 +
 +# lsrecaptcha requirement
 +installgo()
 +{
 +    if [ "${APP_MGR_CMD}" = "apk" ] ; then
 +        ${APP_MGR_CMD} add --update go
 +    else
 +        ${APP_MGR_CMD} -y install golang-go
 +    fi
 +
 +    which go
 +    
 +    if [ $? = 0 ] ; then
 +        echo go installed.
 +    else
 +        wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
 +        tar -xvf go1.16.3.linux-amd64.tar.gz
 +        mv -f go /usr/local
 +        export PATH=/usr/local/go/bin:${PATH}
 +    fi
 +}
 +
 +preparelibquic()
 +{
 +    if [ -e lsquic ] ; then
 +        ls src/ | grep liblsquic
 +        if [ $? -eq 0 ] ; then
 +            echo Need to git download the submodule ...
 +            rm -rf lsquic
 +            git clone https://github.com/litespeedtech/lsquic.git
 +            cd lsquic
 +            
 +            LIBQUICVER=`cat ../LSQUICCOMMIT`
 +            echo "LIBQUICVER is ${LIBQUICVER}"
 +            git checkout ${LIBQUICVER}
 +            git submodule update --init --recursive
 +            cd ..
 +            
 +        fi
 +    fi
 +}
 +
 +prepareLinux()
 +{
 +    OSTYPE=unknownlinux
 +    if [ -f /etc/redhat-release ] ; then
 +        OSTYPE=CENTOS
 +        sudo yum update -y
 +        
 +        output=$(cat /etc/redhat-release)
 +        if echo $output | grep "Fedora"; then
 +            OSTYPE=FEDORA
 +        elif echo $output | grep " 7."; then
 +            OSTYPE=CENTOS7
 +        elif echo $output | grep " 8."; then
 +            OSTYPE=CENTOS8
 +        elif echo $output | grep " 9."; then
 +            OSTYPE=CENTOS9
 +        fi
 +        
 +        if [ ! "${OSTYPE}" = "FEDORA" ] ; then
 +            sudo yum install -y epel-release
 +        fi
 +        
 +        if [ "${OSTYPE}" = "CENTOS7" ] ; then
 +            if [ ! -f ./installing ] ; then    
 +                yum -y install centos-release-scl
 +                which yum-config-manager
 +                if [ $? = 0 ] ; then
 +                    yum-config-manager --enable rhel-server-rhscl-7-rpms
 +                fi
 +
 +                yum -y install devtoolset-7
 +                touch ./installing
 +                scl enable devtoolset-7 "$0"
 +                rm ./installing
 +                exit 0
 +            fi
 +            
 +        #elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 +        elif [ "${OSTYPE}" = "FEDORA" ] || ["${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 +            sudo dnf -y groupinstall "Development Tools"
 +        else
 +            echo This script only works on 7/8/9 for centos family._Static_assert
 +            exit 1
 +        fi
 +        
 +        sudo yum -y install git cmake
 +        installCmake
 +        
 +        sudo yum -y install libtool autoconf automake wget golang clang patch expat-devel
 +        if [ "${ARCH}" = "aarch64" ]; then
 +            yum -y install libatomic
 +        fi
 +        
 +    #now for debian and Ubuntu    
 +    elif [ -f /etc/debian_version ] ; then
 +        if [ -f /etc/lsb-release ] ; then
 +            output=$(cat /etc/*release)
 +            if echo $output | grep "18.04"; then
 +                OSTYPE=UBUNTU18
 +            elif echo $output | grep "20.04"; then
 +                OSTYPE=UBUNTU20
 +            elif echo $output | grep "22.04"; then
 +                OSTYPE=UBUNTU22
 +            fi
 +        elif [ -f /etc/debian_version ] ; then
 +            output=$(cat /etc/*release)
 +            if echo $output | grep "Debian GNU/Linux 9"; then
 +                OSTYPE=DEBIAN9
 +            elif echo $output | grep "Debian GNU/Linux 10"; then
 +                OSTYPE=DEBIAN10
 +            elif echo $output | grep "Debian GNU/Linux 11"; then
 +                OSTYPE=DEBIAN11
 +            fi
 +        fi
 +        
 +        #other debian OS, we still can 
 +        if [ "${OSTYPE}" = "unknownlinux" ] ; then
 +            echo It seems you are not using ubuntu 18/20/22 and Debian 9/10/11.
 +            echo But we still can try to go further.
 +        fi
 +        
 +        apt-get -y update
 +        apt-get -f -y install
 +        apt-get -y install gcc g++ wget curl make clang patch libexpat-dev
 +        
 +        installCmake
 +        apt-get -y install git libtool ca-certificates autotools-dev autoconf automake
 +        installgo
 +
 +        if [ "${ARCH}" = "aarch64" ]; then
 +            apt-get -y install libatomic1
 +        fi
 +
 +    elif [ -f /etc/alpine-release ] ; then
 +        OSTYPE=ALPINE
 +        ${APP_MGR_CMD} add make
 +        ${APP_MGR_CMD} add gcc g++
 +        ${APP_MGR_CMD} add patch
 +        installCmake
 +        ${APP_MGR_CMD} add git libtool linux-headers bsd-compat-headers curl
 +        ${APP_MGR_CMD} add automake autoconf
 +        ${APP_MGR_CMD} add build-base expat-dev zlib-dev
 +        installgo
 +        sed -i -e "s/u_int32_t/uint32_t/g" $(grep -rl u_int32_t src/)
 +        sed -i -e "s/u_int64_t/uint64_t/g" $(grep -rl u_int64_t src/)
 +        sed -i -e "s/u_int8_t/uint8_t/g" $(grep -rl u_int8_t src/)
 +        sed -i -e "s@<sys/sysctl.h>@<linux/sysctl.h>@g" $(grep -rl "<sys/sysctl.h>" src/)
 +        sed -i -e "s/PTHREAD_MUTEX_ADAPTIVE_NP/PTHREAD_MUTEX_NORMAL/g" src/lsr/ls_lock.c    
 +        
 +    else 
 +        echo May not support your platform, but we can do a try to install some tools.
 +        ${APP_MGR_CMD} -y update
 +        ${APP_MGR_CMD} -y install make
 +        ${APP_MGR_CMD} -y install clang 
 +        ${APP_MGR_CMD} -y install patch 
 +        installCmake
 +        ${APP_MGR_CMD} -y install git libtool ca-certificates
 +        ${APP_MGR_CMD} -y install autotools-dev
 +        ${APP_MGR_CMD} -y install autoconf
 +        ${APP_MGR_CMD} -y install autoheader 
 +        ${APP_MGR_CMD} -y install automake 
 +        installgo
 +        
 +    fi
 +}
 +
 +prepareBsd()
 +{
 +    echo 'OS Type is `freebsd-version -k`'
 +    pkg install -f -y wget
 +    pkg install -f -y curl
 +    pkg install -f -y lang/gcc
 +    pkg install -f -y cmake
 +    pkg install -f -y git
 +    pkg install -f -y libtool
 +    pkg install -f -y autoconf 
 +    pkg install -f -y automake 
 +    pkg install -f -y go 
 +    pkg install -f -y patch 
 +    pkg install -f -y python
 +    pkg install -f -y gmake
 +    
 +    #something can not install through pkg will use ports
 +    #portsnap fetch
 +    #portsnap extract
 +    #cd /usr/ports/textproc/libxml2
 +    #make install clean BATCH=yes
 +}
 +
 +prepareMac()
 +{
 +    echo OS Type is `sw_vers`
 +    if [ "${APP_MGR_CMD}" = "port" ] ; then 
 +        port selfupdate
 +        port -f -N install wget
 +        port -f -N install curl                             
 +        port -f -N install cmake                          
 +        port -f -N install git                            
 +        port -f -N install libtool                        
 +        port -f -N install autoconf                       
 +        port -f -N install automake                       
 +        port -f -N install go                             
 +        port -f -N install patch                          
 +        port -f -N install python                         
 +        port -f -N install gmake      
 +    else
 +        echo You need to install these tools "wget cmake git libtool autoconf automake go patch python gmake"
 +        brew install -f wget
 +        brew install -f curl                             
 +        brew install -f cmake                          
 +        brew install -f git                            
 +        brew install -f libtool                        
 +        brew install -f autoconf                       
 +        brew install -f automake                       
 +        brew install -f go                             
 +        brew install -f patch                          
 +        brew install -f python                         
 +        brew install -f gmake      
 +    
 +    fi
 +    
 +}
 +
 +commentout()
 +{
 +    sed -i -e "s/$1/#$1/g" $2
 +}
 +
 +updateSrcCMakelistfile()
 +{   
 +    OS=`uname`
 +    commentout 'add_definitions(-DRUN_TEST)'                 CMakeLists.txt 
 +    commentout 'add_definitions(-DPOOL_TESTING)'             CMakeLists.txt
 +    commentout 'add_definitions(-DTEST_OUTPUT_PLAIN_CONF)'   CMakeLists.txt
 +    commentout 'add_definitions(-DDEBUG_POOL)'   CMakeLists.txt
 +    
 +    commentout 'set(libUnitTest'  CMakeLists.txt
 +    
 +    commentout 'find_package(ZLIB'  CMakeLists.txt
 +    commentout 'find_package(PCRE'  CMakeLists.txt
 +   # commentout 'find_package(EXPAT REQUIRED)'
 +    commentout 'add_subdirectory(test)'   CMakeLists.txt
 +    
 +    
 +    commentout 'SET (CMAKE_C_COMPILER'  CMakeLists.txt
 +    commentout 'SET (CMAKE_CXX_COMPILER'   CMakeLists.txt
 +    
 +    sed -i -e "s/\${unittest_STAT_SRCS}//g"  src/CMakeLists.txt
 +    sed -i -e "s/libstdc++.a //g"  src/CMakeLists.txt
 +    sed -i -e "s/-nodefaultlibs //g"  src/CMakeLists.txt
 +    sed -i -e "s/-nodefaultlibs libstdc++.a//g"  src/modules/modsecurity-ls/CMakeLists.txt
 +
 +    commentout  ls_llmq.c  src/lsr/CMakeLists.txt
 +    commentout  ls_llxq.c  src/lsr/CMakeLists.txt
 +    
 +    if [ "${OS}" = "Darwin" ] ; then
 +        sed -i -e "s/ rt//g" src/CMakeLists.txt
 +        sed -i -e "s/ crypt//g"  src/CMakeLists.txt
 +        sed -i -e "s/gcc_eh//g"  src/CMakeLists.txt
 +        sed -i -e "s/c_nonshared//g"  src/CMakeLists.txt
 +        sed -i -e "s/gcc//g"  src/CMakeLists.txt
 +        sed -i -e "s/-Wl,--whole-archive//g"  src/CMakeLists.txt
 +        sed -i -e "s/-Wl,--no-whole-archive//g"  src/CMakeLists.txt
 +    fi
 +    
 +    if [ "${OSTYPE}" = "ALPINE" ] ; then
 +        sed -i -e "s/c_nonshared//g"  src/CMakeLists.txt
 +    fi
 +}
 +
 +updateModuleCMakelistfile()
 +{
 +    echo "cmake_minimum_required(VERSION 2.8)" > src/modules/CMakeLists.txt
 +    echo "add_subdirectory(modgzip)" >> src/modules/CMakeLists.txt
 +    echo "add_subdirectory(cache)" >> src/modules/CMakeLists.txt
 +    
 +    if [ "${OS}" = "Darwin" ] ; then
 +        echo Mac OS bypass all module right now
 +    else
 +        for module in ${moduledir}; do
 +            echo "add_subdirectory(${module})" >> src/modules/CMakeLists.txt
 +        done
 +    fi
 +    
 +    if [ -f ../third-party/lib/libmodsecurity.a ] ; then
 +        echo "add_subdirectory(modsecurity-ls)" >> src/modules/CMakeLists.txt
 +    fi
 +    
 +    #For linux but not alpine, add pagespeed module
 +    if [ "${ISLINUX}" = "yes" ] && [ "${ARCH}" = "x86_64" ]; then
 +        if [ ! "${OSTYPE}" = "ALPINE" ] ; then
 +            echo "add_subdirectory(pagespeed)" >> src/modules/CMakeLists.txt
 +        fi
 +    fi
 +}
 +
 +cpModuleSoFiles()
 +{
 +    if [ ! -d dist/modules/ ] ; then
 +        mkdir dist/modules/
 +    fi
 +    
 +    for module in ${moduledir}; do
 +        cp -f build/src/modules/${module}/*.so dist/modules/
 +    done
 +    
 +    if [ -e src/modules/modsecurity-ls/mod_security.so ] ; then
 +        cp -f build/src/modules/modsecurity-ls/mod_security.so dist/modules/
 +    fi
 +    
 +    if [ -e src/modules/pagespeed/modpagespeed.so ] ; then
 +        cp -f build/src/modules/pagespeed/modpagespeed.so dist/modules/
 +    fi
 +}
 +
 +fixshmdir()
 +{
 +    if [ ! -d /dev/shm ] ; then
 +        mkdir /tmp/shm
 +        chmod 777  /tmp/shm
 +        sed -i -e "s/\/dev\/shm/\/tmp\/shm/g" dist/conf/httpd_config.conf.in
 +    fi
 +}
 +
 +
 +freebsdFix()
 +{   
 +    if [ "${OS}" = "FreeBSD" ] ; then
 +        NEEDREBOOT=yes
 +        if [ -e /etc/sysctl.conf ] ; then 
 +            cat /etc/sysctl.conf | grep  "security.bsd.conservative_signals=0" >/dev/null
 +            if [ $? -eq 0 ] ; then
 +                NEEDREBOOT=no
 +            fi
 +        fi
 +        
 +        if [ "${NEEDREBOOT}" = "yes" ] ; then 
 +            echo "security.bsd.conservative_signals=0" >> /etc/sysctl.conf
 +            echo You must reboot the server to ensure the settings change take effect. 
 +            touch ./needreboot.txt
 +        fi
 +    fi
 +}
 +
 +fixPagespeed()
 +{
 +PSOLVERSION=1.11.33.4
 +cat << EOF > ../third-party/psol-$PSOLVERSION/include/pagespeed/kernel/base/scoped_ptr.h
 +/**
 +* Due the compiling issue, this file was updated from the original file.
 +*/
 +#ifndef PAGESPEED_KERNEL_BASE_SCOPED_PTR_H_
 +#define PAGESPEED_KERNEL_BASE_SCOPED_PTR_H_
 +#include "base/memory/scoped_ptr.h"
 +
 +namespace net_instaweb {
 +template<typename T> class scoped_array : public scoped_ptr<T[]> {
 +public:
 +    scoped_array() : scoped_ptr<T[]>() {}
 +    explicit scoped_array(T* t) : scoped_ptr<T[]>(t) {}
 +};
 +}
 +#endif
 +
 +EOF
 +
 +}
 +
 +cd `dirname "$0"`
 +CURDIR=`pwd`
 +
 +if [ "${OS}" = "FreeBSD" ] ; then
 +    prepareBsd
 +elif [ "${OS}" = "Linux" ] ; then
 +    ISLINUX=yes
 +    prepareLinux
 +elif [ "${OS}" = "Darwin" ] ; then
 +    prepareMac
 +fi
 +
 +cd ..
 +if [ ! -d third-party ]; then
 +    git clone --depth 1 https://github.com/litespeedtech/third-party.git
 +    patch -p0 < third-party-scripts.patch
 +    mkdir third-party/lib64
 +    cd third-party/script/
 +
 +    #Remove  unittest-cpp and add bcrypt
 +    sed -i -e "s/unittest-cpp/bcrypt/g" ./build_ols.sh
 +
 +    # Remove psol for non x86_64 non linux systems
 +    if [ "${ISLINUX}" != "yes" ] || [ "${ARCH}" != "x86_64" ] ; then
 +        sed -i -e "s/psol/ /g"  ./build_ols.sh
 +    fi
 +
 +    ./build_ols.sh
 +fi
 +
 +cd ${CURDIR}
 +
 +updateSrcCMakelistfile
 +updateModuleCMakelistfile
 +preparelibquic
 +
 +if [ "${ISLINUX}" = "yes" ] && [ "${ARCH}" = "x86_64" ] ; then
 +    fixPagespeed
 +fi
 +
 +#special case modsecurity
 +cd src/modules/modsecurity-ls
 +ln -sf ../../../../third-party/src/ModSecurity .
 +cd ../../../
 +#Done of modsecurity
 +
 +fixshmdir
 +
 +if [ "x$1" == "xDebug" ]; then
 +    BUILD=Debug
 +else
 +    BUILD=RelWithDebInfo
 +fi
 +
 +if [ ! -d build ]; then
 +    mkdir build
 +fi
 +cd build
 +cmake -DCMAKE_BUILD_TYPE=$BUILD ..
 +jobs=$(nproc)
 +make -j${jobs}
 +cd ..
 +
 +cp build/src/openlitespeed  dist/bin/
 +
 +cpModuleSoFiles
 +
 +#Version >= 1.6.0 which has QUIC need to fix for freebsd
 +if [ -e src/liblsquic ] ; then 
 +    freebsdFix
 +fi
 +
 +cat > ./ols.conf <<END 
 +#If you want to change the default values, please update this file.
 +#
 +
 +SERVERROOT=/usr/local/lsws
 +OPENLSWS_USER=nobody
 +OPENLSWS_GROUP=nobody
 +OPENLSWS_ADMIN=admin
 +OPENLSWS_EMAIL=root@localhost
 +OPENLSWS_ADMINSSL=yes
 +OPENLSWS_ADMINPORT=7080
 +USE_LSPHP7=yes
 +DEFAULT_TMP_DIR=/tmp/lshttpd
 +PID_FILE=/tmp/lshttpd/lshttpd.pid
 +OPENLSWS_EXAMPLEPORT=8088
 +
 +#You can set password here
 +#OPENLSWS_PASSWORD=
 +
 +END
 +
 +echo Start to pack files.
 +mv dist/install.sh  dist/_in.sh
 +
 +cat > ./install.sh <<END 
 +#!/bin/sh
 +
 +SERVERROOT=/usr/local/lsws
 +OPENLSWS_USER=nobody
 +OPENLSWS_GROUP=nobody
 +OPENLSWS_ADMIN=admin
 +OPENLSWS_PASSWORD=
 +OPENLSWS_EMAIL=root@localhost
 +OPENLSWS_ADMINSSL=yes
 +OPENLSWS_ADMINPORT=7080
 +USE_LSPHP7=yes
 +DEFAULT_TMP_DIR=/tmp/lshttpd
 +PID_FILE=/tmp/lshttpd/lshttpd.pid
 +OPENLSWS_EXAMPLEPORT=8088
 +CONFFILE=./ols.conf
 +    
 +#script start here
 +cd `dirname "\$0"`
 +
 +if [ -f \${CONFFILE} ] ; then
 +    . \${CONFFILE}
 +fi
 +
 +cd dist
 +
 +mkdir -p \${SERVERROOT} >/dev/null 2>&1
 +
 +PASSWDFILEEXIST=no
 +if [ -f \${SERVERROOT}/admin/conf/htpasswd ] ; then
 +    PASSWDFILEEXIST=yes
 +else
 +    PASSWDFILEEXIST=no
 +    #Generate the random PASSWORD if not set in ols.conf
 +    if [ "x\$OPENLSWS_PASSWORD" = "x" ] ; then
 +        OPENLSWS_PASSWORD=\`openssl rand -base64 6\`
 +        if [ "x\$OPENLSWS_PASSWORD" = "x" ] ; then
 +            TEMPRANDSTR=\`ls -l ..\`
 +            TEMPRANDSTR=\`echo "\${TEMPRANDSTR}" |  md5sum | base64 | head -c 8\`
 +            if [ \$? = 0 ] ; then
 +                OPENLSWS_PASSWORD=\${TEMPRANDSTR}
 +            else
 +                OPENLSWS_PASSWORD=123456
 +            fi
 +        fi
 +        echo OPENLSWS_PASSWORD=\${OPENLSWS_PASSWORD} >> ./ols.conf
 +    fi
 +
 +    echo "WebAdmin user/password is admin/\${OPENLSWS_PASSWORD}" > \$SERVERROOT/adminpasswd
 +    chmod 600 \$SERVERROOT/adminpasswd
 +fi
 +
 +#Change to nogroup for debain/ubuntu
 +if [ -f /etc/debian_version ] ; then
 +    if [ "\${OPENLSWS_GROUP}" = "nobody" ] ; then
 +        OPENLSWS_GROUP=nogroup
 +    fi
 +fi
 +
 +ISRUNNING=no
 +
 +if [ -f \${SERVERROOT}/bin/openlitespeed ] ; then 
 +    echo Openlitespeed web server exists, will upgrade.
 +    
 +    \${SERVERROOT}/bin/lswsctrl status | grep ERROR
 +    if [ \$? != 0 ]; then
 +        ISRUNNING=yes
 +    fi
 +fi
 +
 +./_in.sh "\${SERVERROOT}" "\${OPENLSWS_USER}" "\${OPENLSWS_GROUP}" "\${OPENLSWS_ADMIN}" "\${OPENLSWS_PASSWORD}" "\${OPENLSWS_EMAIL}" "\${OPENLSWS_ADMINSSL}" "\${OPENLSWS_ADMINPORT}" "\${USE_LSPHP7}" "\${DEFAULT_TMP_DIR}" "\${PID_FILE}" "\${OPENLSWS_EXAMPLEPORT}" no
 +
 +cp -f modules/*.so \${SERVERROOT}/modules/
 +cp -f bin/openlitespeed \${SERVERROOT}/bin/
 +
 +if [ "\${PASSWDFILEEXIST}" = "no" ] ; then
 +    echo -e "\e[31mYour webAdmin password is \${OPENLSWS_PASSWORD}, written to file \$SERVERROOT/adminpasswd.\e[39m"
 +else
 +    echo -e "\e[31mYour webAdmin password not changed.\e[39m"
 +fi
 +echo
 +
 +if [ -f ../needreboot.txt ] ; then
 +    rm ../needreboot.txt
 +    echo -e "\e[31mYou must reboot the server to ensure the settings change take effect!\e[39m"
 +    echo
 +    exit 0
 +fi 
 +
 +if [ "\${ISRUNNING}" = "yes" ] ; then
 +    \${SERVERROOT}/bin/lswsctrl start
 +fi
 +
 +END
 +
 +chmod 777 ./install.sh
 +
 +echo -e "\033[38;5;71mBuilding finished, please run ./install.sh for installation.\033[39m"
 +echo -e "\033[38;5;71mYou may want to update the ols.conf to change the settings before installation.\033[39m"
 +echo -e "\033[38;5;71mEnjoy.\033[39m"
 +</textarea>
 +  <a href="https://codemirror.net/">CodeMirror</a> Version: <label id="lblCdMirrVer001"></label>
 +
 +  <script>
 +  var jsEditor = CodeMirror.fromTextArea(document.getElementById('CodeMirror001'), {
 +    mode: "shell",
 +    theme: "cobalt",
 +    lineNumbers: true,
 +    indentUnit: 4
 +  });
 +  document.getElementById('lblCdMirrVer001').innerText = CodeMirror.version;
 +  </script>
 +</div>
 +</html>
 +
 +===== Fedora 対応 + ビルド時間短縮スクリプト =====
 +Git の shallow clone で最新履歴のみを取得するようにしただけです😅\\
 +[[:linux:git#シャロークローン_shallow_clone_git_clone_--depth_1|シャロークローン (shallow clone) [git clone --depth 1] - Git - 分散型バージョン管理システム]]\\
 +<html>
 +<div class="embed_codemirror002">
 +  <style>
 +    @import '/_media/javascript/codemirror/5.65.12/lib/codemirror.css';
 +    @import '/_media/javascript/codemirror/5.65.12/theme/cobalt.css';
 + 
 +    /*.dokuwiki pre {
 +      box-shadow: unset;
 +    }*/
 +    div.embed_codemirror002 div.CodeMirror * {
 +      font-family: "HackGen Console NFJ", Arial, monospace;
 +      font-size: 10px;
 +    }
 +    div.embed_codemirror002 div.CodeMirror {
 +      height: 480px;
 +    }
 +    .select-theme .form-control { width: auto; display: inline-block; }
 +  </style>
 + 
 +  <script src="/_media/javascript/codemirror/5.65.12/lib/codemirror.js"></script>
 +  <!-- 言語に応じたjsファイルを読み込む -->
 +  <script src="/_media/javascript/codemirror/5.65.12/mode/shell/shell.js"></script>
 + 
 +  <textarea id="CodeMirror002">
 +#!/bin/sh -x
 +if [ -d openlitespeed ]; then
 +  rm -rf openlitespeed
 +fi
 +git clone --depth 1 https://github.com/litespeedtech/openlitespeed.git
 +
 +if [ -d third-party ]; then
 +  rm -rf third-party
 +fi
 +
 +cat << 'EOF' > build.sh.patch
 +--- openlitespeed/build.sh
 ++++ openlitespeed/build.sh
 +@@ -1,4 +1,4 @@
 +-#!/bin/sh
 ++#!/bin/sh -x
 + ##############################################################################
 + #    Open LiteSpeed is an open source HTTP server.                           #
 + #    Copyright (C) 2013 - 2022 LiteSpeed Technologies, Inc.                  #
 +@@ -52,7 +52,6 @@
 +     exit 1
 + fi
 + 
 +-
 + # getVersionNumber0()
 + # {
 + #     STRING=$1
 +@@ -68,7 +67,6 @@
 + #     fi
 + # }
 + 
 +-
 + getVersionNumber()
 + {
 +     STRING=$1
 +@@ -132,7 +130,6 @@
 +     fi
 + }
 + 
 +-
 + preparelibquic()
 + {
 +     if [ -e lsquic ] ; then
 +@@ -158,10 +155,12 @@
 +     OSTYPE=unknownlinux
 +     if [ -f /etc/redhat-release ] ; then
 +         OSTYPE=CENTOS
 +-        yum update -y
 +-        yum install -y epel-release 
 ++        sudo yum update -y
 ++        
 +         output=$(cat /etc/redhat-release)
 +-        if echo $output | grep " 7."; then
 ++        if echo $output | grep "Fedora"; then
 ++            OSTYPE=FEDORA
 ++        elif echo $output | grep " 7."; then
 +             OSTYPE=CENTOS7
 +         elif echo $output | grep " 8."; then
 +             OSTYPE=CENTOS8
 +@@ -169,6 +168,10 @@
 +             OSTYPE=CENTOS9
 +         fi
 +         
 ++        if [ ! "${OSTYPE}" = "FEDORA" ] ; then
 ++            sudo yum install -y epel-release
 ++        fi
 ++        
 +         if [ "${OSTYPE}" = "CENTOS7" ] ; then
 +             if [ ! -f ./installing ] ; then    
 +                 yum -y install centos-release-scl
 +@@ -184,18 +187,18 @@
 +                 exit 0
 +             fi
 +             
 +-        elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 +-            dnf -y groupinstall "Development Tools"
 +-
 ++        #elif [ "${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 ++        elif [ "${OSTYPE}" = "FEDORA" ] || ["${OSTYPE}" = "CENTOS8" ] || [ "${OSTYPE}" = "CENTOS9" ] ; then
 ++            sudo dnf -y groupinstall "Development Tools"
 +         else
 +             echo This script only works on 7/8/9 for centos family._Static_assert
 +             exit 1
 +         fi
 +         
 +-        yum -y install git cmake
 ++        sudo yum -y install git cmake
 +         installCmake
 +         
 +-        yum -y install libtool autoconf autoheader automake wget go clang patch expat-devel
 ++        sudo yum -y install libtool autoconf automake wget golang clang patch expat-devel
 +         if [ "${ARCH}" = "aarch64" ]; then
 +             yum -y install libatomic
 +         fi
 +@@ -273,7 +276,6 @@
 +     fi
 + }
 + 
 +-
 + prepareBsd()
 + {
 +     echo 'OS Type is `freebsd-version -k`'
 +@@ -336,8 +338,6 @@
 +     sed -i -e "s/$1/#$1/g" $2
 + }
 + 
 +-
 +-
 + updateSrcCMakelistfile()
 +   
 +     OS=`uname`
 +@@ -380,7 +380,6 @@
 +     fi
 + }
 + 
 +-
 + updateModuleCMakelistfile()
 + {
 +     echo "cmake_minimum_required(VERSION 2.8)" > src/modules/CMakeLists.txt
 +@@ -405,11 +404,8 @@
 +             echo "add_subdirectory(pagespeed)" >> src/modules/CMakeLists.txt
 +         fi
 +     fi
 +-    
 +-    
 + }
 + 
 +-
 + cpModuleSoFiles()
 + {
 +     if [ ! -d dist/modules/ ] ; then
 +@@ -429,7 +425,6 @@
 +     fi
 + }
 + 
 +-
 + fixshmdir()
 + {
 +     if [ ! -d /dev/shm ] ; then
 +@@ -459,7 +454,6 @@
 +     fi
 + }
 + 
 +-
 + fixPagespeed()
 + {
 + PSOLVERSION=1.11.33.4
 +@@ -487,8 +481,6 @@
 + cd `dirname "$0"`
 + CURDIR=`pwd`
 + 
 +-
 +-
 + if [ "${OS}" = "FreeBSD" ] ; then
 +     prepareBsd
 + elif [ "${OS}" = "Linux" ] ; then
 +@@ -498,12 +490,10 @@
 +     prepareMac
 + fi
 + 
 +-
 +-
 + cd ..
 + if [ ! -d third-party ]; then
 +-
 +-    git clone https://github.com/litespeedtech/third-party.git
 ++    git clone --depth 1 https://github.com/litespeedtech/third-party.git
 ++    patch -p0 < third-party-scripts.patch
 +     mkdir third-party/lib64
 +     cd third-party/script/
 + 
 +@@ -516,7 +506,6 @@
 +     fi
 + 
 +     ./build_ols.sh
 +-
 + fi
 + 
 + cd ${CURDIR}
 +@@ -525,7 +514,6 @@
 + updateModuleCMakelistfile
 + preparelibquic
 + 
 +-
 + if [ "${ISLINUX}" = "yes" ] && [ "${ARCH}" = "x86_64" ] ; then
 +     fixPagespeed
 + fi
 +@@ -583,7 +571,6 @@
 + 
 + END
 + 
 +-
 + echo Start to pack files.
 + mv dist/install.sh  dist/_in.sh
 + 
 +@@ -615,7 +602,6 @@
 + 
 + mkdir -p \${SERVERROOT} >/dev/null 2>&1
 + 
 +-
 + PASSWDFILEEXIST=no
 + if [ -f \${SERVERROOT}/admin/conf/htpasswd ] ; then
 +     PASSWDFILEEXIST=yes
 +@@ -640,14 +626,12 @@
 +     chmod 600 \$SERVERROOT/adminpasswd
 + fi
 + 
 +-
 + #Change to nogroup for debain/ubuntu
 + if [ -f /etc/debian_version ] ; then
 +     if [ "\${OPENLSWS_GROUP}" = "nobody" ] ; then
 +         OPENLSWS_GROUP=nogroup
 +     fi
 +-fi 
 +-
 ++fi
 + 
 + ISRUNNING=no
 + 
 +@@ -672,7 +656,6 @@
 + fi
 + echo
 + 
 +-    
 + if [ -f ../needreboot.txt ] ; then
 +     rm ../needreboot.txt
 +     echo -e "\e[31mYou must reboot the server to ensure the settings change take effect!\e[39m"
 +@@ -691,4 +674,3 @@
 + echo -e "\033[38;5;71mBuilding finished, please run ./install.sh for installation.\033[39m"
 + echo -e "\033[38;5;71mYou may want to update the ols.conf to change the settings before installation.\033[39m"
 + echo -e "\033[38;5;71mEnjoy.\033[39m"
 +-
 +EOF
 +patch -p0 < build.sh.patch
 +
 +cat << 'EOF' > third-party-scripts.patch
 +diff -ur third-party_bak/script/build_bcrypt.sh third-party/script/build_bcrypt.sh
 +--- third-party/script/build_bcrypt.sh
 ++++ third-party/script/build_bcrypt.sh
 +@@ -6,7 +6,7 @@
 + 
 + 
 + if [ ! -d "libbcrypt" ]; then
 +-    git clone https://github.com/litespeedtech/libbcrypt.git
 ++    git clone --depth 1 https://github.com/litespeedtech/libbcrypt.git
 + fi
 + cd libbcrypt
 + make
 +diff -ur third-party_bak/script/build_bssl.sh third-party/script/build_bssl.sh
 +--- third-party/script/build_bssl.sh
 ++++ third-party/script/build_bssl.sh
 +@@ -6,7 +6,8 @@
 + 
 + 
 + if [ ! -d "boringssl" ]; then
 +-    git clone https://github.com/google/boringssl.git
 ++    #git clone https://github.com/google/boringssl.git
 ++    git clone --depth 1 --no-single-branch --branch cf8d3ad3cea51cf7184307d54f465da62b7d8408 https://github.com/google/boringssl.git
 + fi
 + 
 + if [ -d "go" ]; then
 +@@ -17,9 +18,9 @@
 + fi
 + 
 + cd boringssl
 +-git reset --hard
 +-git checkout master
 +-git pull
 ++#git reset --hard
 ++#git checkout master
 ++#git pull
 + 
 + #git checkout 49de1fc291
 + #git checkout bfe527fa35735e8e045cbfb42b012e13ca68f9cf
 +@@ -27,7 +28,7 @@
 + #git checkout b117a3a0b7bd11fe6ebd503ec6b45d6b910b41a1
 + # HTTP/3 v1 and ID-34 support
 + #git checkout a2278d4d2cabe73f6663e3299ea7808edfa306b9
 +-git checkout cf8d3ad3cea51cf7184307d54f465da62b7d8408
 ++#git checkout cf8d3ad3cea51cf7184307d54f465da62b7d8408
 + 
 + rm -rf build
 + 
 +diff -ur third-party_bak/script/build_curl.sh third-party/script/build_curl.sh
 +--- third-party/script/build_curl.sh
 ++++ third-party/script/build_curl.sh
 +@@ -7,11 +7,12 @@
 + cd src
 + 
 + if [ ! -d "curl" ] ; then
 +-    git clone https://github.com/curl/curl.git
 ++    #git clone https://github.com/curl/curl.git
 ++    git clone --depth 1 --no-single-branch --branch curl-7_65_3 https://github.com/curl/curl.git
 + fi
 + 
 +     cd curl
 +-    git checkout curl-7_65_3
 ++    #git checkout curl-7_65_3
 +     ./buildconf 
 +     CFLAGS="-fPIC" LIBS=-lpthread ./configure --prefix=$PREFIX --with-ssl=$PREFIX --with-brotli=no  --enable-shared=no --enable-ldap=no --without-nghttp2 --without-nghttp3
 +     make
 +diff -ur third-party_bak/script/build_expat.sh third-party/script/build_expat.sh
 +--- third-party/script/build_expat.sh
 ++++ third-party/script/build_expat.sh
 +@@ -5,11 +5,12 @@
 + 
 + cd src/
 + 
 +-git clone https://github.com/libexpat/libexpat.git
 ++#git clone https://github.com/libexpat/libexpat.git
 ++git clone --depth 1 --no-single-branch --branch R_2_2_9 https://github.com/libexpat/libexpat.git
 + 
 + cd libexpat
 + 
 +-git checkout R_2_2_9
 ++#git checkout R_2_2_9
 + cd expat
 + 
 + rm -rf build
 +diff -ur third-party_bak/script/build_flatbuffers.sh third-party/script/build_flatbuffers.sh
 +--- third-party/script/build_flatbuffers.sh
 ++++ third-party/script/build_flatbuffers.sh
 +@@ -6,12 +6,13 @@
 + cd src
 + 
 + if [ ! -d "flatbuffers" ]; then
 +-    git clone https://github.com/google/flatbuffers.git
 ++    #git clone https://github.com/google/flatbuffers.git
 ++    git clone 1 --no-single-branch --branch v1.11.0 https://github.com/google/flatbuffers.git
 + fi
 + cd flatbuffers
 + 
 +-git reset --hard
 +-git checkout v1.11.0
 ++#git reset --hard
 ++#git checkout v1.11.0
 + 
 + mkdir out && cd out
 + cmake ..
 +diff -ur third-party_bak/script/build_geoip.sh third-party/script/build_geoip.sh
 +--- third-party/script/build_geoip.sh
 ++++ third-party/script/build_geoip.sh
 +@@ -6,11 +6,12 @@
 + 
 + 
 + if [ ! -d "geoip-api-c" ]; then
 +-    git clone https://github.com/maxmind/geoip-api-c.git
 ++    #git clone https://github.com/maxmind/geoip-api-c.git
 ++    git clone --depth 1 --no-single-branch --branch v1.6.12 https://github.com/maxmind/geoip-api-c.git
 + fi
 + cd geoip-api-c
 +-git reset --hard
 +-git checkout v1.6.12
 ++#git reset --hard
 ++#git checkout v1.6.12
 + 
 + ./bootstrap
 + CPPFLAGS="-I../../include -fPIC" ./configure --prefix=$PREFIX --enable-shared=no
 +diff -ur third-party_bak/script/build_isal.sh third-party/script/build_isal.sh
 +--- third-party/script/build_isal.sh
 ++++ third-party/script/build_isal.sh
 +@@ -6,11 +6,12 @@
 + 
 + 
 + if [ ! -d "isa-l" ]; then
 +-    git clone https://github.com/intel/isa-l.git
 ++    #git clone https://github.com/intel/isa-l.git
 ++    git clone --depth 1 --no-single-branch --branch v2.26.0 https://github.com/intel/isa-l.git
 + fi
 + cd isa-l
 +-git reset --hard
 +-git checkout v2.26.0
 ++#git reset --hard
 ++#git checkout v2.26.0
 + 
 + ./autogen.sh
 + #CFLAGS="-O0 -g" ./configure --prefix=$PREFIX --enable-shared=no --enable-debug=yes
 +diff -ur third-party_bak/script/build_libmodsec.sh third-party/script/build_libmodsec.sh
 +--- third-party/script/build_libmodsec.sh
 ++++ third-party/script/build_libmodsec.sh
 +@@ -12,18 +12,20 @@
 + 
 + 
 + if [ ! -d ModSecurity ]; then
 +-    git clone https://github.com/SpiderLabs/ModSecurity
 ++    #git clone https://github.com/SpiderLabs/ModSecurity
 ++    git clone --depth 1 --no-single-branch --branch v3.0.5 https://github.com/SpiderLabs/ModSecurity
 + fi
 + cd ModSecurity
 +-git reset --hard
 +-git checkout -b v3/master origin/v3/master
 +-git pull
 +-git checkout v3.0.5
 ++#git reset --hard
 ++#git checkout -b v3/master origin/v3/master
 ++#git pull
 ++#git checkout v3.0.5
 + 
 + export PATH=/home/build/tools/bin/:$PATH
 + sh build.sh
 +-git submodule init
 +-git submodule update
 ++#git submodule init
 ++#git submodule update
 ++git submodule update --init --recursive --recommend-shallow --depth 1
 + CPPFLAGS="-fPIC $CPPFLAGS" ./configure --with-yajl=$PREFIX --with-geoip=$PREFIX --with-maxmind=$PREFIX --disable-shared --enable-static --with-pcre=$PREFIX --with-curl=$PREFIX --with-libxml=$PREFIX --with-lmdb=$PREFIX --with-lua=$PREFIX --disable-examples
 + make -j4
 + 
 +diff -ur third-party_bak/script/build_lmdb.sh third-party/script/build_lmdb.sh
 +--- third-party/script/build_lmdb.sh
 ++++ third-party/script/build_lmdb.sh
 +@@ -16,13 +16,14 @@
 + fi
 + 
 + if [ ! -d "lmdb" ]  ; then
 +-    git clone https://git.openldap.org/openldap/openldap.git lmdb
 ++    #git clone https://git.openldap.org/openldap/openldap.git lmdb
 ++    git clone --depth 1 --no-single-branch --branch LMDB_0.9.27 https://git.openldap.org/openldap/openldap.git lmdb
 + fi
 + 
 + cd lmdb
 +-git checkout master
 +-git pull
 +-git checkout LMDB_0.9.27
 ++#git checkout master
 ++#git pull
 ++#git checkout LMDB_0.9.27
 +     
 +     cd libraries/liblmdb/
 +     XCFLAGS=-fPIC make
 +diff -ur third-party_bak/script/build_lslb.sh third-party/script/build_lslb.sh
 +--- third-party/script/build_lslb.sh
 ++++ third-party/script/build_lslb.sh
 +@@ -8,7 +8,8 @@
 +     mkdir lib64
 + fi
 + 
 +-git submodule update --init
 ++#git submodule update --init
 ++git submodule update --init --recursive --recommend-shallow --depth 1
 + cd script
 + 
 + for BUILD_LIB in $BUILD_LIBS
 +diff -ur third-party_bak/script/build_netmap.sh third-party/script/build_netmap.sh
 +--- third-party/script/build_netmap.sh
 ++++ third-party/script/build_netmap.sh
 +@@ -5,9 +5,10 @@
 + PREFIX=`pwd`
 + cd src
 + if [ ! -d "netmap" ]  ; then
 +-    git clone https://github.com/luigirizzo/netmap.git
 ++    #git clone https://github.com/luigirizzo/netmap.git
 ++    git clone --depth 1 --no-single-branch --branch 00335cd4b6347e6ecc79a67ab200ba2e050c9646 https://github.com/luigirizzo/netmap.git
 +     cd netmap
 +-    git checkout 00335cd4b6347e6ecc79a67ab200ba2e050c9646
 ++    #git checkout 00335cd4b6347e6ecc79a67ab200ba2e050c9646
 +     cd ..
 + fi
 + cd ..
 +diff -ur third-party_bak/script/build_ols.sh third-party/script/build_ols.sh
 +--- third-party/script/build_ols.sh
 ++++ third-party/script/build_ols.sh
 +@@ -8,10 +8,11 @@
 +     mkdir lib64
 + fi
 + 
 +-git submodule update --init
 ++#git submodule update --init
 ++git submodule update --init --recursive --recommend-shallow --depth 1
 + cd script
 + 
 + for BUILD_LIB in $BUILD_LIBS
 + do 
 +-   ./build_$BUILD_LIB.sh
 ++   bash -x ./build_$BUILD_LIB.sh
 + done
 +
 +diff -ur third-party_bak/script/build_openldap.sh third-party/script/build_openldap.sh
 +--- third-party/script/build_openldap.sh
 ++++ third-party/script/build_openldap.sh
 +@@ -6,12 +6,13 @@
 + 
 + 
 + if [ ! -d openldap ]; then
 +-git clone https://github.com/openldap/openldap.git
 ++#git clone https://github.com/openldap/openldap.git
 ++git clone --depth 1 --no-single-branch --branch OPENLDAP_REL_ENG_2_4_46 https://github.com/openldap/openldap.git
 + 
 + fi
 + 
 + cd openldap
 +-git checkout OPENLDAP_REL_ENG_2_4_46
 ++#git checkout OPENLDAP_REL_ENG_2_4_46
 + 
 + 
 + LD_FLAGS="-L$PREFIX/lib -L/usr/local/lib -ldecrepit -lpthread"
 +diff -ur third-party_bak/script/build_openssl.sh third-party/script/build_openssl.sh
 +--- third-party/script/build_openssl.sh
 ++++ third-party/script/build_openssl.sh
 +@@ -6,7 +6,8 @@
 + cd src
 + 
 + if [ ! -d "openssl" ]; then
 +-    git clone https://github.com/openssl/openssl.git
 ++    #git clone https://github.com/openssl/openssl.git
 ++    git clone --depth 1 --no-single-branch --branch OpenSSL_1_0_2p https://github.com/openssl/openssl.git
 + fi
 + 
 + #RELEASE=OpenSSL_1_1_1a
 +@@ -15,11 +16,11 @@
 + #DEBUG="-d"
 + 
 + cd openssl
 +-git reset --hard
 ++#git reset --hard
 + 
 +-git checkout master
 +-git pull
 +-git checkout $RELEASE
 ++#git checkout master
 ++#git pull
 ++#git checkout $RELEASE
 + 
 + make clean
 + ./config $DEBUG --prefix=$PREFIX --openssldir=$PREFIX/lib/openssl -DPURIFY no-shared no-dso
 +diff -ur third-party_bak/script/build_zlib-cf.sh third-party/script/build_zlib-cf.sh
 +--- third-party/script/build_zlib-cf.sh
 ++++ third-party/script/build_zlib-cf.sh
 +@@ -6,7 +6,8 @@
 + cd src
 + 
 + if [ ! -d "zlib-cf" ]  ; then
 +-    git clone https://github.com/cloudflare/zlib.git zlib-cf
 ++    #git clone https://github.com/cloudflare/zlib.git zlib-cf
 ++    git clone --depth 1 https://github.com/cloudflare/zlib.git zlib-cf
 + fi
 +     
 + cd zlib-cf
 +diff -ur third-party_bak/script/build_zlib.sh third-party/script/build_zlib.sh
 +--- third-party/script/build_zlib.sh
 ++++ third-party/script/build_zlib.sh
 +@@ -6,7 +6,8 @@
 + cd src
 + 
 + if [ ! -d "zlib" ]  ; then
 +-    git clone https://github.com/madler/zlib.git
 ++    #git clone https://github.com/madler/zlib.git
 ++    git clone --depth 1 https://github.com/madler/zlib.git
 + fi
 +     
 + cd zlib
 +diff -ur third-party_bak/script/build_zmq.sh third-party/script/build_zmq.sh
 +--- third-party/script/build_zmq.sh
 ++++ third-party/script/build_zmq.sh
 +@@ -9,13 +9,14 @@
 + #rm -rf libzmq
 + 
 + if [ ! -d libzmq ]; then
 +-    git clone https://github.com/zeromq/libzmq.git
 ++    #git clone https://github.com/zeromq/libzmq.git
 ++    git clone --depth 1 --no-single-branch --branch curl-7_65_3 v4.3.3 https://github.com/zeromq/libzmq.git
 + fi
 +     cd libzmq 
 + 
 +-    git reset --hard
 +-    git pull
 +-    git checkout v4.3.3
 ++    #git reset --hard
 ++    #git pull
 ++    #git checkout v4.3.3
 + 
 +     mkdir build
 +     cd build
 +EOF
 +
 +cd openlitespeed
 +./build.sh
 +  </textarea>
 +  <a href="https://codemirror.net/">CodeMirror</a> Version: <label id="lblCdMirrVer002"></label>
 +
 +  <script>
 +  var jsEditor = CodeMirror.fromTextArea(document.getElementById('CodeMirror002'), {
 +    mode: "shell",
 +    theme: "cobalt",
 +    lineNumbers: true,
 +    indentUnit: 4
 +  });
 +  document.getElementById('lblCdMirrVer002').innerText = CodeMirror.version;
 +  </script>
 +</div>
 +</html>
 +
 +[[+tab|.fedora_support_for_scripts:script_debug_003|003 Fedora 対応 + ビルド時間短縮スクリプト (実行結果)🤤]]\\
 +
 +===== 参考文献 =====
 +[[git>litespeedtech/lsquic/issues/4|eror on cmake . &&  make · Issue #4 · litespeedtech/lsquic]]\\
 +[[git>php/php-src|GitHub - php/php-src: The PHP Interpreter]]\\
 +
 +==== 付録 ====
 +[[tw>tomoyan596sp/status/1189522004820426753|OpenLiteSpeedをFedora向けに直してみるよ!]]\\
 +[[tw>tomoyan596sp/status/1574519601018568704|epel-releaseパッケージが無い...🤔AlmaLinux、CentOS、Debian 、Ubuntuでのビルドしか想定されていないのかも😇]]\\
 +
 +==== Development Tools パッケージ グループの内容 ====
 +<WRAP color_term>
 +<WRAP color_command><html><pre>
 +<b class=GRN>$</b> <b class=HIY>dnf</b> groupinfo "Development Tools"
 +</pre></html></WRAP>
 +<WRAP color_result_long><html><pre>
 +メタデータの期限切れの最終確認: 0:00:28 時間前の 2022年09月28日 06時04分15秒 に実施しました。
 +グループ: 開発ツール
 + 説明: These tools include general development tools such as git and CVS.
 + 必須なパッケージ:
 +   gettext
 + 標準パッケージ:
 +   diffstat
 +   doxygen
 +   git
 +   patch
 +   patchutils
 +   subversion
 +   systemtap
 + オプション パッケージ:
 +   buildbot
 +   colordiff
 +   cvs
 +   cvs2cl
 +   cvsgraph
 +   cvsps
 +   darcs
 +   dejagnu
 +   expect
 +   gambas3-ide
 +   git-annex
 +   git-cola
 +   git2cl
 +   gitg
 +   gtranslator
 +   highlight
 +   lcov
 +   manedit
 +   meld
 +   monotone
 +   myrepos
 +   nemiver
 +   qgit
 +   quilt
 +   rapidsvn
 +   rcs
 +   robodoc
 +   scanmem
 +   subunit
 +   svn2cl
 +   tig
 +   tkcvs
 +   tortoisehg
 +   translate-toolkit
 +   utrac
 +</pre></html></WRAP>
 +</WRAP>