I'm working on a makefile for mod security to work with nginx.  I've build
the makefile based on other makefiles and the recommendations.

Having problems having nginx build make use of mod security I started
looking at the details of the mod security build.   I trying to check the
mod security build to make sure that it has the libs linked properly.

Checking the library linking with :
~/development/openwrt/staging_dir/toolchain-arm_arm1176jzf-s+vfp_gcc-4.6-linaro_uClibc-0.9.33.2_eabi/bin$
./arm-openwrt-linux-ld
/home/user/development/openwrt/build_dir/target-arm_arm1176jzf-s+vfp_uClibc-0.9.33.2_eabi/modsecurity-apache_2.7.7/ipkg-install/usr/lib/standalone.so
and I get a bunch of these warnings:
./arm-openwrt-linux-ld: warning: libpcre.so.0, needed by
/home/user/development/openwrt/build_dir/target-arm_arm1176jzf-s+vfp_uClibc-0.9.33.2_eabi/modsecurity-apache_2.7.7/ipkg-install/usr/lib/standalone.so,
not found (try using -rpath or -rpath-link)

Any advice much appreciated.


Here is the makefile

#
# Copyright (C) Derek W
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
#

include $(TOPDIR)/rules.mk

PKG_NAME:=modsecurity
PKG_VERSION:=2.7.7
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-apache_$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.modsecurity.org/tarball/2.7.7/
PKG_MD5SUM:=5383c59ecc6990c870386627f67e7216

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-apache_$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install

PKG_BUILD_PARALLEL:=0
PKG_BUILD_DEPENDS:=util-linux
PKG_INSTALL:=1

PKG_FIXUP = libtool

include $(INCLUDE_DIR)/package.mk

define Package/modsecurity
  SECTION:=net
  DEPENDS:=+apache +apr +libpcre +apr-util +libxml2 +pcre +libiconv-full
+libiconv +libcurl +expat $(ICONV_DEPENDS) $(INTL_DEPENDS) +lua \
  CATEGORY:=Network
  TITLE:=Modsecurity
  URL:=http://www.modsecurity.org/download/
  MENU:=1
endef

TARGET_CFLAGS += $(FPIC)
#TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-D_GNU_SOURCE
TARGET_CPPFLAGS += \
    -I$(STAGING_DIR)/usr/include/libxml2 \
    -I$(STAGING_DIR)/usr/include/apache \
    -I$(STAGING_DIR)/usr/include/apr-1 \
#    -I$(STAGING_DIR)/usr/lib/pkgconfig \
#    -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \

#TARGET_LDFLAGS += \
#    -L$(STAGING_DIR)/usr/lib \
#    -L$(ICONV_PREFIX)/lib \
#    -L$(INTL_PREFIX)/lib \
#    -Wl,-rpath=$(STAGING_DIR)/usr/lib \
#    -Wl,-rpath-link=$(STAGING_DIR)/usr/lib \

EXTRA_LDFLAGS += $(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib

TARGET_LDFLAGS += \
    -L$(STAGING_DIR)/usr/lib/ \
    -s -rpath-link=$(STAGING_DIR)/usr/lib/ \
    -Wl,-rpath=$(STAGING_DIR)/usr/lib/ \
    -L$(ICONV_PREFIX)/lib \
    -L$(INTL_PREFIX)/lib \
    -L$(BUILD_DIR)/curl-7.33.0 -lcurl \
    -L$(BUILD_DIR)/libxml2-2.7.8 \
    -L$(STAGING_DIR)/usr/include/apache \
    -L$(STAGING_DIR)/usr/include/apr-1 \


MAKE_VARS +=\
    ICONV_PREFIX="$(ICONV_PREFIX)" \
    INTL_PREFIX="$(INTL_PREFIX)" \

#CONFIGURE_VARS += \
#    INCLUDES="$(BUILD_DIR)/httpd-2.2.26/include/" \

define Build/Configure
    $(PKG_BUILD_DIR)/autogen.sh
    $(call Build/Configure/Default,\
    --with-apxs=$(STAGING_DIR)/usr/sbin/apxs \
    --enable-standalone-module \
    --disable-apache2-module \
    --disable-mlogc \
    --enable-verbose-output \
    --enable-strict-compile \
    --libdir=$(STAGING_DIR)/usr/lib \
    --with-apr=$(STAGING_DIR)/usr/bin/apr-1-config \
    --with-apu=$(STAGING_DIR)/usr/bin/apu-1-config \
    --with-pcre=$(STAGING_DIR)/usr/bin/pcre-config \
    --with-libxml=$(STAGING_DIR)/usr/bin/xml2-config \
    --with-cc-opt="$(TARGET_CPPFLAGS)" \
    LDFLAGS="$(TARGET_LDFLAGS)" \
    )
endef
#       --with-gnu-ld \

#       CPPFLAGS="-I$(BUILD_DIR)/libxml2-2.7.8/include \
# -I$(BUILD_DIR)/apr-util-1.3.12/include -I$(BUILD_DIR)/apr-1.4.5/include \
# -I$(BUILD_DIR)/usr/include -I$(STAGING_DIR)/usr/lib \
# -I$(STAGING_DIR)/usr/include/apache" \

define Build/Compile
    $(call Build/Compile/Default)
endef

#define Build/Compile
#    $(MKDIR) -p $(PKG_INSTALL_DIR)
#    $(MAKE) -C $(PKG_BUILD_DIR) -Llib \
#    CC="$(TARGET_CC)" \
#    DESTDIR="$(PKG_INSTALL_DIR)" \
#    HOST_CPU="$(PKGARCH)" \
#    all install
#endef

define Package/modsecurity/InstallDev
    $(INSTALL_DIR) $(PGK_BUILD_DIR)/usr/lib
    $(CP) $(BUILD_DIR)/apr-util-1.3.12/include/apr_buckets.h
$(PGK_BUILD_DIR)/modsecurity-apache_2.7.7/nginx/modsecurity/
    $(INSTALL_DIR) $(1)/usr/lib
    $(INSTALL_DIR) $(1)/usr/include
    $(INSTALL_BIN) $(PGK_BUILD_DIR)standalone.so $(1)/usr/include
endef

define Package/modsecurity/install
    $(INSTALL_DIR) $(PGK_BUILD_DIR)/usr/lib
endef

$(eval $(call BuildPackage,modsecurity))
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to