Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | DESCRIPTION = "snort - a free lightweight network intrusion detection system for UNIX and Windows." |
| 2 | HOMEPAGE = "http://www.snort.org/" |
| 3 | SECTION = "net" |
| 4 | LICENSE = "GPL-2.0" |
| 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=78fa8ef966b48fbf9095e13cc92377c5" |
| 6 | |
| 7 | DEPENDS = "xz libpcap libpcre daq libdnet util-linux daq-native libtirpc bison-native" |
| 8 | |
| 9 | SRC_URI = "https://www.snort.org/downloads/archive/snort/${BP}.tar.gz \ |
| 10 | file://snort.init \ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 11 | file://volatiles.99_snort \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 12 | file://0001-libpcap-search-sysroot-for-headers.patch \ |
| 13 | file://fix-host-contamination-when-enable-static-daq.patch \ |
| 14 | file://disable-run-test-program-while-cross-compiling.patch \ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 15 | file://configure.in-disable-tirpc-checking-for-fedora.patch \ |
| 16 | file://0001-chdeck-for-gettid-API-during-configure.patch \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 17 | " |
| 18 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 19 | SRC_URI[md5sum] = "009254a9797ec93321c5936b99dcd6c8" |
| 20 | SRC_URI[sha256sum] = "2472989da3aace000d1ea5931ece68f8e5cc0c511e272d65182113a2481e822d" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 21 | |
| 22 | UPSTREAM_CHECK_URI = "https://www.snort.org/downloads" |
| 23 | UPSTREAM_CHECK_REGEX = "snort-(?P<pver>\d+(\.\d+)+)\.tar" |
| 24 | |
| 25 | inherit autotools gettext update-rc.d pkgconfig |
| 26 | |
| 27 | INITSCRIPT_NAME = "snort" |
| 28 | INITSCRIPT_PARAMS = "defaults" |
| 29 | |
| 30 | EXTRA_OECONF = " \ |
| 31 | --enable-gre \ |
| 32 | --enable-linux-smp-stats \ |
| 33 | --enable-reload \ |
| 34 | --enable-reload-error-restart \ |
| 35 | --enable-targetbased \ |
| 36 | --enable-static-daq \ |
| 37 | --with-dnet-includes=${STAGING_INCDIR} \ |
| 38 | --with-dnet-libraries=${STAGING_LIBDIR} \ |
| 39 | --with-libpcre-includes=${STAGING_INCDIR} \ |
| 40 | --with-libpcre-libraries=${STAGING_LIBDIR} \ |
| 41 | --with-daq-includes=${STAGING_INCDIR} \ |
| 42 | --with-daq-libraries=${STAGING_LIBDIR} \ |
| 43 | " |
| 44 | |
| 45 | # if you want to disable it, you need to patch configure.in first |
| 46 | # AC_CHECK_HEADERS([openssl/sha.h],, SHA_H="no") |
| 47 | # is called even with --without-openssl-includes |
| 48 | PACKAGECONFIG ?= "openssl lzma" |
| 49 | PACKAGECONFIG[openssl] = "--with-openssl-includes=${STAGING_INCDIR} --with-openssl-libraries=${STAGING_LIBDIR}, --without-openssl-includes --without-openssl-libraries, openssl," |
| 50 | PACKAGECONFIG[lzma] = "--with-lzma-includes=${STAGING_INCDIR} --with-lzma-libraries=${STAGING_LIBDIR}, --without-lzma-includes --without-lzma-libraries, xz," |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 51 | PACKAGECONFIG[appid] = "--enable-open-appid, --disable-open-appid, luajit, bash" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 52 | |
| 53 | CFLAGS += "-I${STAGING_INCDIR}/tirpc" |
| 54 | LDFLAGS += " -ltirpc" |
| 55 | |
| 56 | do_install_append() { |
| 57 | install -d ${D}${sysconfdir}/snort/rules |
| 58 | install -d ${D}${sysconfdir}/snort/preproc_rules |
| 59 | install -d ${D}${sysconfdir}/init.d |
| 60 | for i in map config conf dtd; do |
| 61 | cp ${S}/etc/*.$i ${D}${sysconfdir}/snort/ |
| 62 | done |
| 63 | |
| 64 | # fix the hardcoded path and lib name |
| 65 | # comment out the rules that are not provided |
| 66 | sed -i -e 's#/usr/local/lib#${libdir}#' \ |
| 67 | -e 's#\.\./\(.*rules\)#${sysconfdir}/snort/\1#' \ |
| 68 | -e 's#\(libsf_engine.so\)#\1.0#' \ |
| 69 | -e 's/^\(include $RULE_PATH\)/#\1/' \ |
| 70 | -e 's/^\(dynamicdetection\)/#\1/' \ |
| 71 | -e '/preprocessor reputation/,/blacklist/ s/^/#/' \ |
| 72 | ${D}${sysconfdir}/snort/snort.conf |
| 73 | |
| 74 | cp ${S}/preproc_rules/*.rules ${D}${sysconfdir}/snort/preproc_rules/ |
| 75 | install -m 755 ${WORKDIR}/snort.init ${D}${sysconfdir}/init.d/snort |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 76 | |
| 77 | install -d ${D}${sysconfdir}/default/volatiles |
| 78 | install -m 0644 ${WORKDIR}/volatiles.99_snort ${D}${sysconfdir}/default/volatiles/99_snort |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 79 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 80 | sed -i -e 's|-fdebug-prefix-map[^ ]*||g; s|-fmacro-prefix-map[^ ]*||g; s|${STAGING_DIR_TARGET}||g' ${D}${libdir}/pkgconfig/*.pc |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 81 | } |
| 82 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 83 | pkg_postinst_${PN}() { |
| 84 | if [ -z "$D" ] && [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then |
| 85 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 86 | fi |
| 87 | } |
| 88 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 89 | FILES_${PN} += " \ |
| 90 | ${libdir}/snort_dynamicengine/*.so.* \ |
| 91 | ${libdir}/snort_dynamicpreprocessor/*.so.* \ |
| 92 | ${libdir}/snort_dynamicrules/*.so.* \ |
| 93 | " |
| 94 | FILES_${PN}-dbg += " \ |
| 95 | ${libdir}/snort_dynamicengine/.debug \ |
| 96 | ${libdir}/snort_dynamicpreprocessor/.debug \ |
| 97 | ${libdir}/snort_dynamicrules/.debug \ |
| 98 | " |
| 99 | FILES_${PN}-staticdev += " \ |
| 100 | ${libdir}/snort_dynamicengine/*.a \ |
| 101 | ${libdir}/snort_dynamicpreprocessor/*.a \ |
| 102 | ${libdir}/snort_dynamicrules/*.a \ |
| 103 | ${libdir}/snort/dynamic_preproc/*.a \ |
| 104 | ${libdir}/snort/dynamic_output/*.a \ |
| 105 | " |
| 106 | FILES_${PN}-dev += " \ |
| 107 | ${libdir}/snort_dynamicengine/*.la \ |
| 108 | ${libdir}/snort_dynamicpreprocessor/*.la \ |
| 109 | ${libdir}/snort_dynamicrules/*.la \ |
| 110 | ${libdir}/snort_dynamicengine/*.so \ |
| 111 | ${libdir}/snort_dynamicpreprocessor/*.so \ |
| 112 | ${libdir}/snort_dynamicrules/*.so \ |
| 113 | ${prefix}/src/snort_dynamicsrc \ |
| 114 | " |