🐛 Fixed build on Ubuntu LTS
This commit is contained in:
		| @@ -1,19 +0,0 @@ | ||||
| generated-by = makedeb-makepkg | ||||
|  | ||||
| pkgbase = btop | ||||
| 	pkgdesc = A monitor of system resourecs, bpytop ported to C++ | ||||
| 	pkgver = 1.2.0 | ||||
| 	pkgrel = 1 | ||||
| 	url = https://github.com/aristocratos/btop | ||||
| 	arch = x86_64 | ||||
| 	arch = aarch64 | ||||
| 	license = Apache | ||||
| 	makedepends = build-essential | ||||
| 	makedepends = gcc-10 | ||||
| 	makedepends = g++-10 | ||||
| 	depends = coreutils | ||||
| 	depends = sed | ||||
| 	source = btop-1.2.0.tar.gz::https://github.com/aristocratos/btop/archive/v1.2.0.tar.gz | ||||
| 	sha256sums = 59a87b9d0bb0f5010d53f0ac72ddee9fd7b5a4039bce51b94b262313e946df02 | ||||
|  | ||||
| pkgname = btop | ||||
| @@ -1,15 +1,17 @@ | ||||
| cmake_minimum_required (VERSION 3.18) | ||||
| cmake_minimum_required(VERSION 3.16) | ||||
|  | ||||
| file(STRINGS "src/btop.cpp" BTOP_VERSION_LINE REGEX "Version[ \\t\\r\\n]*=[ \\t\\r\\n]*\"[^\"]+\"") | ||||
| string(REGEX REPLACE "^.*Version[ \\t\\r\\n]*=[ \\t\\r\\n]*\"([^\"]+)\".*$" "\\1" BTOP_VERSION "${BTOP_VERSION_LINE}") | ||||
|  | ||||
| message(STATUS "btop version: ${BTOP_VERSION}") | ||||
|  | ||||
| project("btop"  | ||||
| project( | ||||
|         "btop" | ||||
|         VERSION ${BTOP_VERSION} | ||||
|         DESCRIPTION "Resource monitor that shows usage and stats for processor, memory, disks, network and processes." | ||||
|         HOMEPAGE_URL "https://github.com/aristocratos/btop" | ||||
| 	LANGUAGES CXX) | ||||
|         LANGUAGES CXX | ||||
| ) | ||||
|  | ||||
| if (CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||||
|     set(PLATFORM_SRCS_GLOB "src/linux/*.cpp") | ||||
| @@ -33,7 +35,7 @@ find_package(Threads REQUIRED) | ||||
| target_link_libraries(btop PRIVATE Threads::Threads) | ||||
|  | ||||
| include(CheckCXXCompilerFlag) | ||||
| include(CheckLinkerFlag) | ||||
| include(CheckLinkerFlag.cmake) | ||||
|  | ||||
| function(target_compile_options_if_supported) | ||||
|     list(SUBLIST ARGV 2 -1 COMPILE_OPTIONS) | ||||
| @@ -57,11 +59,7 @@ function(target_link_options_if_supported) | ||||
|     endforeach () | ||||
| endfunction() | ||||
|  | ||||
| if(CMAKE_SYSTEM STREQUAL "x86_64") | ||||
| 	target_compile_options_if_supported(btop PRIVATE -fcf-protection -cfguard) | ||||
| endif() | ||||
|  | ||||
| target_compile_options_if_supported(btop PRIVATE -Wall -Wextra -pedantic) | ||||
| target_compile_options_if_supported(btop PRIVATE -Wall -Wextra -pedantic -fcf-protection -cfguard) | ||||
| target_link_options_if_supported(btop PRIVATE -fexceptions -fstack-protector -fstack-clash-protection) | ||||
|  | ||||
| if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") | ||||
| @@ -84,7 +82,7 @@ if(STATIC) | ||||
|     if (NOT STATIC_GETPWUID) | ||||
|         target_compile_definitions(btop PRIVATE STATIC_BUILD) | ||||
|     endif () | ||||
| 	target_link_options_if_supported(btop PRIVATE -static) | ||||
|     target_link_options_if_supported(btop PRIVATE -static -static-libgcc -static-libstdc++) | ||||
| endif () | ||||
|  | ||||
| set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nobody <nobody@nowhere.no>") | ||||
| @@ -92,12 +90,28 @@ set(CPACK_DEBIAN_PACKAGE_SECTION "utils") | ||||
|  | ||||
| include(CPack) | ||||
|  | ||||
| install(TARGETS btop RUNTIME | ||||
| 		PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||||
| install(FILES "README.md" | ||||
| install( | ||||
|         TARGETS btop RUNTIME | ||||
|         PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE | ||||
| ) | ||||
| install( | ||||
|         FILES "README.md" | ||||
|         DESTINATION "share/btop/" | ||||
| 		PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) | ||||
| install(DIRECTORY "themes" | ||||
|         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ | ||||
| ) | ||||
| install( | ||||
|         FILES "CHANGELOG.md" | ||||
|         DESTINATION "share/btop/" | ||||
|         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ | ||||
| ) | ||||
| install( | ||||
|         FILES "LICENSE" | ||||
|         DESTINATION "share/btop/" | ||||
|         PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ | ||||
| ) | ||||
| install( | ||||
|         DIRECTORY "themes" | ||||
|         DESTINATION "share/btop/" | ||||
|         DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE | ||||
| 		FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) | ||||
|         FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ | ||||
| ) | ||||
|   | ||||
							
								
								
									
										68
									
								
								btop/CheckLinkerFlag.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								btop/CheckLinkerFlag.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,68 @@ | ||||
|  | ||||
| # CheckLinkerFlag | ||||
| # ------------------ | ||||
| # | ||||
| # Checks whether a compiler supports a given linker flag. | ||||
| # | ||||
|  | ||||
| include(CheckCSourceCompiles) | ||||
| include(CheckCXXSourceCompiles) | ||||
| include(CheckFortranSourceCompiles) | ||||
|  | ||||
| include(CMakeCheckCompilerFlagCommonPatterns) | ||||
|  | ||||
| # FLAG: the linker flag to check | ||||
| # LANGUAGE: the language to test it on.  C, CXX, or Fortran | ||||
| # RESULT: return variable | ||||
|  | ||||
| macro(check_linker_flag LANGUAGE FLAG RESULT) | ||||
|     if (NOT DEFINED ${RESULT}) | ||||
|         set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") | ||||
|         set(CMAKE_REQUIRED_FLAGS "${FLAG}") | ||||
|         # Normalize locale during test compilation. | ||||
|         set(_CheckLinkerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) | ||||
|         foreach (v ${_CheckLinkerFlag_LOCALE_VARS}) | ||||
|             set(_CheckLinkerFlag_SAVED_${v} "$ENV{${v}}") | ||||
|             set(ENV{${v}} C) | ||||
|         endforeach () | ||||
|  | ||||
|         CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckLinkerFlag_COMMON_PATTERNS) | ||||
|  | ||||
|         if ("${LANGUAGE}" STREQUAL C) | ||||
|  | ||||
|             CHECK_C_SOURCE_COMPILES( | ||||
|                     "int main(void) { return 0; }" ${RESULT} | ||||
|                     # Some compilers do not fail with a bad flag | ||||
|                     FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU | ||||
|                     ${_CheckLinkerFlag_COMMON_PATTERNS} | ||||
|             ) | ||||
|         elseif ("${LANGUAGE}" STREQUAL CXX) | ||||
|             check_cxx_source_compiles( | ||||
|                     "int main(void) { return 0; }" ${RESULT} | ||||
|                     # Some compilers do not fail with a bad flag | ||||
|                     FAIL_REGEX "command line option .* is valid for .* but not for C" # GNU | ||||
|                     ${_CheckLinkerFlag_COMMON_PATTERNS} | ||||
|             ) | ||||
|         elseif ("${LANGUAGE}" STREQUAL Fortran) | ||||
|             check_fortran_source_compiles( | ||||
|                     "program test | ||||
| 			print *, \'Hello, world\' | ||||
| 			end program test" | ||||
|                     ${RESULT} | ||||
|                     # Some compilers do not fail with a bad flag | ||||
|                     FAIL_REGEX "command line option .* is valid for .* but not for Fortran" # GNU | ||||
|                     ${_CheckLinkerFlag_COMMON_PATTERNS}) | ||||
|         else () | ||||
|             message(FATAL_ERROR "Invalid LANGUAGE argument ${LANGUAGE}") | ||||
|         endif () | ||||
|  | ||||
|         foreach (v ${_CheckCCompilerFlag_LOCALE_VARS}) | ||||
|             set(ENV{${v}} ${_CheckCCompilerFlag_SAVED_${v}}) | ||||
|             unset(_CheckCCompilerFlag_SAVED_${v}) | ||||
|         endforeach () | ||||
|         unset(_CheckCCompilerFlag_LOCALE_VARS) | ||||
|         unset(_CheckCCompilerFlag_COMMON_PATTERNS) | ||||
|  | ||||
|         set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") | ||||
|     endif () | ||||
| endmacro(check_linker_flag) | ||||
| @@ -1,4 +1,5 @@ | ||||
| # Maintainer: Canony <canony@protonmail.ch> | ||||
| # Maintainer: Edgar <Edgar{at}AnotherFoxGuy.com> | ||||
| # Contributor: Canony <canony@protonmail.ch> | ||||
| # Contributor: Caleb Maclennan <caleb@alerque.com> | ||||
|  | ||||
| pkgname=btop | ||||
| @@ -11,13 +12,18 @@ license=(Apache) | ||||
| depends=(coreutils sed) | ||||
| makedepends=(cmake build-essential gcc-10 g++-10) | ||||
| _archive="$pkgname-$pkgver" | ||||
| source=("$_archive.tar.gz::$url/archive/v$pkgver.tar.gz" "CMakeLists.txt") | ||||
| sha256sums=('59a87b9d0bb0f5010d53f0ac72ddee9fd7b5a4039bce51b94b262313e946df02' 'SKIP') | ||||
| source=("$_archive.tar.gz::$url/archive/v$pkgver.tar.gz" "CMakeLists.txt" "CheckLinkerFlag.cmake") | ||||
| sha256sums=('59a87b9d0bb0f5010d53f0ac72ddee9fd7b5a4039bce51b94b262313e946df02' 'SKIP' 'SKIP') | ||||
|  | ||||
| build() { | ||||
| 	cd "$_archive" | ||||
|  | ||||
| 	cp -f "$srcdir/CMakeLists.txt" . | ||||
| 	cp -f "$srcdir/CheckLinkerFlag.cmake" . | ||||
|  | ||||
| 	cmake . \ | ||||
| 		-DCMAKE_C_COMPILER=gcc-10 \ | ||||
| 		-DCMAKE_CXX_COMPILER=g++-10 \ | ||||
| 		-DCMAKE_INSTALL_PREFIX=/usr \ | ||||
| 		-DCMAKE_BUILD_TYPE=Release \ | ||||
| 		-DSTATIC=ON | ||||
|   | ||||
		Reference in New Issue
	
	Block a user