外部库依赖以及 编译

前端之家收集整理的这篇文章主要介绍了外部库依赖以及 编译前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

目录树:

.
├── Makefile
├── outlib
└── src
    ├── pkg
    │ ├── http-parser-2.7.1.tar.gz
    │ ├── jansson-2.9.tar.gz
    │ ├── json2pb-master-master.zip
    │ ├── libbacktrace-master.zip
    │ ├── libunwind-1.1.tar.gz
    │ ├── PHP-5.6.25.tar.gz
    │ ├── protobuf-2.5.0.tar.gz
    │ ├── Python-2.7.12.tgz
    │ ├── setuptools-32.0.0.tar.gz
    │ └── zookeeper-3.4.8.tar.gz
    └── tmp

Makefile 文件:

OUTLIBDIR=$(shell pwd)
ZOOKEEPER_TAR_PATH=$(OUTLIBDIR)/src/pkg/zookeeper-3.4.8.tar.gz
JANSSON_TAR_PATH=$(OUTLIBDIR)/src/pkg/jansson-2.9.tar.gz
LIBUNWIND_TAR_PATH=$(OUTLIBDIR)/src/pkg/libunwind-1.1.tar.gz
LIBBACKTRACE_TAR_PATH=$(OUTLIBDIR)/src/pkg/libbacktrace-master.zip
HTTP_PARSER_TAR_PATH=$(OUTLIBDIR)/src/pkg/http-parser-2.7.1.tar.gz
JSON2PB_TAR_PATH=$(OUTLIBDIR)/src/pkg/json2pb-master-master.zip
PHP_TAR_PATH=$(OUTLIBDIR)/src/pkg/PHP-5.6.25.tar.gz
PROTOBUF_TAR_PATH=$(OUTLIBDIR)/src/pkg/protobuf-2.5.0.tar.gz
PYTHON_TAR_PATH=$(OUTLIBDIR)/src/pkg/Python-2.7.12.tgz
SETUPTOOLS_TAR_PATH=$(OUTLIBDIR)/src/pkg/setuptools-32.0.0.tar.gz
R3C_TAR_PATH=$(OUTLIBDIR)/src/pkg/r3c-master.zip

all: zookeeper jansson libunwind libbacktrace json2pb python setuptools http_parser protobuflib PHP r3c

zookeeper:
	if [ ! -d "./outlib/zookeeper" ]; then \
		-rm ./outlib/zookeeper -rf; \
		mkdir -p ./outlib/zookeeper; \
		tar -zxvf $(ZOOKEEPER_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/zookeeper*/src/c; \
		./configure --prefix=$(OUTLIBDIR)/outlib/zookeeper; make; make install; \
	fi

jansson:
	if [ ! -d "./outlib/jansson" ]; then \
		-rm ./outlib/jansson -rf; \
		mkdir -p ./outlib/jansson; \
		tar zxvf $(JANSSON_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/jansson*/; \
		./configure --prefix=$(OUTLIBDIR)/outlib/jansson; make; make install; \
	fi

libunwind:
	if [ ! -d "./outlib/libunwind" ]; then \
		-rm ./outlib/libunwind -rf; \
		mkdir -p ./outlib/libunwind; \
		tar zxvf $(LIBUNWIND_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/libunwind*; \
		./configure --prefix=$(OUTLIBDIR)/outlib/libunwind; make; make install; \
	fi

libbacktrace:
	if [ ! -d "./outlib/libbacktrace" ]; then \
		-rm ./outlib/libbacktrace -rf; \
		mkdir -p ./outlib/libbacktrace; \
		unzip -o $(LIBBACKTRACE_TAR_PATH) -d ./src/tmp/; \
		cd ./src/tmp/libbacktrace*; \
		./configure --prefix=$(OUTLIBDIR)/outlib/libbacktrace; make; make install; \
	fi 

json2pb:
	if [ ! -d "./outlib/json2pb" ]; then \
		mkdir -p ./outlib/json2pb; \
		unzip -o $(JSON2PB_TAR_PATH) -d ./src/tmp/; \
		mv ./src/tmp/json2pb* ./outlib/json2pb; \
	fi

python:
	if [ ! -d "./outlib/python" ]; then \
		mkdir -p ./outlib/python; \
		tar -xvf $(PYTHON_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/Python* ;\
		./configure --enable-shared --prefix=$(OUTLIBDIR)/outlib/python; \
		make; make install; \
	fi; 

setuptools: python
	if [ ! -f "./outlib/setuptools" ]; then \
		rm ./outlib/setuptools -rf; \
		mkdir -p ./outlib/setuptools; \
		tar zxvf $(SETUPTOOLS_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/setuptools*; \
		export LD_LIBRARY_PATH=$(OUTLIBDIR)/outlib/python/lib; \
		export PYTHONHOME=$(OUTLIBDIR)/outlib/python; \
		$(OUTLIBDIR)/outlib/python/bin/python bootstrap.py; \
		$(OUTLIBDIR)/outlib/python/bin/python setup.py install; \
		cd -; \
	fi

http_parser:
	if [ ! -d "./outlib/http-parser" ]; then \
		-rm ./outlib/http-parser -rf; \
		tar zxvf $(HTTP_PARSER_TAR_PATH) -C ./src/tmp/; \
		mv ./src/tmp/http-parser* ./outlib/http-parser; \
	fi

PHP:
	if [ ! -d "./outlib/PHP" ]; then \
		rm ./outlib/PHP -rf; \
		tar -zxvf $(PHP_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/PHP* ;\
		./configure --enable-debug --without-pear --disable-xmlreader --disable-xmlwriter --disable-xml --disable-libxml --disable-dom --disable-simplexml --enable-sockets --enable-maintainer-zts --disable-cgi --enable-json --enable-cli --enable-embed --with-MysqL=MysqLnd --with-MysqLi=MysqLnd --with-pdo-MysqL=MysqLnd --enable-pdo -- prefix=$(OUTLIBDIR)/outlib/PHP; \
		make; make install; \
	fi

protobuflib: python setuptools
	@if [ ! -f "./outlib/pb/libprotobuf.a" ]; then \
		tar zxvf $(PROTOBUF_TAR_PATH) -C ./src/tmp/; \
		cd ./src/tmp/protobuf*; \
		./configure CFLAGS=-fPIC CPPFLAGS=-fPIC CXXFLAGS=-fPIC --prefix=$(OUTLIBDIR)/outlib/pb;\
		make; make install; \
		/bin/sh ./libtool --tag=CXX   --mode=link g++ -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -pthread  -o protoc src/main.o -lpthread ./src/.libs/libprotoc.a ./src/.libs/libprotobuf.a -lz; \
		export LD_LIBRARY_PATH=$(OUTLIBDIR)/outlib/python/lib; \
		export PYTHONHOME=$(OUTLIBDIR)/outlib/python; \
		$(OUTLIBDIR)/outlib/python/bin/python setup.py build; \
		$(OUTLIBDIR)/outlib/python/bin/python setup.py install; \
		cp $(OUTLIBDIR)/src/tmp/protobuf-*/protoc $(OUTLIBDIR)/outlib/pb; \
	fi

r3c:
	@if [ ! -f "./outlib/r3c" ]; then \
		unzip -o $(R3C_TAR_PATH) -d ./outlib/; \
		mv ./outlib/r3c* ./outlib/r3c; \
		cd ./outlib/r3c/; \
		make libr3c.a; \
	fi

clean:
	rm -rf $(OUTLIBDIR)/outlib/*

猜你在找的设计模式相关文章