| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2006-2015 OpenWrt.org |
| 3 | # |
| 4 | # This is free software, licensed under the GNU General Public License v2. |
| 5 | # See /LICENSE for more information. |
| 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=pcre |
| 11 | PKG_VERSION:=8.45 |
| 12 | PKG_RELEASE:=$(AUTORELEASE) |
| 13 | |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 |
| 15 | PKG_SOURCE_URL:=@SF/$(PKG_NAME) |
| 16 | PKG_HASH:=4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8 |
| 17 | |
| 18 | PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de> |
| 19 | PKG_LICENSE:=BSD-3-Clause |
| 20 | PKG_LICENSE_FILES:=LICENCE |
| 21 | PKG_CPE_ID:=cpe:/a:pcre:pcre |
| 22 | |
| 23 | PKG_INSTALL:=1 |
| 24 | PKG_BUILD_PARALLEL:=1 |
| 25 | |
| 26 | PKG_CONFIG_DEPENDS:=\ |
| 27 | CONFIG_PACKAGE_libpcrecpp \ |
| 28 | CONFIG_PCRE_JIT_ENABLED |
| 29 | |
| 30 | include $(INCLUDE_DIR)/package.mk |
| 31 | include $(INCLUDE_DIR)/host-build.mk |
| 32 | |
| 33 | define Package/libpcre/default |
| 34 | SECTION:=libs |
| 35 | CATEGORY:=Libraries |
| 36 | URL:=https://www.pcre.org/ |
| 37 | endef |
| 38 | |
| 39 | define Package/libpcre/config |
| 40 | source "$(SOURCE)/Config.in" |
| 41 | endef |
| 42 | |
| 43 | define Package/libpcre |
| 44 | $(call Package/libpcre/default) |
| 45 | TITLE:=A Perl Compatible Regular Expression library |
| 46 | endef |
| 47 | |
| 48 | define Package/libpcre16 |
| 49 | $(call Package/libpcre/default) |
| 50 | TITLE:=A Perl Compatible Regular Expression library (16bit support) |
| 51 | endef |
| 52 | |
| 53 | define Package/libpcre32 |
| 54 | $(call Package/libpcre/default) |
| 55 | TITLE:=A Perl Compatible Regular Expression library (32bit support) |
| 56 | endef |
| 57 | |
| 58 | define Package/libpcrecpp |
| 59 | $(call Package/libpcre/default) |
| 60 | TITLE:=C++ wrapper for Perl Compatible Regular Expression library |
| 61 | DEPENDS:=+libpcre +libstdcpp |
| 62 | endef |
| 63 | |
| 64 | HOST_CONFIGURE_ARGS += \ |
| 65 | --disable-shared \ |
| 66 | --enable-utf8 \ |
| 67 | --enable-unicode-properties \ |
| 68 | --enable-pcre16 \ |
| 69 | --with-match-limit-recursion=16000 \ |
| 70 | --enable-cpp \ |
| 71 | --with-pic |
| 72 | |
| 73 | CONFIGURE_ARGS += \ |
| 74 | --enable-utf8 \ |
| 75 | --enable-unicode-properties \ |
| 76 | --enable-pcre16 \ |
| 77 | --enable-pcre32 \ |
| 78 | $(if $(CONFIG_PCRE_JIT_ENABLED),--enable-jit,--disable-jit) \ |
| 79 | --with-match-limit-recursion=16000 \ |
| 80 | --$(if $(CONFIG_PACKAGE_libpcrecpp),en,dis)able-cpp \ |
| 81 | --with-pic |
| 82 | |
| 83 | MAKE_FLAGS += \ |
| 84 | CFLAGS="$(TARGET_CFLAGS)" |
| 85 | |
| 86 | define Build/InstallDev |
| 87 | $(INSTALL_DIR) $(1)/usr/bin |
| 88 | $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pcre-config $(1)/usr/bin/ |
| 89 | $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' $(1)/usr/bin/pcre-config |
| 90 | |
| 91 | $(INSTALL_DIR) $(2)/bin |
| 92 | $(LN) $(STAGING_DIR)/usr/bin/pcre-config $(2)/bin |
| 93 | |
| 94 | $(INSTALL_DIR) $(1)/usr/include |
| 95 | $(CP) $(PKG_INSTALL_DIR)/usr/include/pcre*.h $(1)/usr/include/ |
| 96 | |
| 97 | $(INSTALL_DIR) $(1)/usr/lib |
| 98 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre*.{a,so*} $(1)/usr/lib/ |
| 99 | |
| 100 | $(INSTALL_DIR) $(1)/usr/lib/pkgconfig |
| 101 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpcre*.pc $(1)/usr/lib/pkgconfig/ |
| 102 | endef |
| 103 | |
| 104 | define Package/libpcre/install |
| 105 | $(INSTALL_DIR) $(1)/usr/lib |
| 106 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre{,posix}.so.* $(1)/usr/lib/ |
| 107 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre.so $(1)/usr/lib/ |
| 108 | endef |
| 109 | |
| 110 | define Package/libpcre16/install |
| 111 | $(INSTALL_DIR) $(1)/usr/lib |
| 112 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre16.so* $(1)/usr/lib/ |
| 113 | endef |
| 114 | |
| 115 | define Package/libpcre32/install |
| 116 | $(INSTALL_DIR) $(1)/usr/lib |
| 117 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre32.so* $(1)/usr/lib/ |
| 118 | endef |
| 119 | |
| 120 | define Package/libpcrecpp/install |
| 121 | $(INSTALL_DIR) $(1)/usr/lib |
| 122 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcrecpp.so.* $(1)/usr/lib/ |
| 123 | endef |
| 124 | |
| 125 | $(eval $(call BuildPackage,libpcre)) |
| 126 | $(eval $(call BuildPackage,libpcre16)) |
| 127 | $(eval $(call BuildPackage,libpcre32)) |
| 128 | $(eval $(call BuildPackage,libpcrecpp)) |
| 129 | $(eval $(call HostBuild)) |