Index: Mk/Uses/replace.mk =================================================================== --- /dev/null +++ Mk/Uses/replace.mk @@ -0,0 +1,66 @@ +# $FreeBSD$ +# +# Replace %%PREFIX and %%LOCALBASE%% in sources +# +# Feature: replace +# Usage: USES=replace +# +# REPLACE_LOCALBASE_REGEX a regular expression to match files to replace %%LOCALBASE%% +# REPLACE_LOCALBASE_FILES list of files or glob pattern relative to ${WRKSRC} +# REPLACE_LOCALBASE_GLOB list of glob pattern find(1) will match with +# +# REPLACE_PREFIX_REGEX a regular expression to match files to replace %%PREFIX%% +# REPLACE_PREFIX_FILES list of files or glob pattern relative to ${WRKSRC} +# REPLACE_PREFIX_GLOB list of glob pattern find(1) will match with +# +# To specify that ${WRKSRC}/path1/file and all .pl files in ${WRKSRC}/path2 +# should be processed: +# +# REPLACE_PREFIX_FILES= path1/file path2/*.pl +# +# MAINTAINER: portmgr@FreeBSD.org + +.if !defined(_INCLUDE_USES_REPLACE_MK) +_INCLUDE_USES_REPLACE_MK= yes + +_USES_patch+= 710:fix-localbase 711:fix-prefix + +fix-localbase: +.if defined(REPLACE_LOCALBASE_REGEX) + @cd ${WRKSRC}; \ + ${FIND} -E . -type f -iregex '${REPLACE_LOCALBASE_REGEX}' \ + -exec ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' {} + +.endif +.if defined(REPLACE_LOCALBASE_GLOB) +. for f in ${REPLACE_LOCALBASE_GLOB} + @cd ${WRKSRC}; \ + ${FIND} . -type f -name '${f}' \ + -exec ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' {} + +. endfor +.endif +.if defined(REPLACE_LOCALBASE_FILES) + @cd ${WRKSRC}; \ + ${FIND} ${REPLACE_LOCALBASE_FILES} -type f \ + -exec ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' {} + +.endif + +fix-prefix: +.if defined(REPLACE_PREFIX_REGEX) + @cd ${WRKSRC}; \ + ${FIND} -E . -type f -iregex '${REPLACE_PREFIX_REGEX}' \ + -exec ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' {} + +.endif +.if defined(REPLACE_PREFIX_GLOB) +. for f in ${REPLACE_PREFIX_GLOB} + @cd ${WRKSRC}; \ + ${FIND} . -type f -name '${f}' \ + -exec ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' {} + +. endfor +.endif +.if defined(REPLACE_PREFIX_FILES) + @cd ${WRKSRC}; \ + ${FIND} ${REPLACE_PREFIX_FILES} -type f \ + -exec ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' {} + +.endif + +.endif Index: graphics/acidwarp-sdl/Makefile =================================================================== --- graphics/acidwarp-sdl/Makefile +++ graphics/acidwarp-sdl/Makefile @@ -9,7 +9,7 @@ BUILD_DEPENDS= convert:graphics/ImageMagick7 -USES= cmake sdl +USES= cmake replace sdl USE_SDL= sdl2 USE_GITHUB= yes @@ -17,6 +17,8 @@ GH_PROJECT= acidwarp GH_TAGNAME= 698c4e1 +REPLACE_PREFIX_FILES= acidwarp.desktop + # Fix build on recent current (clang11) CFLAGS+= -fcommon @@ -26,9 +28,6 @@ share/applications/acidwarp.desktop \ share/pixmaps/acidwarp.png -post-patch: - ${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/acidwarp.desktop - do-install: ${STRIP_CMD} ${WRKSRC}/bin/acidwarp ${INSTALL_PROGRAM} ${WRKSRC}/bin/acidwarp ${STAGEDIR}${PREFIX}/bin