Skip to content

Commit

Permalink
sysutils/incron: Fix build with llvm15
Browse files Browse the repository at this point in the history
- Remove legacy codes related to gcc42
- Pet portclippy
- Utilize USES=localbase

Approved by:	portmgr (blanket)
  • Loading branch information
5u623l20 committed Jun 10, 2023
1 parent 25302f4 commit ca6b3bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sysutils/incron/Makefile
Expand Up @@ -15,27 +15,29 @@ LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-X11

LIB_DEPENDS= libinotify.so:devel/libinotify

USES= compiler
USES= compiler localbase:ldflags
USE_GITHUB= yes
GH_ACCOUNT= ar-
GH_TAGNAME= 81421d3a8bde0989d7e167d8a814d5232896c930
CPPFLAGS+= -I${LOCALBASE}/include -D__NR_inotify_init
LDFLAGS+= -L${LOCALBASE}/lib -linotify
USE_RC_SUBR= ${PORTNAME}

MAKE_ARGS= PREFIX="${PREFIX}" USER=${UID} \
DOCDIR="${PREFIX}/etc" \
MANPATH=${MANPREFIX}/man
USE_RC_SUBR= ${PORTNAME}

CPPFLAGS+= -D__NR_inotify_init
LDFLAGS+= -linotify

.include <bsd.port.pre.mk>

.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400079 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
EXTRA_PATCHES= ${FILESDIR}/extra-patch-FreeBSD_14
.endif

post-patch:
${REINPLACE_CMD} -e 's,/etc/incron,${PREFIX}/etc/incron,' \
${WRKSRC}/*conf* ${WRKSRC}/Makefile ${WRKSRC}/*.[158h] \
${WRKSRC}/*.cpp
${REINPLACE_CMD} -e '/INITDIR/d' ${WRKSRC}/Makefile
.if ${CHOSEN_COMPILER_TYPE} == gcc && ${COMPILER_VERSION} <= 42
${REINPLACE_CMD} -e '/pragma/d' ${WRKSRC}/inotify-cxx.cpp \
${WRKSRC}/usertable.cpp
.endif

.include <bsd.port.post.mk>
20 changes: 20 additions & 0 deletions sysutils/incron/files/extra-patch-FreeBSD_14
@@ -0,0 +1,20 @@
--- usertable.cpp.orig 2023-06-10 14:06:49 UTC
+++ usertable.cpp
@@ -571,17 +571,6 @@ bool UserTable::MayAccess(const std::string& rPath, bo
return false; // no access right found
}

-#ifndef __linux__
-static int
-clearenv(void)
-{
- extern char **environ;
-
- environ[0] = NULL;
- return 0;
-}
-#endif
-
void UserTable::RunAsUser(std::string cmd) const
{
struct passwd* pwd = getpwnam(m_user.c_str());

0 comments on commit ca6b3bd

Please sign in to comment.