mirror of
https://github.com/3cky/mbusd.git
synced 2025-02-11 00:11:28 +01:00
Cmake gitlabci (#25)
* gitlabci: hardcoded the debian systemd path * cmake: no failure on forced SYSTEMD_SERVICES_INSTALL_DIR * gitlabci: added fedora target * gitlabci: added fedora package * gitlabci: added another fedora package * gitlabci: fedora changed rpmbuilder * fedora... * fedora package name try4 * rpmdevtools detection * gitlabci: changed rpm detection * gitlabci: rpmbuilder detection * rpmbuilder added references * gitlabci: changed the expiration timespan to 6months * removed always false comparison (dbglvl is unsigned)
This commit is contained in:
parent
cb03e4ac1c
commit
fb3d6d6489
@ -8,7 +8,7 @@ stages:
|
||||
artifacts:
|
||||
# create an archive with a name of the current stage and branch name
|
||||
name: "${CI_BUILD_STAGE}_${CI_BUILD_REF_NAME}"
|
||||
expire_in: 1 day
|
||||
expire_in: 6 months
|
||||
paths:
|
||||
- output.dir/mbusd
|
||||
- output.dir/mbusd.8
|
||||
@ -17,6 +17,18 @@ stages:
|
||||
- output.dir/mbusd*.deb
|
||||
- output.dir/mbusd*.rpm
|
||||
|
||||
build:fedora_x86:
|
||||
<<: *mbusd_job_template
|
||||
image: fedora:latest
|
||||
stage: build
|
||||
before_script:
|
||||
- yum -y install cmake pkgconfig gcc-c++ rpmdevtools
|
||||
script:
|
||||
- mkdir output.dir/
|
||||
- cd output.dir
|
||||
- cmake -D CMAKE_BUILD_TYPE=Debug -DSYSTEMD_SERVICES_INSTALL_DIR=/usr/lib/systemd/system ../
|
||||
- make package
|
||||
|
||||
build:deb_armhf:
|
||||
<<: *mbusd_job_template
|
||||
stage: build
|
||||
@ -26,7 +38,7 @@ build:deb_armhf:
|
||||
script:
|
||||
- mkdir output.dir/
|
||||
- cd output.dir
|
||||
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../cmake/arm_linux_gnueabihf.cmake ../
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEMD_SERVICES_INSTALL_DIR=/lib/systemd/system -DCMAKE_TOOLCHAIN_FILE=../cmake/arm_linux_gnueabihf.cmake ../
|
||||
- make package
|
||||
|
||||
build:deb_x86:
|
||||
@ -38,7 +50,7 @@ build:deb_x86:
|
||||
script:
|
||||
- mkdir output.dir/
|
||||
- cd output.dir
|
||||
- cmake -D CMAKE_BUILD_TYPE=Debug ../
|
||||
- cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEMD_SERVICES_INSTALL_DIR=/lib/systemd/system ../
|
||||
- make package
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ install(
|
||||
DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/${CMAKE_PROJECT_NAME}
|
||||
)
|
||||
|
||||
if(SYSTEMD_FOUND)
|
||||
if(SYSTEMD_SERVICES_INSTALL_DIR)
|
||||
message(STATUS "Systemd service file will be installed to ${SYSTEMD_SERVICES_INSTALL_DIR}")
|
||||
# aggregate mbusd@.service from its template
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/systemd-units/mbusd@.service.in mbusd@.service)
|
||||
@ -124,8 +124,10 @@ execute_process(
|
||||
## issue the package creation with $make package
|
||||
# which infrastructure do we want
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
pkg_check_modules(rpmBuilder "librpmbuild3")
|
||||
if(rpmBuilder_FOUND)
|
||||
find_program(rpmBuilder rpmbuild)
|
||||
if(rpmBuilder)
|
||||
# @see https://schneide.wordpress.com/2013/02/11/build-a-rpm-package-using-cmake/
|
||||
# @see http://www.g-loaded.eu/2006/04/05/how-to-build-rpm-packages-on-fedora/
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
endif()
|
||||
|
||||
|
@ -17,7 +17,7 @@ if (SYSTEMD_FOUND AND "${SYSTEMD_SERVICES_INSTALL_DIR}" STREQUAL "")
|
||||
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR
|
||||
"${SYSTEMD_SERVICES_INSTALL_DIR}")
|
||||
elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR)
|
||||
message (FATAL_ERROR "Variable SYSTEMD_SERVICES_INSTALL_DIR is\
|
||||
message (INFO "Variable SYSTEMD_SERVICES_INSTALL_DIR is\
|
||||
defined, but we can't find systemd using pkg-config")
|
||||
endif()
|
||||
|
||||
|
@ -218,7 +218,7 @@ main(int argc, char *argv[])
|
||||
case 'v':
|
||||
cfg.dbglvl = (char)strtol(optarg, NULL, 0);
|
||||
# ifdef DEBUG
|
||||
if (cfg.dbglvl < 0 || cfg.dbglvl > 9)
|
||||
if (cfg.dbglvl > 9)
|
||||
{ /* report about invalid log level */
|
||||
printf("%s: -v: invalid loglevel value"
|
||||
" (%d, must be 0-9)\n", exename, cfg.dbglvl);
|
||||
|
Loading…
Reference in New Issue
Block a user