1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-14 18:03:44 +01:00
strawberry-audio-player-win.../cmake/Rpm.cmake

64 lines
2.2 KiB
CMake
Raw Normal View History

2018-09-18 19:01:59 +02:00
find_program(LSB_RELEASE_EXEC lsb_release)
2018-10-22 23:23:25 +02:00
find_program(RPMBUILD_EXEC rpmbuild)
2018-07-12 00:07:29 +02:00
2018-10-22 23:23:25 +02:00
if (LSB_RELEASE_EXEC AND RPMBUILD_EXEC)
execute_process(COMMAND env LC_ALL="en_US.utf8" date "+%a %b %d %Y" OUTPUT_VARIABLE RPM_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
2018-09-18 17:28:49 +02:00
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -is | tr '[:upper:]' '[:lower:]' | cut -d' ' -f1"
2018-09-18 00:45:33 +02:00
OUTPUT_VARIABLE DIST_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -ds | tr '[:upper:]' '[:lower:]' | sed 's/\"//g' | cut -d' ' -f2"
OUTPUT_VARIABLE DIST_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -ds | tr '[:upper:]' '[:lower:]' | sed 's/\"//g' | sed 's/\\.//g' | cut -d' ' -f3"
OUTPUT_VARIABLE DIST_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (DIST_NAME)
2020-12-09 18:09:49 +01:00
2018-09-18 00:45:33 +02:00
message(STATUS "Distro Name: ${DIST_NAME}")
if (DIST_RELEASE)
message(STATUS "Distro Release: ${DIST_RELEASE}")
endif()
if (DIST_VERSION)
message(STATUS "Distro Version: ${DIST_VERSION}")
endif()
2020-12-09 18:09:49 +01:00
2018-09-18 00:45:33 +02:00
set(RPMBUILD_DIR ~/rpmbuild CACHE STRING "Rpmbuild directory, for the rpm target")
2020-12-09 18:09:49 +01:00
if (${DIST_NAME} STREQUAL "opensuse" AND DIST_RELEASE)
if (${DIST_RELEASE} STREQUAL "leap")
if (DIST_VERSION)
set(RPM_DISTRO "lp${DIST_VERSION}")
else()
set(RPM_DISTRO ${DIST_RELEASE})
2018-09-18 00:45:33 +02:00
endif()
2020-12-09 18:09:49 +01:00
elseif (${DIST_RELEASE} STREQUAL "tumbleweed")
set(RPM_DISTRO ${DIST_RELEASE})
2019-08-02 20:25:46 +02:00
endif()
2020-12-09 18:09:49 +01:00
elseif (${DIST_NAME} STREQUAL "fedora" AND DIST_VERSION)
set(RPM_DISTRO "fc${DIST_VERSION}")
elseif (${DIST_NAME} STREQUAL "centos" AND DIST_VERSION)
set(RPM_DISTRO "el${DIST_VERSION}")
elseif (${DIST_NAME} STREQUAL "mageia" AND DIST_RELEASE)
set(RPM_DISTRO "mga${DIST_RELEASE}")
2018-09-18 00:45:33 +02:00
endif()
2020-12-09 18:09:49 +01:00
if(NOT RPM_DISTRO)
set(RPM_DISTRO ${DIST_NAME})
endif()
2018-09-18 00:45:33 +02:00
message(STATUS "RPM Suffix: ${RPM_DISTRO}")
2020-12-09 00:27:37 +01:00
2019-08-02 20:25:46 +02:00
add_custom_target(rpm
COMMAND ${CMAKE_SOURCE_DIR}/dist/scripts/maketarball.sh
COMMAND ${CMAKE_COMMAND} -E copy strawberry-${STRAWBERRY_VERSION_PACKAGE}.tar.xz ${RPMBUILD_DIR}/SOURCES/
COMMAND ${RPMBUILD_EXEC} -ba ${CMAKE_SOURCE_DIR}/dist/unix/strawberry.spec
2019-08-02 20:25:46 +02:00
)
2020-12-09 18:09:49 +01:00
2018-07-12 00:07:29 +02:00
endif()
2020-12-09 18:09:49 +01:00
2018-07-12 00:07:29 +02:00
endif()