mirror of
https://github.com/donl/rmilter.git
synced 2026-06-30 06:12:17 -06:00
Add make dist target.
This commit is contained in:
parent
f1b2ecf0b3
commit
bbd1ebdc2b
2 changed files with 37 additions and 4 deletions
|
|
@ -4,7 +4,7 @@ PROJECT(rmilter C)
|
|||
|
||||
SET(RMILTER_VERSION_MAJOR 1)
|
||||
SET(RMILTER_VERSION_MINOR 6)
|
||||
SET(RMILTER_VERSION_PATCH 3)
|
||||
SET(RMILTER_VERSION_PATCH 4)
|
||||
|
||||
SET(RMILTER_VERSION "${RMILTER_VERSION_MAJOR}.${RMILTER_VERSION_MINOR}.${RMILTER_VERSION_PATCH}")
|
||||
SET(RMILTER_MASTER_SITE_URL "https://rspamd.com")
|
||||
|
|
@ -158,16 +158,17 @@ MACRO(ProcessPackage PKG_NAME)
|
|||
ENDMACRO(ProcessPackage name)
|
||||
|
||||
############################# OS SECTION #############################################
|
||||
|
||||
SET(TAR "tar")
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DFREEBSD")
|
||||
SET(TAR "gtar")
|
||||
MESSAGE(STATUS "Configuring for FreeBSD")
|
||||
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_BSD_SOURCE -DDARWIN")
|
||||
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
|
||||
MESSAGE(STATUS "Configuring for Darwin")
|
||||
|
||||
MESSAGE(STATUS "Configuring for Darwin")
|
||||
SET(TAR "gnutar")
|
||||
ENDIF()
|
||||
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
|
@ -401,6 +402,11 @@ TARGET_LINK_LIBRARIES(rmilter ${RMILTER_REQUIRED_LIBRARIES})
|
|||
INSTALL(TARGETS rmilter RUNTIME DESTINATION ${SBINDIR})
|
||||
INSTALL(FILES "doc/rmilter.8" DESTINATION ${MANDIR}/man8)
|
||||
|
||||
ADD_CUSTOM_TARGET(dist ${CMAKE_SOURCE_DIR}/dist.sh
|
||||
"${CMAKE_BINARY_DIR}/rmilter-${RMILTER_VERSION}.tar.xz" "${TAR}"
|
||||
COMMENT "Create source distribution"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
|
||||
# systemd unit
|
||||
IF(WANT_SYSTEMD_UNITS MATCHES "ON")
|
||||
INSTALL(FILES "rmilter.service" DESTINATION ${SYSTEMDDIR})
|
||||
|
|
|
|||
27
dist.sh
Executable file
27
dist.sh
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
|
||||
TAR=${2:-"tar"}
|
||||
|
||||
if [ $# -lt 1 ] ; then
|
||||
echo "Usage: dist.sh <filename> [tar_command]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FNAME=$1
|
||||
PREFIX=`basename $FNAME | sed -e 's/\.tar.*$//'`
|
||||
|
||||
OUT=""
|
||||
while true ; do
|
||||
OUT="/tmp/files-`strings -7 /dev/urandom | head -1 | sed -e 's/[^[:alnum:]]//g'`"
|
||||
if [ ! -f "$OUT" ] ; then break ; fi
|
||||
done
|
||||
|
||||
git ls-files > $OUT
|
||||
SUBMODULES=`git submodule | cut -d ' ' -f 3`
|
||||
|
||||
for sub in $SUBMODULES ; do
|
||||
(cd $sub && git ls-files | sed -e "s|^|$sub/|" >> $OUT)
|
||||
done
|
||||
|
||||
${TAR} -c --exclude='.[^/]*' --exclude='*.xz' --exclude='*.gz' --no-recursion --transform "s|^|$PREFIX/|" -a -T $OUT -v -f $FNAME
|
||||
rm -f $OUT
|
||||
Loading…
Add table
Add a link
Reference in a new issue