Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [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 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 7 | DEPENDS = "xz libpcap libpcre daq libdnet util-linux daq-native" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | DEPENDS_append_libc-musl = " libtirpc" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 9 | |
| 10 | SRC_URI = " ${GENTOO_MIRROR}/${BP}.tar.gz;name=tarball \ |
| 11 | file://snort.init \ |
| 12 | file://disable-inaddr-none.patch \ |
| 13 | file://disable-dap-address-space-id.patch \ |
| 14 | file://disable-daq-flow-id.patch \ |
| 15 | file://disable-daq-verdict-retry.patch \ |
| 16 | file://0001-libpcap-search-sysroot-for-headers.patch \ |
| 17 | file://0001-fix-do_package-failed-since-snort-2.9.7.0.patch \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | file://fix-host-contamination-when-enable-static-daq.patch \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 19 | " |
| 20 | |
| 21 | SRC_URI[tarball.md5sum] = "fd271788c0f8876be87a858a9142f202" |
| 22 | SRC_URI[tarball.sha256sum] = "ad03f11b5301b16642199a86aa90388eaa53f5003f83b0c5595745a490047be1" |
| 23 | |
| 24 | inherit autotools gettext update-rc.d pkgconfig |
| 25 | |
| 26 | INITSCRIPT_NAME = "snort" |
| 27 | INITSCRIPT_PARAMS = "defaults" |
| 28 | |
| 29 | EXTRA_OECONF = " \ |
| 30 | --enable-gre \ |
| 31 | --enable-linux-smp-stats \ |
| 32 | --enable-reload \ |
| 33 | --enable-reload-error-restart \ |
| 34 | --enable-targetbased \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 35 | --enable-static-daq \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 36 | --with-dnet-includes=${STAGING_INCDIR} \ |
| 37 | --with-dnet-libraries=${STAGING_LIBDIR} \ |
| 38 | --with-libpcre-includes=${STAGING_INCDIR} \ |
| 39 | --with-libpcre-libraries=${STAGING_LIBDIR} \ |
| 40 | --with-daq-includes=${STAGING_INCDIR} \ |
| 41 | --with-daq-libraries=${STAGING_LIBDIR} \ |
| 42 | " |
| 43 | |
| 44 | # if you want to disable it, you need to patch configure.in first |
| 45 | # AC_CHECK_HEADERS([openssl/sha.h],, SHA_H="no") |
| 46 | # is called even with --without-openssl-includes |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 47 | PACKAGECONFIG ?= "openssl lzma" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 48 | PACKAGECONFIG[openssl] = "--with-openssl-includes=${STAGING_INCDIR} --with-openssl-libraries=${STAGING_LIBDIR}, --without-openssl-includes --without-openssl-libraries, openssl," |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 49 | PACKAGECONFIG[lzma] = "--with-lzma-includes=${STAGING_INCDIR} --with-lzma-libraries=${STAGING_LIBDIR}, --without-lzma-includes --without-lzma-libraries, xz," |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 50 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 51 | CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc" |
| 52 | LDFLAGS_append_libc-musl = " -ltirpc" |
| 53 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 54 | do_install_append() { |
| 55 | install -d ${D}${sysconfdir}/snort/rules |
| 56 | install -d ${D}${sysconfdir}/snort/preproc_rules |
| 57 | install -d ${D}${sysconfdir}/init.d |
| 58 | for i in map config conf dtd; do |
| 59 | cp ${S}/etc/*.$i ${D}${sysconfdir}/snort/ |
| 60 | done |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 61 | |
| 62 | # fix the hardcoded path and lib name |
| 63 | # comment out the rules that are not provided |
| 64 | sed -i -e 's#/usr/local/lib#${libdir}#' \ |
| 65 | -e 's#\.\./\(.*rules\)#${sysconfdir}/snort/\1#' \ |
| 66 | -e 's#\(libsf_engine.so\)#\1.0#' \ |
| 67 | -e 's/^\(include $RULE_PATH\)/#\1/' \ |
| 68 | -e 's/^\(dynamicdetection\)/#\1/' \ |
| 69 | -e '/preprocessor reputation/,/blacklist/ s/^/#/' \ |
| 70 | ${D}${sysconfdir}/snort/snort.conf |
| 71 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 72 | cp ${S}/preproc_rules/*.rules ${D}${sysconfdir}/snort/preproc_rules/ |
| 73 | install -m 755 ${WORKDIR}/snort.init ${D}${sysconfdir}/init.d/snort |
| 74 | mkdir -p ${D}${localstatedir}/log/snort |
| 75 | install -d ${D}/var/log/snort |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 76 | |
| 77 | sed -i 's/-fdebug-prefix-map[^ ]*//g; s#${STAGING_DIR_TARGET}##g' ${D}${libdir}/pkgconfig/*.pc |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | FILES_${PN} += " \ |
| 81 | ${libdir}/snort_dynamicengine/*.so.* \ |
| 82 | ${libdir}/snort_dynamicpreprocessor/*.so.* \ |
| 83 | ${libdir}/snort_dynamicrules/*.so.* \ |
| 84 | " |
| 85 | FILES_${PN}-dbg += " \ |
| 86 | ${libdir}/snort_dynamicengine/.debug \ |
| 87 | ${libdir}/snort_dynamicpreprocessor/.debug \ |
| 88 | ${libdir}/snort_dynamicrules/.debug \ |
| 89 | " |
| 90 | FILES_${PN}-staticdev += " \ |
| 91 | ${libdir}/snort_dynamicengine/*.a \ |
| 92 | ${libdir}/snort_dynamicpreprocessor/*.a \ |
| 93 | ${libdir}/snort_dynamicrules/*.a \ |
| 94 | ${libdir}/snort/dynamic_preproc/*.a \ |
| 95 | ${libdir}/snort/dynamic_output/*.a \ |
| 96 | " |
| 97 | FILES_${PN}-dev += " \ |
| 98 | ${libdir}/snort_dynamicengine/*.la \ |
| 99 | ${libdir}/snort_dynamicpreprocessor/*.la \ |
| 100 | ${libdir}/snort_dynamicrules/*.la \ |
| 101 | ${libdir}/snort_dynamicengine/*.so \ |
| 102 | ${libdir}/snort_dynamicpreprocessor/*.so \ |
| 103 | ${libdir}/snort_dynamicrules/*.so \ |
| 104 | ${prefix}/src/snort_dynamicsrc \ |
| 105 | " |