zoukankan      html  css  js  c++  java
  • 【转】ffluos编译

    FluffOS是在MUDOS基础上更新完成的。进行了许多新功能和bug修复。 针对LPC有很好的兼容性,如果你的MUD运行MUDOS V22+版本,可以很容易运行在fluffos上。
    系统环境:
    
    CnetOS 7.x mini 最小化安装
     
    
    安装 mysql-community-devel 需要先安装mysql的源
    
    wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
    sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
     
    
    安装编译环境
    
    yum install git
    yum install gcc-c++
    yum install bison-devel
    yum install libevent-devel
    yum install zlib-devel
    yum install pcre-devel
    yum install autoconf
    yum install dos2unix 
    yum install golang
    yum install mysql-community-devel
    yum install unzip
    yum install pam-devel
     
    
    Git获取FluffOS最新源码
    
    git clone https://github.com/fluffos/fluffos.git
     
    
    这个是fluffos 3.o.x  设置好的 local_options ,兼容旧 Mudlib ( 后面有时间再补充每条设置的说明 )
    
     
    
    注意: #undef SENSIBLE_MODIFIERS 
    
    如果关注支持(static 模式),如果打开将不支持(static模式)
    
    需要修改mudlib的部分代码,关健词(static、array),static 改为 nosave, array改为 mixed
    
    /*
     * local_options.h: compile-time configuration of the driver
     */
    
    #ifndef _LOCAL_OPTIONS_H_
    #define _LOCAL_OPTIONS_H_
    
    /****************************************************************************
     *                              COMPAT                                      *
     ****************************************************************************/
    #undef NO_ADD_ACTION
    #undef NO_SNOOP
    #undef NO_ENVIRONMENT
    #undef NO_WIZARDS
    #undef NO_LIGHT
    #define OLD_ED
    #undef ED_INDENT_CASE
    #define ED_INDENT_SPACES 4
    #undef ED_USE_TABS
    #define ED_TAB_WIDTH 8
    #undef RECEIVE_ED
    #define RESTRICTED_ED
    #define SENSIBLE_MODIFIERS
    #define ARRAY_RESERVED_WORD
    
    /****************************************************************************
     *                           MISCELLANEOUS                                  *
     ****************************************************************************/
    #define CUSTOM_CRYPT
    #undef COMPAT_32
    #define DEFAULT_PRAGMAS PRAGMA_SAVE_TYPES + PRAGMA_ERROR_CONTEXT + PRAGMA_OPTIMIZE
    #define SAVE_EXTENSION ".o"
    #undef PRIVS
    #undef NO_SHADOWS
    #undef USE_ICONV
    #undef IPV6
    #undef DTRACE
    
    /****************************************************************************
     *                              PACKAGES                                    *
     ****************************************************************************/
    #define PACKAGE_OPS
    #define PACKAGE_CORE
    
    #define PACKAGE_CONTRIB
    #define PACKAGE_DEVELOP
    #define PACKAGE_MATH
    #undef PACKAGE_MATRIX
    #define PACKAGE_MUDLIB_STATS
    #define PACKAGE_SOCKETS
    #undef PACKAGE_PARSER
    #define PACKAGE_EXTERNAL
    
    #ifdef PACKAGE_DB
    #define USE_MYSQL 1
    #undef USE_MSQL
    #undef USE_POSTGRES
    #undef USE_SQLITE3
    #define DEFAULT_DB  USE_MYSQL 
    #endif  
     
    #define PACKAGE_ASYNC
    #define PACKAGE_SHA1
    #undef PACKAGE_CRYPTO
    #define PACKAGE_TRIM
    #define PACKAGE_PCRE
    #undef PACKAGE_DWLIB
    #define PACKAGE_UIDS
    #ifdef PACKAGE_UIDS
    #define AUTO_SETEUID
    #undef AUTO_TRUST_BACKBONE
    #endif
    #define PACKAGE_COMPRESS
    #define SAVE_GZ_EXTENSION ".o.gz"
    #undef PACKAGE_THREAD
    
    #undef DEBUGMALLOC 
    #undef DEBUGMALLOC_EXTENSIONS
    #undef CHECK_MEMORY 
    
    #endif /* _LOCAL_OPTIONS_H_ */
     
    
    编译FluffOS过程
    
    $ cd fluffos
    $ ./build.FluffOS     #如果你编译环境缺少依赖包会在这个过程提醒,通过 yum search xxx 查找,安装再继续build
    $ make                #上面build这一步通过,这一步基本没什么问题,很顺利
    $ make install  
     
    
    部署你的 FluffOS+MudLib
    
    #假设你的fluffos编译目录在 /home/fluffos/
    
    #假如你的mudlib运行目录在  /home/xxxmud/
    
    /home/fluffos/src/  编译成功后的驱动(driver、dtrace_compile)
            |
            |--src/--- driver
    
    
    /home/xxxmud/ #mud布署目录
            ||------ bin/
            ||-- driver        #刚编译好的驱动移到这里
            ||-- config.ini   #mud配置文件( 要参考/home/fluffos/src/Config.example 修改 )
            |
            |------ mudlib/        #把你的mudlib整个打包解压放到这里
                         |-- adm
                         |-- binaries
                         |--.............
     
    
    有关mud配置文件 参考 /home/fluffos/src/Config.example 进行修改
    
    下面放一个config.ini 样例:
    
    vi /home/xxxmud/bin/config.ini
    
    name : HY-JHFY 
    mud ip : 0.0.0.0    # all ip
    external_port_1 : telnet 8888
    external_port_2 : binary 6666
    mudlib directory : /home/xxxmud/code
    binary directory : /home/xxxmud/bin
    log directory : /log
    include directories : /include
    master file : /adm/single/master
    simulated efun file : /adm/single/simul_efun
    swap file : /adm/single/swapfile
    debug log file : debug.log
    global include file : "/include/globals.h"
    default fail message : What?
    default error message :
    time to clean up : 900
    time to reset : 1800
    time to swap : 900
    compiler stack size : 600
    evaluator stack size : 6000
    inherit chain size : 30
    maximum evaluation cost : 30000000
    maximum local variables : 200
    maximum call depth : 150
    maximum array size : 25000
    maximum buffer size : 400000
    maximum mapping size : 150000
    maximum string length : 320000
    maximum bits in a bitfield : 12000
    maximum byte transfer : 200000
    maximum read file size : 320000
    hash table size : 7001
    object table size : 1501
    living hash table size : 256
    gametick msec : 1000
    heartbeat interval msec : 1000
    sane explode string : 1
    reversible explode string : 0
    sane sorting : 1
    warn tab : 0
    wombles : 0
    call other type check : 0
    call other warn : 0
    mudlib error handler : 1
    no resets : 0
    lazy resets : 0
    randomized resets : 1
    no ansi : 1
    strip before process input : 1
    this player in call_out : 1
    trace : 1
    trace code : 0
    interactive catch tell : 0
    receive snoop : 1
    snoop shadowed : 0
    reverse defer : 0
    has console : 1
    noninteractive stderr write : 0
    trap crashes : 1
    old type behavior : 0
    old range behavior : 0
    warn old range behavior : 1
    supress argument warnings : 1
    enable_commands call init : 1
    sprintf add_justified ignore ANSI colors : 1
    apply cache bits : 22
    call_out(0) next level : 1000
    maximum users : 5000
     
    
    好了下面我们开始启动mud服务吧,继续往下看介绍将mud加为centos服务自动启动。
    
    [root@mud]# /home/hymud/bin/driver /home/hymud/bin/config.conf&
     
    
    在部署过程中会遇到的一些问题
    
    1、Linux (*.h *.c )乱码及回车符号问题
    
    由于大多人编码在windows下编码,在Linux上需要转换一下(或者通过ftp上传时会可自动转码)
    
    使用下面的命令进行转码操作
    
    [root@mud mud]# cd /home/xxxmud
    [root@mud mud]# find . -name "*.h" -exec dos2unix {} ;
    [root@mud mud]# find . -name "*.c" -exec dos2unix {} ;
    [root@mud mud]# find . -name "*.o" -exec dos2unix {} ;
     
    
    2、迁移后用户密码错误登陆不了
    
    因为FluffOS 默认使用md5加密,不过 FluffOS  同样兼容 crypt 加密
    
    修改 vi /home/xxxmud/mudlib/include/globals.h   不同的mudlib 可能位置不一样
    
    加入 #define crypt oldcrypt   即可。
    
    // globals.h 
    // this file will be automatically included by the driver
    
    #define SAVE_EXTENSION __SAVE_EXTENSION__
    #define save_binary
    
    #pragma optimize 
    #pragma save_binary 
    
    #define crypt oldcrypt  
     
    
    3、服务器端出现很多警告信息
    
    出现这个问题,一般是因为你编译时的 local_options 设置问题,去掉 PRAGMA_WARNINGS  重新编译。
    修改: #define DEFAULT_PRAGMAS PRAGMA_WARNINGS + PRAGMA_SAVE_TYPES + PRAGMA_ERROR_CONTEXT + PRAGMA_OPTIMIZE
    改为: #define DEFAULT_PRAGMAS PRAGMA_SAVE_TYPES + PRAGMA_ERROR_CONTEXT + PRAGMA_OPTIMIZE
     
    
    4、将你的mud 加入到 centos 的自动启动服务的教程及脚本
    
    编译启动脚本
    
    记得要修改脚本内的以下配置为你的实际配置
    
    ########## Mud Start Config ############
    DIR=/home/xxxmud/bin    #你实际的mud fluffos驱动地址
    MUDCONFIG=${DIR}/config.ini  #你mud的配置文件名字
    MUDNAME=HY6             #你mud的名字,用于存放进程pid号
    MUDSTARTNAME=xxxmud     #你mud这个启动脚本的名字
    ########################################
    vi /etc/rc.d/init.d/xxxmud
    
    #!/bin/bash
    #chkconfig: 2345 80 90
    #description:hymud
    ########## Mud Start Config ############
    DIR=/home/xxxmud/bin
    MUDCONFIG=${DIR}/config.ini
    MUDNAME=HY6
    MUDSTARTNAME=xxxmud
    ########################################
    
    RETVAL=0 
    NUM=0
    
    ulimit -n 65535 
    echo 999999999 > /proc/sys/vm/max_map_count
    
    usage ()
    {
        echo $"Usage: $0 {start|stop|restart|status}" 1>&2
        RETVAL=2
    }   
    
    start ()
    {
            while(( $NUM < 1 ))
            do
            sn=`ps -ef | grep driver | grep -v grep |awk '{print $2}'`
            
            if [ ! $sn ]; then
               sn=0
            fi
    
            function ck_pid() {
                    if [[ -f $1 ]]; then
                            if [[ ${sn} = `cat $1` ]]; then
                                    echo "${MUDSTARTNAME} Service Runing PID: ${sn}"
                            else
                                      ${DIR}/driver ${MUDCONFIG} &
                    echo $! > ${DIR}/${MUDNAME}.pid 
                            fi
                    else 
                ${DIR}/driver ${MUDCONFIG} &
                echo $! > ${DIR}/${MUDNAME}.pid
            fi
            }
    
            ck_pid ${DIR}/${MUDNAME}.pid
            sleep 5
            done
    }
    
    stop ()
    {
        function kill_pid() {
            if [[ -f $1 ]]; then
                kill -9 `cat $1`
                rm $1
            fi
        }
        kill_pid ${DIR}/${MUDNAME}.pid
        [ "$?" != "0" ] && RETVAL=1
    }
    
    status ()
    { 
        sn=`ps -ef | grep driver | grep -v grep |awk '{print $2}'`
    
            if [ ! $sn ]; then
               sn=0
            fi
    
        function ck_pid() {
            if [[ -f $1 ]]; then
                if [[ ${sn} = `cat $1` ]]; then
                    echo "${MUDSTARTNAME} Service Runing PID: ${sn}"
                else
                    echo "${MUDSTARTNAME} Service Not Run" 
                fi    
            fi
        }
    
        ck_pid ${DIR}/${MUDNAME}.pid  
    }
    
    restart ()
    {
        stop
        start
    }
    
    case "$1" in
        stop) stop ;;
        status) status ;;
        start|restart) restart ;;
        *) usage ;;
    esac
    
    exit $RETVAL
     
    
    然后加入系统服务来启动
    
    #改变权限
    
    chown root.root /etc/rc.d/init.d/xxxmud #所有用户都可以执行,单只有root可以修改
    chmod +x /etc/rc.d/init.d/xxxmud #将mysqld 放入linux启动管理体系中
    chkconfig --add xxxmud #打开自启动
    chkconfig xxxmud on
     
    
    #相关使用命令
    
    service xxxmud start  #启动mud服务
    service xxxmud restart #重启mud服务
    service xxxmud stop    #停止mud服务
    service xxxmud status  #查看mud运行状态
     
  • 相关阅读:
    手把手教你利用create-nuxt-app脚手架创建NuxtJS应用
    初识NuxtJS
    webpack打包Vue应用程序流程
    用选择器代替表格列的筛选功能
    Element-UI
    Spectral Bounds for Sparse PCA: Exact and Greedy Algorithms[贪婪算法选特征]
    Sparse Principal Component Analysis via Rotation and Truncation
    Generalized Power Method for Sparse Principal Component Analysis
    Sparse Principal Component Analysis via Regularized Low Rank Matrix Approximation(Adjusted Variance)
    Truncated Power Method for Sparse Eigenvalue Problems
  • 原文地址:https://www.cnblogs.com/cfas/p/6497764.html
Copyright © 2011-2022 走看看