Position:Home > privoxy编译成库

privoxy编译成库


1.     在package/ utils下创建privoxy_lib目录。在wifidog_lib目录下创建一个文件夹src和一个Makefile文件。Makefile文件编写内容如下:

#

# Copyright (C) 2006,2013 OpenWrt.org

#

# This is free software, licensed under the GNU General Public License v2.

# See /LICENSE for more information.

#

 

include $(TOPDIR)/rules.mk

 

PKG_NAME:=privoxy_lib

PKG_VERSION:=3.0.21

PKG_RELEASE:=1

 

 

PKG_LICENSE:=GPLv2

PKG_LICENSE_FILES:=LICENSE

 

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-stable

 

include $(INCLUDE_DIR)/package.mk

 

define Package/privoxy_lib

  SECTION:=utils

  CATEGORY:=Utilities

  DEPENDS:=+libpcre +libpthread +zlib

  TITLE:=web proxy with advanced filtering capabilities

endef

 

define Package/privoxy_lib/description

      Privoxy is a web proxy with advanced filtering capabilities for

      protecting privacy, modifying web page content, managing cookies,

      controlling access, and removing ads, banners, pop-ups and other

      obnoxious Internet junk. Privoxy has a very flexible configuration

      and can be customized to suit individual needs and tastes. Privoxy

      has application for both stand-alone systems and multi-user networks.

endef

 

define Build/Prepare

      mkdir -p $(PKG_BUILD_DIR)

      $(CP) ./src/* $(PKG_BUILD_DIR)/

endef

 

define Build/Configure

endef

 

define Build/Compile

      $(MAKE) -C $(PKG_BUILD_DIR) \

           CC="$(TARGET_CC)" \

           CFLAGS="$(TARGET_CFLAGS) -Wall" \

           LDFLAGS="$(TARGET_LDFLAGS)"

endef

     

define Package/privoxy_lib/conffiles

/etc/privoxy/config

endef

 

define Package/privoxy_lib/install

      $(INSTALL_DIR) $(1)/usr/bin

      $(INSTALL_BIN) $(PKG_BUILD_DIR)/test_libprivoxy $(1)/usr/bin/

      $(INSTALL_DIR) $(1)/usr/lib

      $(CP) $(PKG_BUILD_DIR)/libprivoxy.so* $(1)/usr/lib/

      $(INSTALL_DIR) $(1)/etc/privoxy

      $(CP) $(PKG_INSTALL_DIR)/etc/privoxy/* $(1)/etc/privoxy/

Recommend:软件国际化之 .po文件如何编译成.mo文件

背景知识 po文件简介     po文件本来是用来翻译程序源代码里的字符串的。先来稍微解释一下它本来的用途,需要一点点C语言的基础才能完全理解。如果理解有困难 ,可以忽略这段内容,不会对我们使用po来翻译造成任何影响。     目前大

      $(INSTALL_CONF) ./files/privoxy.config $(1)/etc/privoxy/config

endef

 

$(eval $(call BuildPackage,privoxy_lib))

 

2.     解压privoxy包进入src目录

Tar xzvf privoxy-3.0.21-stable-src.tar.gz  –C src

 

3.     在src下创建Makefile文件,内容如下:

LIB_VERMAJOR = 0

LIB_VERMINOR = 1

LIB_FILENAME = libprivoxy.so

 

OBJEXT = o

 

EXTRA_CFLAGS += -pthread -MD -fPIC -DPIC 

 

LIB_CFLAGS  = $(CFLAGS) $(EXTRA_CFLAGS) -shared

LIB_LDFLAGS = $(LDFLAGS) -pthread -Wl,-soname,$(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR)

 

privoxy_OBJECTS = actions.$(OBJEXT) cgi.$(OBJEXT)\

      cgiedit.$(OBJEXT) cgisimple.$(OBJEXT) deanimate.$(OBJEXT) \

      encode.$(OBJEXT) errlog.$(OBJEXT) filters.$(OBJEXT) \

      gateway.$(OBJEXT) jbsockets.$(OBJEXT) jcc.$(OBJEXT) \

      list.$(OBJEXT) loadcfg.$(OBJEXT) loaders.$(OBJEXT) \

      miscutil.$(OBJEXT) parsers.$(OBJEXT)  \

      ssplit.$(OBJEXT) urlmatch.$(OBJEXT) pcrs.$(OBJEXT)\

      pcre/get.$(OBJEXT) pcre/maketables.$(OBJEXT) pcre/study.$(OBJEXT)\

      pcre/pcre.$(OBJEXT) pcre/pcreposix.$(OBJEXT) privoxyapi.$(OBJEXT)

 

LIB_OBJ = $(privoxy_OBJECTS)

 

DEFAULT_INCLUDES = -Ipcre

 

AM_CPPFLAGS +=

 

COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \

      $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)

 

CCLD = $(CC)

LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)  $(AM_LDFLAGS) \

      $(LDFLAGS) -o $@

 

 

LIBS = -lnsl  -lz 

 

 

all: Makefile   libprivoxy   test_libprivoxy

 

test_libprivoxy: main.o libprivoxy

      @rm -f test_libprivoxy

      $(LINK)  main.o $(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR)  $(LIBS)

 

 

libprivoxy:$(LIB_OBJ)

      $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS)  $(LIB_OBJ) $(LIBS) \

           -o $(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR)

 

.c.o:

    $(CC) $(DEFS) $(AM_CPPFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CFLAGS)       $(EXTRA_CFLAGS) -c -o $@ $<

 

 

clean:

      rm -f  $(LIB_FILENAME)* *.o

4. 修改src下对应的源代码,同时把files/privoxy.init脚本提供的功能通过lib库提供,这样 lib库需要提供int privoxy_start (),int privoxy_stop ()。make package/privoxy_lib/compile  V=s进行编译生成libprivoxy.so.0.1和测试程序test_libprivoxy

 

Recommend:[最新] , Parallet的编译成IL执行已经成功验证.

第一个版本的Parallet是在DotNet里实现的. (自带GC省了很多工作量) 当前进度是, 在同一个编译系统中同时实现了 解释执行,编译执行,调用IL,被IL调用,IL类型,新类型系统 这6个东西混在一起是非常复杂的. 互相调用时的同步异步模式转换,参数

Recommend:PDFBox 1.0.0 如何编译成.net能用的dll

  最近PDFBox1.0.0发布了,修正了一些bug,这对于一直使用pdfbox的人来讲是个好消息,但是我们不能忘记pdfbox归根到底是java的类库,作为微软阵营的人最头疼的事情一直都是怎么把它转化成能在.net下面托管的dll文件,以前pdfbox0.7.3的时候还

Your Answer
(Ctrl+Enter To Post)   
    Copyright © 2015-2017 163JAVA.COM All Rights Reserved.