// //// Building cpps libs tool for Unix.v1.0.0 //// //// MIT License //// //// Copyright (c) 2020 johnsonyl //// //// Permission is hereby granted, free of charge, to any person obtaining a copy //// of this software and associated documentation files (the "Software"), to deal //// in the Software without restriction, including without limitation the rights //// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //// copies of the Software, and to permit persons to whom the Software is //// furnished to do so, subject to the following conditions: //// //// The above copyright notice and this permission notice shall be included in all //// copies or substantial portions of the Software. //// //// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //// SOFTWARE. //// //// //// ------------------------------------------------------------------------------ //// BUILD CPPS LIBS //// bugreport:88481106@qq.com //// ------------------------------------------------------------------------------ //var RED = 1;var GREEN = 2;var YELLOW = 3;var BLUE = 4;var PURPLE = 5;var CYAN = 6;//not support windows.if(sys.os == "windows"){println_color("Only Unix OS build libs, Windows Please Use Visual Studio Build.",RED);exit(0);}var execute(var cmd){return execmd(cmd);}var checkdepsfile(var filepath){print("-- CHECK Deps for {filepath} - ");var result = io.file_exists("deps/{filepath}")if(result == false){println_color("not found",RED);println_color("deps/{filepath} not found.",RED);exit(0);}elseprintln_color("found",GREEN);}var checkdepsdir(var filepath){print("-- CHECK DepsDir for {filepath} - ");var depsdir = "{io.getrealpath()}../deps/{filepath}";depsdir = io.normpath(depsdir);depsdir.replace("\\","/");depsdir.pop_back();var result = io.isdir(depsdir);if(result == false){println_color("not found",RED);println_color("{io.getrealpath()}deps/{filepath} not found.",RED);exit(0);}elseprintln_color("found",GREEN);}var uncompress(var dir,var filepath){print("-- uncompress Deps for {filepath} - ");var a = execute("tar -zxvf {dir}/{filepath}");println_color("ok",GREEN);}print("-- CHECK for tar - ");var result = execute("which tar");if(result.find("/usr/bin/tar") == string.npos){println_color("not found",RED);println_color("You OS not install tar command. Please install tar command and try again.",RED);exit(0);}elseprintln_color("found",GREEN);if(sys.os == "macos"){print("-- CHECK for mysql-connector-c - ");var result = io.file_exists("/opt/homebrew/opt/mysql-client/include/mysql/mysql.h")if(result == false){println_color("not found",RED);println_color("mysql-connector-c not found.",RED);println_color("please use 'brew install mysql-connector-c'.",RED);exit(0);}elseprintln_color("found",GREEN);}else if(sys.os == "linux"){print("-- CHECK for mysql-devel - ");var result = io.file_exists("/usr/include/mysql/mysql.h")if(result == false){println_color("not found",RED);println_color("mysql-devel not found.",RED);println_color("install mysql-devel on linux use look like 'yum -y install mysql-devel' or 'apt-get install libmysqlclient-dev'",RED);exit(0);}elseprintln_color("found",GREEN);}if(sys.os == "macos"){print("-- CHECK for curl - ");var result = io.file_exists("/opt/homebrew/opt/curl/include/curl/curl.h")if(result == false){println_color("not found",RED);println_color("curl not found. please use brew install curl",RED);exit(0);}elseprintln_color("found",GREEN);}//CHECK curl-7.74.0.tar.gzcheckdepsfile("curl-7.74.0.tar.gz");checkdepsfile("libuuid-1.0.3.tar.gz");checkdepsfile("libuv-1.40.0.tar.gz");checkdepsfile("mariadb-connector-c-3.1.11-src.tar.gz");checkdepsfile("openssl-1.1.1h.tar.gz");checkdepsfile("zlib-1.2.11.tar.gz");checkdepsfile("hiredis-1.0.0.tar.gz");checkdepsfile("re2-2020年11月01日.tar.gz");checkdepsfile("libpng-1.6.40.tar.gz");checkdepsfile("libffi-3.4.4.tar.gz");var depspath = "{io.getrealpath()}../deps";depspath = io.normpath(depspath);depspath.replace("\\","/");depspath.pop_back();println("-- Entered the directory: {depspath}");io.chdir(depspath);uncompress(depspath,"curl-7.74.0.tar.gz");uncompress(depspath,"libuuid-1.0.3.tar.gz");uncompress(depspath,"libuv-1.40.0.tar.gz");uncompress(depspath,"mariadb-connector-c-3.1.11-src.tar.gz");uncompress(depspath,"openssl-1.1.1h.tar.gz");uncompress(depspath,"zlib-1.2.11.tar.gz");uncompress(depspath,"hiredis-1.0.0.tar.gz");uncompress(depspath,"re2-2020年11月01日.tar.gz");uncompress(depspath,"libpng-1.6.40.tar.gz");uncompress(depspath,"libffi-3.4.4.tar.gz");if(sys.os != "macos")checkdepsdir("curl-7.74.0");checkdepsdir("hiredis-1.0.0");checkdepsdir("libuuid-1.0.3");checkdepsdir("libuv-1.40.0");checkdepsdir("mariadb-connector-c-3.1.11-src");checkdepsdir("openssl-1.1.1h");checkdepsdir("zlib-1.2.11");checkdepsdir("libpng-1.6.40");//build zlib-1.2.11var buildname = "zlib-1.2.11";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo ./configure");system("sudo make");system("sudo make install");//build openssl-1.1.1hvar buildname = "openssl-1.1.1h";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo ./config -fPIC shared zlib");system("sudo make");system("sudo make install");//build curl-7.74.0if(sys.os != "macos"){var buildname = "curl-7.74.0";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo ./configure --enable-static --with-ssl --with-zlib --enable-ipv6");system("sudo make");system("sudo make install");}//build hiredis-1.0.0var buildname = "hiredis-1.0.0";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo cmake .");system("sudo make");system("sudo make install");//build libuuid-1.0.3var buildname = "libuuid-1.0.3";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo ./configure");system("sudo make");system("sudo make install");//build re2-2020年11月01日var buildname = "re2-2020年11月01日";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo make");system("sudo make install");//build libuv-1.40.0var buildname = "libuv-1.40.0";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo cmake .");system("sudo make");system("sudo make install");//build mariadb-connector-c-3.1.11-srcvar buildname = "mariadb-connector-c-3.1.11-src";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo cmake .");system("sudo make");system("sudo make install");//build libpng-1.6.40var buildname = "libpng-1.6.40";var buildpath = "{depspath}/{buildname}";println("-- Entered the directory: {buildpath}");println("-- Building for : {buildname}");io.chdir(buildpath);system("sudo ./configure");system("sudo make");system("sudo make install");println("-- Leaved the directory: {depspath}");io.chdir(io.getrealpath());println_color("-- Installed deps is successful.",CYAN);var libspath = "{io.getrealpath()}../libs";libspath = io.normpath(libspath);libspath.replace("\\","/");libspath.pop_back();println("-- Entered the directory: {libspath}");io.chdir(libspath);system("sudo cmake .");system("sudo make");println("-- Leaved the directory: {libspath}");io.chdir(io.getrealpath());println_color("-- Build libs is successful.",CYAN);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model