LuaJIT only supports a limited number of archs, restricting what snort
can be run on. (Notably LuaJIT 2.0 doesn't support aarch64). This diff,
prompted by a mail from Soner Tari, adds a no_luajit flavour disabling
use of LuaJIT, and uses it by default unless on one of the archs where
LuaJIT is supported.

It would also be possible to get rid of the flavour and just include or
disable appid depending on the arch, but with rspamd I found it helpful
to be able to build without luajit on amd64 for testing, so I took the
same approach.

@comment approach is similar to MODPY_COMMENT used in many Python ports
to include/exclude files based on a Makefile without the need to manage
separate PFRAG files.

ok?


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/snort/Makefile,v
retrieving revision 1.110
diff -u -p -r1.110 Makefile
--- Makefile    11 Jul 2021 02:11:34 -0000      1.110
+++ Makefile    14 Jul 2021 09:16:29 -0000
@@ -4,7 +4,7 @@ COMMENT =               highly flexible sniffer/NIDS
 
 DISTNAME =             snort-2.9.18
 RULESV =               29180
-SUBST_VARS =           RULESV
+SUBST_VARS =           RULESV APPID_COMMENT
 
 CATEGORIES =           net security
 
@@ -15,8 +15,17 @@ MAINTAINER =         Markus Lude <markus.lude@g
 # GPLv2
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += c c++abi crypto daq dnet luajit-5.1 lzma m nghttp2
-WANTLIB += pcap pcre pthread z
+WANTLIB += c crypto daq dnet lzma m nghttp2 pcap pcre pthread z
+
+FLAVORS =              no_luajit
+.if ${MACHINE_ARCH} == arm || \
+    ${MACHINE_ARCH} == amd64 || \
+    ${MACHINE_ARCH} == i386 || \
+    ${MACHINE_ARCH} == powerpc
+FLAVOR ?=
+.else
+FLAVOR =               no_luajit
+.endif
 
 MASTER_SITES =         https://www.snort.org/downloads/snort/
 
@@ -29,10 +38,18 @@ LIBTOOL_FLAGS =             --tag=disable-static
 
 LIB_DEPENDS =          archivers/xz \
                        devel/pcre \
-                       lang/luajit \
                        net/daq \
                        net/libdnet \
                        www/nghttp2
+
+.if ${FLAVOR:Mno_luajit}
+CONFIGURE_ARGS +=      --disable-open-appid
+APPID_COMMENT =                "@comment "
+.else
+LIB_DEPENDS +=         lang/luajit
+WANTLIB +=             c++abi luajit-5.1
+APPID_COMMENT =
+.endif
 
 CONFIGS        =               classification.config gen-msg.map 
reference.config \
                        snort.conf threshold.conf unicode.map
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/snort/pkg/PLIST,v
retrieving revision 1.34
diff -u -p -r1.34 PLIST
--- pkg/PLIST   16 Feb 2021 03:02:38 -0000      1.34
+++ pkg/PLIST   14 Jul 2021 09:16:29 -0000
@@ -3,19 +3,19 @@
 @newgroup _snort:557
 @newuser _snort:557:_snort:daemon:Snort Account:/nonexistent:/sbin/nologin
 @rcscript ${RCDIR}/snort
-bin/appid_detector_builder.sh
+${APPID_COMMENT}bin/appid_detector_builder.sh
 @bin bin/snort
 @bin bin/u2boat
-@bin bin/u2openappid
+${APPID_COMMENT}@bin bin/u2openappid
 @bin bin/u2spewfoo
-@bin bin/u2streamer
+${APPID_COMMENT}@bin bin/u2streamer
 lib/pkgconfig/snort.pc
 lib/snort_dynamicengine/
 @comment lib/snort_dynamicengine/libsf_engine.la
 @so lib/snort_dynamicengine/libsf_engine.so
 lib/snort_dynamicpreprocessor/
-lib/snort_dynamicpreprocessor/libsf_appid_preproc.la
-@so lib/snort_dynamicpreprocessor/libsf_appid_preproc.so
+${APPID_COMMENT}lib/snort_dynamicpreprocessor/libsf_appid_preproc.la
+${APPID_COMMENT}@so lib/snort_dynamicpreprocessor/libsf_appid_preproc.so
 @comment lib/snort_dynamicpreprocessor/libsf_dce2_preproc.la
 @so lib/snort_dynamicpreprocessor/libsf_dce2_preproc.so
 @comment lib/snort_dynamicpreprocessor/libsf_dnp3_preproc.la
@@ -46,7 +46,7 @@ lib/snort_dynamicpreprocessor/libsf_appi
 @so lib/snort_dynamicpreprocessor/libsf_ssh_preproc.so
 @comment lib/snort_dynamicpreprocessor/libsf_ssl_preproc.la
 @so lib/snort_dynamicpreprocessor/libsf_ssl_preproc.so
-lib/snort_dynamicrules/
+${APPID_COMMENT}lib/snort_dynamicrules/
 @man man/man8/snort.8
 share/doc/pkg-readmes/${PKGSTEM}
 share/doc/snort/

Reply via email to