mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Use cmake to build packages
This commit is contained in:
parent
65ce2eafed
commit
80c5600a7b
11
.github/workflows/pull_request.yml
vendored
11
.github/workflows/pull_request.yml
vendored
@ -13,18 +13,16 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev librpm-dev libzstd-dev
|
||||
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev rpm librpm-dev libzstd-dev
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
|
||||
- name: configure project
|
||||
# We reuse the build binary only for the releases.
|
||||
# We set tweak version to off, because it is wrong, as git tag will happen after this step. Releases don't have a tweak, so this is ok.
|
||||
run: cmake .
|
||||
run: cmake -DBUILD_TESTS=On .
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . -j$(nproc)
|
||||
run: cmake --build . -j$(nproc) --target package
|
||||
|
||||
- name: run fastfetch
|
||||
run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true
|
||||
@ -35,8 +33,5 @@ jobs:
|
||||
- name: run tests
|
||||
run: ctest
|
||||
|
||||
- name: build deb package
|
||||
run: sh packaging/deb/create.sh .
|
||||
|
||||
- name: perform CodeQL analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
11
.github/workflows/push.yml
vendored
11
.github/workflows/push.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev librpm-dev libzstd-dev
|
||||
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libxfconf-0-dev rpm librpm-dev libzstd-dev
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
@ -24,10 +24,10 @@ jobs:
|
||||
- name: configure project
|
||||
# We reuse the build binary only for the releases.
|
||||
# We set tweak version to off, because it is wrong, as git tag will happen after this step. Releases don't have a tweak, so this is ok.
|
||||
run: cmake -DSET_TWEAK=Off .
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . -j$(nproc)
|
||||
run: cmake --build . -j$(nproc) --target package
|
||||
|
||||
- name: run fastfetch
|
||||
run: ./fastfetch --recache --disable-linewrap false --hide-cursor false --show-errors true
|
||||
@ -38,9 +38,6 @@ jobs:
|
||||
- name: run tests
|
||||
run: ctest
|
||||
|
||||
- name: build deb package
|
||||
run: sh packaging/deb/create.sh .
|
||||
|
||||
- name: perform CodeQL analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
||||
@ -60,4 +57,4 @@ jobs:
|
||||
with:
|
||||
tag: ${{ steps.get_version_fastfetch.outputs.release }}
|
||||
commit: ${{ github.sha }}
|
||||
artifacts: ./fastfetch,./packaging/deb/fastfetch.deb
|
||||
artifacts: ./fastfetch,./fastfetch-*.*
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "packaging/aur"]
|
||||
path = packaging/aur
|
||||
url = https://aur.archlinux.org/fastfetch-git.git
|
@ -5,22 +5,11 @@ project(fastfetch
|
||||
LANGUAGES C
|
||||
)
|
||||
|
||||
# This is used by github actions for release builds
|
||||
# This is set to off by github actions for release builds
|
||||
OPTION(SET_TWEAK "Add tweak to project version" ON)
|
||||
|
||||
# Track commits between version bumps for output in --version
|
||||
# Ignored by --version-raw and github actions
|
||||
if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND git describe --tags
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK}")
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
# Also create test executables
|
||||
OPTION(BUILD_TESTS "Build tests" OFF)
|
||||
|
||||
OPTION(ENABLE_LIBPCI "Enable libpci" ON)
|
||||
OPTION(ENABLE_VULKAN "Enable vulkan" ON)
|
||||
@ -34,7 +23,17 @@ OPTION(ENABLE_DCONF "Enable dconf" ON)
|
||||
OPTION(ENABLE_DBUS "Enable dbus-1" ON)
|
||||
OPTION(ENABLE_XFCONF "Enable libxfconf-0" ON)
|
||||
OPTION(ENABLE_RPM "Enable rpm" ON)
|
||||
OPTION(BUILD_TESTS "Build tests" ON)
|
||||
|
||||
# Track commits between version bumps for output in --version
|
||||
if (SET_TWEAK AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND git describe --tags
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE PROJECT_VERSION_TWEAK
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(REGEX MATCH "-[0-9]+" PROJECT_VERSION_TWEAK "${PROJECT_VERSION_TWEAK}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
@ -66,7 +65,7 @@ find_package(Threads REQUIRED)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Init CMake targets.
|
||||
# Init CMake targets
|
||||
|
||||
add_library(libfastfetch STATIC
|
||||
src/util/FFstrbuf.c
|
||||
@ -278,7 +277,7 @@ target_link_libraries(flashfetch
|
||||
PRIVATE libfastfetch
|
||||
)
|
||||
|
||||
# Testing.
|
||||
# Testing
|
||||
|
||||
if (BUILD_TESTS)
|
||||
add_executable(fastfetch-test-performance
|
||||
@ -299,7 +298,9 @@ if (BUILD_TESTS)
|
||||
add_test(NAME test-strbuf COMMAND fastfetch-test-strbuf)
|
||||
endif()
|
||||
|
||||
# Installation.
|
||||
# Installation
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(
|
||||
TARGETS fastfetch
|
||||
@ -321,3 +322,33 @@ install(
|
||||
FILES ./LICENSE
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}
|
||||
)
|
||||
|
||||
# Packaging
|
||||
|
||||
set(CPACK_GENERATOR "DEB;RPM;TZST")
|
||||
|
||||
set(CPACK_PACKAGE_CONTACT "Linus Dierheimer <Linus@Dierheimer.de>")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Neofetch clone written in C")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "
|
||||
fastfetch is a neofetch-like tool for fetching system information and displaying them in a pretty way.
|
||||
It is written in c to achieve much better performance.
|
||||
")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/LinusDierheimer")
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION, "utils")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "
|
||||
libpci3
|
||||
libvulkan1
|
||||
libwayland-client0
|
||||
libxcb-randr0
|
||||
xcb
|
||||
libxrandr2
|
||||
libx11-6
|
||||
libdconf1
|
||||
libglib2.0-0
|
||||
libdbus-1-3
|
||||
libxfconf-0-3
|
||||
")
|
||||
|
||||
include(CPack)
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 7ac9c5d13295cd6143c0e845c8bf33771a64b6f4
|
@ -1,13 +0,0 @@
|
||||
Package: fastfetch
|
||||
Version: <VERSION>
|
||||
Section: utils
|
||||
Priority: extra
|
||||
Architecture: amd64
|
||||
Maintainer: Linus@Dierheimer.de
|
||||
Homepage: https://github.com/LinusDierheimer/fastfetch
|
||||
Installed-Size: 410K
|
||||
Description: A fast alternative to neofetch
|
||||
fastfetch is a neofetch-like tool for fetching system information and
|
||||
displaying them in a pretty way. It is written in c to achieve much better
|
||||
performance, in return only Linux and Android are supported. It also uses
|
||||
mechanisms like multithreading and caching to finish as fast as possible.
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is intended to be run from the root of the repository.
|
||||
# If you don't want to use build/ as build directoy, or already build the elsewere, you can give the build directoy as argument.
|
||||
|
||||
BUILD_DIR="${1:-build}"
|
||||
ROOT_DIR="${2:-.}"
|
||||
PACKAGE_DIR="${BUILD_DIR}/packaging/deb/fastfetch"
|
||||
|
||||
# Create missing files
|
||||
mkdir -p "${BUILD_DIR}" || exit 1
|
||||
|
||||
if [ ! -f "${BUILD_DIR}/cmake_install.cmake" ]; then
|
||||
cmake -S "${ROOT_DIR}" -B "${BUILD_DIR}" || exit 2
|
||||
rm -f "${BUILD_DIR}/fastfetch" || exit 3 # Always rebuild the project if we reconfigured it
|
||||
fi
|
||||
|
||||
if [ ! -f "${BUILD_DIR}/fastfetch" ]; then
|
||||
cmake --build "${BUILD_DIR}" || exit 4
|
||||
fi
|
||||
|
||||
# Populate the files
|
||||
cmake --install "${BUILD_DIR}" --prefix "${PACKAGE_DIR}/usr" || exit 5
|
||||
mkdir -p "${PACKAGE_DIR}/DEBIAN" || exit 6
|
||||
sed "s/<VERSION>/$("${BUILD_DIR}/fastfetch" --version-raw)/g" "${ROOT_DIR}/packaging/deb/control-template" > "${PACKAGE_DIR}/DEBIAN/control" || exit 7
|
||||
|
||||
# Create the package
|
||||
dpkg-deb --build "${PACKAGE_DIR}" || exit 8
|
Loading…
x
Reference in New Issue
Block a user