diff --git a/.github/workflows/ci-linux.json b/.github/workflows/ci-linux.json
index 01cd778ad..12051a69d 100644
--- a/.github/workflows/ci-linux.json
+++ b/.github/workflows/ci-linux.json
@@ -64,13 +64,13 @@
"name": "archlinux-amd64",
"container": "deskflow/deskflow:archlinux-amd64",
"runs-on": "ubuntu-latest",
- "package-user": "build"
+ "arch-like": "true"
},
{
"name": "manjaro-amd64",
"container": "deskflow/deskflow:manjaro-amd64",
"runs-on": "ubuntu-latest",
- "package-user": "build"
+ "arch-like": "true"
}
]
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index db8de99ec..0f071d730 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -326,8 +326,22 @@ jobs:
- name: Configure
run: cmake -B build --preset=linux-release ${{ matrix.distro.extra-cmake-args }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- - name: Build
- run: cmake --build build -j8
+ - name: Build Package
+ if: ${{ matrix.distro.arch-like != 'true'}}
+ run: cmake --build build -j8 --target package
+
+ - name: Build Package (Arch-like)
+ if: ${{ matrix.distro.arch-like == 'true' }}
+ run: |
+ cmake --build build -j8
+ sudo chown -R build build
+ cd build
+ sudo -u build makepkg -s
+ export OSNAME=$(cat /etc/os-release | grep ^ID= | sed 's/ID=//g')
+ export ARCH=$(uname -m)
+ mv *.pkg.* $(ls *.pkg.* | sed "s/$ARCH/$OSNAME-$ARCH/g")
+ cd ..
+
- name: Tests
uses: ./.github/actions/run-tests
@@ -335,20 +349,11 @@ jobs:
with:
job: linux-${{ matrix.distro.name }}
- - name: Get version
- uses: ./.github/actions/get-version
-
- - name: Package
- env:
- LINUX_EXTRA_PACKAGES: ${{ matrix.distro.extra-packages }}
- LINUX_PACKAGE_USER: ${{ matrix.distro.package-user }}
- run: ./scripts/package.py --package-version ${{env.DESKFLOW_VERSION}}
-
- name: Upload
uses: actions/upload-artifact@v4
with:
name: package-${{ env.PACKAGE_PREFIX }}-${{ matrix.distro.name }}
- path: ${{ env.PACKAGE_PATH }}
+ path: ${{github.workspace}}/build/deskflow[-_]*.*
# Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived".
unix:
diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake
index c1ce19757..d6bfa3abf 100644
--- a/cmake/Packaging.cmake
+++ b/cmake/Packaging.cmake
@@ -1,18 +1,8 @@
-# Deskflow -- mouse and keyboard sharing utility
-# Copyright (C) 2012-2024 Symless Ltd.
-# Copyright (C) 2009-2012 Nick Bolton
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file LICENSE that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
+# SPDX-FileCopyrightText: (C) 2024 Chris Rizzitello
+# SPDX-FileCopyrightText: (C) 2012 - 2024 Symless Ltd.
+# SPDX-FileCopyrightText: (C) 2009 - 2012 Nick Bolton
+# SPDX-License-Identifier: MIT
+
#
# If enabled, configure packaging based on OS.
@@ -34,6 +24,7 @@ macro(configure_packaging)
if(NOT CPACK_PACKAGE_VERSION)
set(CPACK_PACKAGE_VERSION ${DESKFLOW_VERSION})
endif()
+
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
configure_windows_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@@ -42,8 +33,13 @@ macro(configure_packaging)
configure_linux_packaging()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "|.*BSD")
message(STATUS "BSD packaging not yet supported")
+ set(OS_STRING ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR})
endif()
+ # cmake-format: off
+ set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${OS_STRING}")
+ # cmake-format: on
+
include(CPack)
else()
message(STATUS "Not configuring installer")
@@ -71,6 +67,12 @@ macro(configure_windows_packaging)
configure_files(${PROJECT_SOURCE_DIR}/res/dist/wix
${PROJECT_BINARY_DIR}/installer)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(OS_STRING "win64")
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(OS_STRING "win32")
+ endif()
+
endmacro()
#
@@ -89,6 +91,7 @@ macro(configure_mac_packaging)
set(DESKFLOW_BUNDLE_BINARY_DIR ${DESKFLOW_BUNDLE_DIR}/Contents/MacOS)
configure_files(${DESKFLOW_BUNDLE_SOURCE_DIR} ${DESKFLOW_BUNDLE_DIR})
+ set(OS_STRING "macos")
file(RENAME ${DESKFLOW_BUNDLE_DIR}/Contents/Resources/App.icns
${DESKFLOW_BUNDLE_DIR}/Contents/Resources/${DESKFLOW_APP_NAME}.icns)
@@ -98,16 +101,95 @@ endmacro()
#
# Linux packages
#
+
+macro(configure_linux_package_name)
+ # Get Distro name information
+ execute_process(
+ COMMAND bash "-c" "cat /etc/os-release | grep ^ID= | sed 's/ID=//g'"
+ OUTPUT_VARIABLE _DISTRO_NAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\"" "" DISTRO_NAME "${_DISTRO_NAME}")
+ message(STATUS "DISTRO NAME: ${DISTRO_NAME}")
+
+ execute_process(
+ COMMAND bash "-c"
+ "cat /etc/os-release | grep ^ID_LIKE= | sed 's/ID_LIKE=//g'"
+ OUTPUT_VARIABLE _DISTRO_LIKE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\"" "" DISTRO_LIKE "${_DISTRO_LIKE}")
+ message(STATUS "DISTRO LIKE: ${DISTRO_LIKE}")
+
+ execute_process(
+ COMMAND
+ bash "-c"
+ "cat /etc/os-release | grep ^VERSION_CODENAME= | sed 's/VERSION_CODENAME=//g'"
+ OUTPUT_VARIABLE _DISTRO_CODENAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\"" "" DISTRO_CODENAME "${_DISTRO_CODENAME}")
+ message(STATUS "DISTRO CODENAME: ${DISTRO_CODENAME}")
+
+ execute_process(
+ COMMAND bash "-c"
+ "cat /etc/os-release | grep ^VERSION_ID= | sed 's/VERSION_ID=//g'"
+ OUTPUT_VARIABLE _DISTRO_VERSION_ID
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REPLACE "\"" "" DISTRO_VERSION_ID "${_DISTRO_VERSION_ID}")
+ message(STATUS "DISTRO ID: ${DISTRO_VERSION_ID}")
+
+ # Set Run Attempt portion of package name
+ # GITHUB_RUN_ATTEMPT is set by GITHUB when a job is run
+ # It is equal to the number of times the job was run on the same hash
+ set(PACKAGE_BUILD_ATTEMPT $ENV{GITHUB_RUN_ATTEMPT})
+ if("$ENV{GITHUB_RUN_ATTEMPT}" STREQUAL "")
+ set(PACKAGE_BUILD_ATTEMPT 1)
+ endif()
+
+ # Check if Debian-like
+ string(REGEX MATCH debian|buntu DEBTYPE "${DISTRO_LIKE}")
+ if((NOT ("${DEBTYPE}" STREQUAL "")) OR ("${DISTRO_NAME}" STREQUAL "debian"))
+ if("${CPACK_DEBIAN_PACKAGE_RELEASE}" STREQUAL "")
+ set(CPACK_DEBIAN_PACKAGE_RELEASE
+ "${PACKAGE_BUILD_ATTEMPT}~${DISTRO_CODENAME}")
+ endif()
+ set(CPACK_GENERATOR "DEB")
+ message(STATUS "DEB RELEASE INFO: ${CPACK_DEBIAN_PACKAGE_RELEASE}")
+ endif()
+
+ check_is_rpm()
+
+ if("${DISTRO_NAME}" STREQUAL "arch")
+ set(DISTRO_VERSION_ID "")
+ # Arch linux is rolling the version id reported is the date of last iso.
+ endif()
+
+ # Determain the code name to be used
+ if(NOT "${DISTRO_VERSION_ID}" STREQUAL "")
+ set(CN_STRING "${DISTRO_VERSION_ID}-")
+ endif()
+
+ if(NOT "${DISTRO_CODENAME}" STREQUAL "")
+ set(CN_STRING "${DISTRO_CODENAME}-")
+ endif()
+ set(OS_STRING "${DISTRO_NAME}-${CN_STRING}${CMAKE_SYSTEM_PROCESSOR}")
+
+ message(STATUS "OS INFO: ${OS_STRING}")
+
+endmacro()
+
macro(configure_linux_packaging)
message(VERBOSE "Configuring Linux packaging")
- set(CPACK_GENERATOR "DEB;RPM")
+ # Gather distro info
+ # This is used in package names
+ configure_linux_package_name()
+ set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${DESKFLOW_MAINTAINER})
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+ set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
@@ -179,3 +261,38 @@ macro(configure_files srcDir destDir)
endforeach(templateFile)
endmacro(configure_files)
+
+macro(check_is_rpm)
+ # Check if RPM-like.
+ string(REGEX MATCH suse|fedora|rhel RPMTYPE "${DISTRO_LIKE}")
+ string(REGEX MATCH fedora|suse|rhel RPMNAME "${DISTRO_NAME}")
+ if((NOT ("${RPMTYPE}" STREQUAL "")) OR (NOT ("${RPMNAME}" STREQUAL "")))
+
+ if("${DISTRO_NAME}" STREQUAL "opensuse-tumbleweed")
+ set(DISTRO_NAME "opensuse")
+ set(DISTRO_CODENAME "tumbleweed")
+ elseif(("${DISTRO_NAME}" STREQUAL "almalinux") OR ("${DISTRO_NAME}" STREQUAL "rocky"))
+ string(REGEX MATCH [0-9]+ V "${DISTRO_VERSION_ID}")
+ set(RPM_CN "${DISTRO_NAME}${V}")
+ endif()
+
+ # Determine if we hsould use
+ if ("${RPM_CN}" STREQUAL "")
+ if(NOT "${DISTRO_VERSION_ID}" STREQUAL "")
+ set(RPM_CN "${DISTRO_VERSION_ID}")
+ endif()
+ if(NOT "${DISTRO_CODENAME}" STREQUAL "")
+ set(RPM_CN "${DISTRO_CODENAME}")
+ endif()
+ endif()
+
+ if("${CPACK_RPM_PACKAGE_RELEASE}" STREQUAL "")
+ set(CPACK_RPM_PACKAGE_RELEASE "${PACKAGE_BUILD_ATTEMPT}~${RPM_CN}")
+ endif()
+
+ set(CPACK_GENERATOR "RPM")
+ message(STATUS "RPM RELEASE INFO: ${CPACK_RPM_PACKAGE_RELEASE}")
+
+ endif()
+endmacro()
+