1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-06 05:17:57 +00:00
conky/cmake/ConkyPlatformChecks.cmake

551 lines
17 KiB
CMake
Raw Normal View History

2010-01-01 23:49:41 +00:00
#
# Conky, a system monitor, based on torsmo
#
# Please see COPYING for details
#
2019-01-05 15:52:43 +00:00
# Copyright (c) 2005-2019 Brenden Matthews, et. al. (see AUTHORS) All rights
# reserved.
2010-01-01 23:49:41 +00:00
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
2010-01-01 23:49:41 +00:00
#
# This program 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
2010-01-01 23:49:41 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
include(FindPkgConfig)
2009-12-08 04:46:49 +00:00
include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckSymbolExists)
2009-12-08 04:46:49 +00:00
# Check for some headers
check_include_files(sys/statfs.h HAVE_SYS_STATFS_H)
check_include_files(sys/param.h HAVE_SYS_PARAM_H)
check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)
2009-12-08 05:16:11 +00:00
check_include_files(dirent.h HAVE_DIRENT_H)
2009-12-08 04:46:49 +00:00
# Check for some functions
check_function_exists(strndup HAVE_STRNDUP)
check_symbol_exists(pipe2 "unistd.h" HAVE_PIPE2)
check_symbol_exists(O_CLOEXEC "fcntl.h" HAVE_O_CLOEXEC)
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
check_symbol_exists(statfs64 "sys/mount.h" HAVE_STATFS64)
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
else(CMAKE_SYSTEM_NAME MATCHES "Darwin")
check_symbol_exists(statfs64 "sys/statfs.h" HAVE_STATFS64)
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
ac_search_libs(clock_gettime "time.h" CLOCK_GETTIME_LIB "rt")
if(NOT DEFINED CLOCK_GETTIME_LIB)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
message(FATAL_ERROR "clock_gettime not found.")
endif(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
else(NOT DEFINED CLOCK_GETTIME_LIB)
set(HAVE_CLOCK_GETTIME 1)
endif(NOT DEFINED CLOCK_GETTIME_LIB)
set(conky_libs ${conky_libs} ${CLOCK_GETTIME_LIB})
2009-12-06 19:43:12 +00:00
# standard path to search for includes
set(INCLUDE_SEARCH_PATH /usr/include /usr/local/include)
2009-12-07 17:35:43 +00:00
# Set system vars
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(OS_LINUX true)
2009-12-07 17:35:43 +00:00
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(OS_FREEBSD true)
set(conky_libs ${conky_libs} -lkvm -ldevstat -lintl -linotify)
if(BUILD_IRC)
set(conky_libs ${conky_libs} -lssl -lcrypto)
endif(BUILD_IRC)
2009-12-07 17:35:43 +00:00
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly")
set(OS_DRAGONFLY true)
set(conky_libs ${conky_libs} -ldevstat)
endif(CMAKE_SYSTEM_NAME MATCHES "DragonFly")
2009-12-07 17:35:43 +00:00
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(OS_OPENBSD true)
2009-12-07 17:35:43 +00:00
endif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
set(OS_SOLARIS true)
set(conky_libs ${conky_libs} -lkstat)
endif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
2009-12-07 17:35:43 +00:00
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
set(OS_NETBSD true)
2009-12-07 17:35:43 +00:00
endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
if(CMAKE_SYSTEM_NAME MATCHES "Haiku")
set(OS_HAIKU true)
set(conky_libs ${conky_libs} -lnetwork -lintl)
endif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(OS_DARWIN true)
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(NOT OS_LINUX
AND NOT OS_FREEBSD
AND NOT OS_OPENBSD
AND NOT OS_DRAGONFLY
AND NOT OS_SOLARIS
AND NOT OS_HAIKU
AND NOT OS_DARWIN)
message(
FATAL_ERROR
"Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported. Patches are welcome."
)
endif(NOT
OS_LINUX
AND
NOT
OS_FREEBSD
AND
NOT
OS_OPENBSD
AND
NOT
OS_DRAGONFLY
AND
NOT
OS_SOLARIS
AND
NOT
OS_HAIKU
AND
NOT
OS_DARWIN)
# Check for soundcard header
if(OS_LINUX)
check_include_files("linux/soundcard.h" HAVE_SOME_SOUNDCARD_H)
check_include_files("linux/soundcard.h" HAVE_LINUX_SOUNDCARD_H)
elseif(OS_OPENBSD)
check_include_files("soundcard.h" HAVE_SOME_SOUNDCARD_H)
else(OS_LINUX)
check_include_files("sys/soundcard.h" HAVE_SOME_SOUNDCARD_H)
endif(OS_LINUX)
if(BUILD_I18N AND OS_DRAGONFLY)
set(conky_libs ${conky_libs} -lintl)
endif(BUILD_I18N AND OS_DRAGONFLY)
2009-12-07 17:35:43 +00:00
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
if(BUILD_I18N AND OS_DARWIN)
find_path(LIBINTL_H_N libintl.h
PATHS /usr/local/opt/gettext/include
/usr/include
/usr/local/include
/usr/local/opt/include)
if(LIBINTL_H_N)
include_directories(${LIBINTL_H_N})
else(LIBINTL_H_N)
message(FATAL_ERROR "Unable to find libintl.h (try `brew install gettext`)")
endif(LIBINTL_H_N)
find_library(INTL_LIB
NAMES intl
PATHS /usr/local/opt/gettext/lib
/usr/lib
/usr/local/lib
/usr/local/opt/lib)
set(conky_libs ${conky_libs} ${INTL_LIB})
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
endif(BUILD_I18N AND OS_DARWIN)
if(BUILD_NCURSES AND OS_DARWIN)
set(conky_libs ${conky_libs} -lncurses)
Basic macOS support (#480) * Initial patches for Darwin support * cmake files ready for building on Sierra. Dont know about other OSX versions * Added darwin.h which will contain darwin specific headers * Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L). What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS * Stubs for get_entropy_avail and get_entropy_poolsize * More progress to getting to build * More patches * Now builds, remains fixing linking errors. Also implemented some functions * Now links * Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation * README changes * This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind * Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah * This update fixes swap-related miscalculations, though: On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data ) Thus conky code must be updated for Darwin to support multi-swapfile usage stats. For now, we default to showing stats for swapfile0 * Fixed a bit the comments so they make sense * Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree ) * I think the code is in good condition now * semaphore.hh: Implemented ~semaphore() and added throwing exception when sem initialisation fails just like in sem() for linux… darwin.cc: partially implemented update_cpu_usage() and update_total_processes() * Implements update_total_processes() ( Now it finds the correct number of tasks ) the changes in cmake file don’t change the functionality… It is only comments. In upcoming updates lua support may be enabled and the comments are related to lua support. * get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus ) --> The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot. update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... ) * patch * experimental support for get_top_info() and update_cpu_usage() :) * going to patch stuff * adds getting rss memory in get_top_info() * fixes * Couple things made more beautiful but too many things to fix ... * Remove unneeded code from darwin_soundcard.h and keep only needed to compile ( This way we are compatible to GPLv3, i think ) Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h Add more beautiful and explanatory comments to ease the work of other contributors… ( Mostly on things that don’t work! ) * Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release! NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation * Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff ) Needs some more work though to print accurate percentage! :) * Add conky installer (.pkg) project * Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software * Properly get thread count! - Patched core.cc to enable getting threads count on macOS! - Cleanup in darwin.cc * sort out some things in the code: - running_threads_count is not the same as thread_count on macOS! There is actually a difference! Correct a bit the code! * Enable the if_mounted command and start implementing the check_mount function in darwin.cc * Tighten things up * This patch makes conky build easily and without patching on any supported macOS version! The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files. If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext * Update README to provide more complete info on building on macOS * Fix * patch check_mounted + SIP status This commit: - patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this: conky -t '${if_mounted /Volumes/MacOS} ${endif}' Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work! - Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more... you can type conky -t '$sip_status' to see what it does... ( I will most likely update some things later regarding sip_status and check_mounted ) * Further implement sip_status sip_status now has different functionality! If you give no arguments it shows whether SIP is enabled or disabled ( generally ) If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for... You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more... Below you can see the list: ARG: RESULT: nothing --> print enabled / disabled 0 --> allow_apple_internal 1 --> allow_untrusted_kexts 2 --> allow_task_for_pid 3 --> allow_unrestricted_fs 4 --> allow_kernel_debugger 5 --> allow_unrestricted_dtrace 6 --> allow_unrestricted_nvram 7 --> allow_device_configuration 8 --> allow_any_recovery_os 9 --> allow_user_approved_kexts * sip_status progress & if_up enabled This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future. Also, enabled the $if_up command, but there are some problems with it... * sip_status patches - Updated code based on newest version of csrstat utility (v.1.8) The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag. - Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled. * Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before ) * More changes in cmake file to make code prettier and more exact * More cmake files cuteness * work for supporting versions prior Sierra This patch brings more compatibility with versions prior to Sierra. The project as is nearly links on a 10.9.5 OSX installation. - on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work. ( Currently we have minimal support, more studying needs to be done ) NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist! ( The OSX installer sees the OS as too old, so you need pacifist! ) * Oops * $if_mounted ready This patch removes the unneded print_mounted() function! Also cleanup code. * $if_up works I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code. Minor conky output changes in darwin.cc * fix compatibility with Mavericks and before... This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is. If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available. On higher versions than Mavericks it works as before... NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake * Added link for youtube video showing conky running on macOS * Improvements Minor improvements related to style Removed unneeded free() calls * Simplify Xcode configuration process! :) * Removed update_cpu_usage() implementation It was quite buggy so I removed it... * Cleanup the source code 1. Bogus TODO comments have been deleted! 2. Started using DEBUG_MODE based printf 3. Explain some things better/cleanup * Last small cleanup The TODO in get_from_load_info() was unneeded. Removed! Also, DEBUG_MODE is enabled for now... * update authors file * Improve README Make it more clean and easier to understand. * Update README.md small tweak * Work for conforming with "Development" rules 1. Add to variables.xml documentation about the $sip_status variable. 2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting 3. the friends in darwin.cc is ambiguous,,, some are more than friends. * First patch set that implements get_top_info() :) * Calculate cpu usage of all processes more efficiently. (Now results match Activity Monitor's results a lot!!!) More info about the get_top_info() implementation will come once I finish it! (soon) * Cleanup patch! o Move a couple things to better places o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... ) o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one inside it! * Correctly enable $running_processes variable In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function. * Removed unneeded flag This is not needed because we do not use update_top() for getting the number of running processes! * Update README.md * Update README.md This adds support for TravisCL. Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things. It seems like it can't but I suspect the problem existed before my patches. I will investigate. * First patch towards implementing #15 This patch a reworked get_top_info(). We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct. Also, we calculate the total cpu usage and total process usage concurrently using GCD. Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner. * First fix for the algorithm that calculates % CPU usage of a process The previous patch made the algorithm buggy. It required more reentrant-safe functions. Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function. This is not the last commit, more are coming in the future. * Previous commit wasn't pushed... * Problems committing * Make the code cleaner but break the algorithm again #15 The algorithm doesn't work... It is a work in progress! But this time we have merged the cpu_info and cpusample into one struct called cpusample ( I copied some variables from the linux implementation but they will probably be removed ) * Rework the code a bit / CPU usage % algorithm still doesn't work Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes() This makes the code nicer and removes the enum with the flags * cleanup remove unneeded functions, remove unneeded variables * bugfix * bugfix * remove the whole get_top_info() code! I will rework a lot this code so we can get rid of it. * Work for #15 Now we use the ultimate solution for calculating % usage of CPU of a process! Check the #15 Issue for information about this patch! * Quick memory leak fix & some patches for the get_top_info algorithm * quick patch for semaphore class * Update the comments * For consistency * temp * Revert "Merge branch 'master' into update_cpu_usage" This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4. * Revert "Revert "Merge branch 'master' into update_cpu_usage"" This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc. * Partially implement the overall % CPU usage * bug fix: I meant procs and threads! * make the code better part1 * cleanup * Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 ) For some reason the code that used host_statistics() function didn't produced bad values quite often. Replaced the function with host_processor_info() and changed the algorithm and now the values are correct! This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now. * Finish the optimised version of get_top_info() Fixes #15 * Quick fix for #16 Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation. Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head. * Strictness * Cleanup ConkyPlatformChecks.cmake Cleanup the quick patch code for Lua. * Add warning to README If you are using old version of cmake, update it. It will probably have problems when trying to locate lua. * More cleanup * Fix identation This simplifies the diff. Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process * Remove mixer related patches and files With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system. If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled. * Changes for using as submodule for ConkyX * Fixes * Implement get_freq This implements #11 Though it doesn't support getting the **current** cpu frequency. I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future * First work for correcting mem stats #6 Incorporate the update_pages_stolen() function and all of its dependencies. I will see if I can patch the code in order to avoid license problems * Work for #6 Now we follow the way apple's top works and not Activity Monitor. For this reason we find different values. But correct based on top. * cleanup for #6 * bug fix 1 * cleanup * hmm sorry * More cleanup - Move the libtop_tsamp_t object to darwin.cc. - Remove unneeded member variables. * A bit documentation * Implement secondary memory stats #6 Implement memwithbuffers, memeasyfree and memfree (which isn't secondary) * Quit update_meminfo if libtop_tsamp_update_vm_stats() failed * Update README.md Revert to original conky readme Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki * Alot junk slipped in too! * Merge net_stats branch For now, I have only tested up / down bytes count on en0, and it works. This is for #14 * Corrections - Fix License headers in darwin* files - Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX. - Cleanup top.h (I will request the changes in a pull request finally) * Fix identation and cleanup * identation-fixes part1 * Try to fix problem compiling on linux Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem; I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code. Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64 * attemp to completely fix linux problem!
2018-05-07 11:27:32 +00:00
endif(BUILD_NCURSES AND OS_DARWIN)
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
if(BUILD_WLAN AND OS_DARWIN)
find_library(CW CoreWLAN)
find_library(NS Foundation)
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
set(conky_libs ${conky_libs} ${CW})
set(conky_libs ${conky_libs} ${NS})
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
endif(BUILD_WLAN AND OS_DARWIN)
if(OS_DARWIN AND BUILD_IPGFREQ)
find_library(IPG IntelPowerGadget)
set(conky_libs ${conky_libs} ${IPG})
endif(OS_DARWIN AND BUILD_IPGFREQ)
2009-12-11 04:37:56 +00:00
if(BUILD_MATH)
set(conky_libs ${conky_libs} -lm)
2009-12-11 04:37:56 +00:00
endif(BUILD_MATH)
2010-04-27 14:42:21 +00:00
if(BUILD_ICAL)
check_include_files(libical/ical.h ICAL_H_)
if(NOT ICAL_H_)
message(FATAL_ERROR "Unable to find libical")
endif(NOT ICAL_H_)
set(conky_libs ${conky_libs} -lical)
2010-04-27 14:42:21 +00:00
endif(BUILD_ICAL)
2010-04-30 17:32:42 +00:00
if(BUILD_IRC)
find_path(IRC_H_N libircclient.h PATHS /usr/include/libircclient)
find_path(IRC_H_S libircclient.h PATHS /usr/include)
if(IRC_H_N)
include_directories(${IRC_H_N})
endif(IRC_H_N)
if(IRC_H_N OR IRC_H_S)
set(IRC_H_ true)
else()
message(FATAL_ERROR "Unable to find libircclient")
endif(IRC_H_N OR IRC_H_S)
set(conky_libs ${conky_libs} -lircclient)
2010-04-30 17:32:42 +00:00
endif(BUILD_IRC)
if(BUILD_IPV6)
find_file(IF_INET6 if_inet6 PATHS /proc/net)
if(NOT IF_INET6)
message(WARNING "/proc/net/if_inet6 unavailable")
endif(NOT IF_INET6)
endif(BUILD_IPV6)
2010-06-04 12:41:12 +00:00
if(BUILD_HTTP)
pkg_check_modules(MICROHTTPD REQUIRED libmicrohttpd>=0.9.25)
set(conky_libs ${conky_libs} ${MICROHTTPD_LIBRARIES})
set(conky_includes ${conky_includes} ${MICROHTTPD_INCLUDE_DIRS})
2010-06-04 12:41:12 +00:00
endif(BUILD_HTTP)
2009-12-11 04:37:56 +00:00
if(BUILD_NCURSES)
set(CURSES_NEED_NCURSES TRUE)
include(FindCurses)
if(NOT CURSES_FOUND)
message(FATAL_ERROR "Unable to find ncurses library")
endif(NOT CURSES_FOUND)
set(conky_libs ${conky_libs} ${CURSES_LIBRARIES})
set(conky_includes ${conky_includes} ${CURSES_INCLUDE_DIR})
2009-12-11 04:37:56 +00:00
endif(BUILD_NCURSES)
if(BUILD_MYSQL)
find_path(mysql_INCLUDE_PATH
mysql.h
${INCLUDE_SEARCH_PATH}
/usr/include/mysql
/usr/local/include/mysql)
if(NOT mysql_INCLUDE_PATH)
message(FATAL_ERROR "Unable to find mysql.h")
endif(NOT mysql_INCLUDE_PATH)
set(conky_includes ${conky_includes} ${mysql_INCLUDE_PATH})
find_library(MYSQLCLIENT_LIB
NAMES mysqlclient
PATHS /usr/lib
/usr/lib64
/usr/lib/mysql
/usr/lib64/mysql
/usr/local/lib
/usr/local/lib64
/usr/local/lib/mysql
/usr/local/lib64/mysql)
if(NOT MYSQLCLIENT_LIB)
message(FATAL_ERROR "Unable to find mysqlclient library")
endif(NOT MYSQLCLIENT_LIB)
set(conky_libs ${conky_libs} ${MYSQLCLIENT_LIB})
endif(BUILD_MYSQL)
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
if(BUILD_WLAN AND OS_LINUX)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_include_files(iwlib.h IWLIB_H)
if(NOT IWLIB_H)
message(FATAL_ERROR "Unable to find iwlib.h")
endif(NOT IWLIB_H)
find_library(IWLIB_LIB NAMES iw)
if(NOT IWLIB_LIB)
message(FATAL_ERROR "Unable to find libiw.so")
endif(NOT IWLIB_LIB)
set(conky_libs ${conky_libs} ${IWLIB_LIB})
check_function_exists(iw_sockets_open IWLIB_SOCKETS_OPEN_FUNC)
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
endif(BUILD_WLAN AND OS_LINUX)
2009-12-11 04:37:56 +00:00
if(BUILD_PORT_MONITORS)
check_function_exists(getnameinfo HAVE_GETNAMEINFO)
if(NOT HAVE_GETNAMEINFO)
message(FATAL_ERROR "could not find getnameinfo()")
endif(NOT HAVE_GETNAMEINFO)
check_include_files(
"netdb.h;netinet/in.h;netinet/tcp.h;sys/socket.h;arpa/inet.h"
HAVE_PORTMON_HEADERS)
if(NOT HAVE_PORTMON_HEADERS)
message(FATAL_ERROR "missing needed network header(s) for port monitoring")
endif(NOT HAVE_PORTMON_HEADERS)
2009-12-11 04:37:56 +00:00
endif(BUILD_PORT_MONITORS)
# Check for iconv
2010-01-20 17:17:30 +00:00
if(BUILD_ICONV)
check_include_files(iconv.h HAVE_ICONV_H)
find_library(ICONV_LIBRARY NAMES iconv)
if(NOT ICONV_LIBRARY)
# maybe iconv() is provided by libc
set(ICONV_LIBRARY ""
CACHE FILEPATH
"Path to the iconv library, if iconv is not provided by libc"
FORCE)
endif(NOT ICONV_LIBRARY)
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
check_function_exists(iconv ICONV_FUNC)
if(HAVE_ICONV_H AND ICONV_FUNC)
set(conky_includes ${conky_includes} ${ICONV_INCLUDE_DIR})
set(conky_libs ${conky_libs} ${ICONV_LIBRARY})
else(HAVE_ICONV_H AND ICONV_FUNC)
message(FATAL_ERROR "Unable to find iconv library")
endif(HAVE_ICONV_H AND ICONV_FUNC)
2010-01-20 17:17:30 +00:00
endif(BUILD_ICONV)
2009-12-11 04:37:56 +00:00
# check for Xlib
if(BUILD_X11)
include(FindX11)
find_package(X11)
if(X11_FOUND)
set(conky_includes ${conky_includes} ${X11_INCLUDE_DIR})
set(conky_libs ${conky_libs} ${X11_LIBRARIES})
# check for Xdamage
if(BUILD_XDAMAGE)
if(NOT X11_Xdamage_FOUND)
message(FATAL_ERROR "Unable to find Xdamage library")
endif(NOT X11_Xdamage_FOUND)
if(NOT X11_Xfixes_FOUND)
message(FATAL_ERROR "Unable to find Xfixes library")
endif(NOT X11_Xfixes_FOUND)
set(conky_libs ${conky_libs} ${X11_Xdamage_LIB} ${X11_Xfixes_LIB})
endif(BUILD_XDAMAGE)
if(BUILD_XSHAPE)
if(NOT X11_Xshape_FOUND)
message(FATAL_ERROR "Unable to find Xshape library")
endif(NOT X11_Xshape_FOUND)
set(conky_libs ${conky_libs} ${X11_Xshape_LIB})
endif(BUILD_XSHAPE)
# check for Xft
if(BUILD_XFT)
find_path(freetype_INCLUDE_PATH
config/ftconfig.h
${INCLUDE_SEARCH_PATH}
/usr/include/freetype2
/usr/local/include/freetype2
/usr/pkg/include/freetype2)
if(freetype_INCLUDE_PATH)
set(freetype_FOUND true)
set(conky_includes ${conky_includes} ${freetype_INCLUDE_PATH})
else(freetype_INCLUDE_PATH)
find_path(freetype_INCLUDE_PATH
freetype/config/ftconfig.h
${INCLUDE_SEARCH_PATH}
/usr/include/freetype2
/usr/local/include/freetype2
/usr/pkg/include/freetype2)
if(freetype_INCLUDE_PATH)
set(freetype_FOUND true)
set(conky_includes ${conky_includes} ${freetype_INCLUDE_PATH})
else(freetype_INCLUDE_PATH)
message(FATAL_ERROR "Unable to find freetype library")
endif(freetype_INCLUDE_PATH)
endif(freetype_INCLUDE_PATH)
if(NOT X11_Xft_FOUND)
message(FATAL_ERROR "Unable to find Xft library")
endif(NOT X11_Xft_FOUND)
set(conky_libs ${conky_libs} ${X11_Xft_LIB})
endif(BUILD_XFT)
# check for Xdbe
if(BUILD_XDBE)
if(NOT X11_Xext_FOUND)
message(FATAL_ERROR "Unable to find Xext library (needed for Xdbe)")
endif(NOT X11_Xext_FOUND)
set(conky_libs ${conky_libs} ${X11_Xext_LIB})
endif(BUILD_XDBE)
else(X11_FOUND)
message(FATAL_ERROR "Unable to find X11 library")
endif(X11_FOUND)
endif(BUILD_X11)
Add toluapp subtree (#712) * First commit! * Import to git * Droping down CMake requirement * Corrected installation of libraries * Adding travis build * Updated cmake macros * Fixed find package * Updated travis hook * Updated travis hook * Patch to support Lua 5.3. * Fix Lua header include directives in tolua++.h Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers. As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble. But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers. Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first. See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195 * Remove email notifications. * Update travis build. * Build shared and static libs. * Patch toluapp to support Lua 5.3. With this change, support for Lua 5.1 is dropped. This resolve #116. * Add some comments to clarify the toluapp handling. * Add minor sonar fix.
2018-12-20 20:18:51 +00:00
# Otherwise, use the most recent Lua version
pkg_search_module(LUA
REQUIRED
lua>=5.3
lua5.3
lua-5.3
lua53
lua5.2
lua-5.2
lua52)
2010-11-14 00:41:07 +00:00
set(conky_libs ${conky_libs} ${LUA_LIBRARIES})
set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS})
link_directories(${LUA_LIBRARY_DIRS})
Add toluapp subtree (#712) * First commit! * Import to git * Droping down CMake requirement * Corrected installation of libraries * Adding travis build * Updated cmake macros * Fixed find package * Updated travis hook * Updated travis hook * Patch to support Lua 5.3. * Fix Lua header include directives in tolua++.h Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers. As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble. But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers. Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first. See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195 * Remove email notifications. * Update travis build. * Build shared and static libs. * Patch toluapp to support Lua 5.3. With this change, support for Lua 5.1 is dropped. This resolve #116. * Add some comments to clarify the toluapp handling. * Add minor sonar fix.
2018-12-20 20:18:51 +00:00
include_directories(3rdparty/toluapp/include)
Add toluapp subtree (#712) * First commit! * Import to git * Droping down CMake requirement * Corrected installation of libraries * Adding travis build * Updated cmake macros * Fixed find package * Updated travis hook * Updated travis hook * Patch to support Lua 5.3. * Fix Lua header include directives in tolua++.h Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers. As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble. But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers. Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first. See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195 * Remove email notifications. * Update travis build. * Build shared and static libs. * Patch toluapp to support Lua 5.3. With this change, support for Lua 5.1 is dropped. This resolve #116. * Add some comments to clarify the toluapp handling. * Add minor sonar fix.
2018-12-20 20:18:51 +00:00
if(BUILD_X11)
# Check for libraries used by Lua bindings
if(BUILD_LUA_CAIRO)
pkg_check_modules(CAIRO REQUIRED cairo cairo-xlib)
set(luacairo_libs ${CAIRO_LIBRARIES} ${LUA_LIBRARIES})
set(luacairo_includes ${CAIRO_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS})
find_program(APP_PATCH patch)
if(NOT APP_PATCH)
message(FATAL_ERROR "Unable to find program 'patch'")
endif(NOT APP_PATCH)
endif(BUILD_LUA_CAIRO)
if(BUILD_LUA_IMLIB2)
pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)
set(luaimlib2_libs ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS} ${LUA_LIBRARIES})
set(luaimlib2_includes
${IMLIB2_INCLUDE_DIRS}
${LUA_INCLUDE_DIRS}
${X11_INCLUDE_DIR})
Add toluapp subtree (#712) * First commit! * Import to git * Droping down CMake requirement * Corrected installation of libraries * Adding travis build * Updated cmake macros * Fixed find package * Updated travis hook * Updated travis hook * Patch to support Lua 5.3. * Fix Lua header include directives in tolua++.h Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers. As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble. But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers. Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first. See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195 * Remove email notifications. * Update travis build. * Build shared and static libs. * Patch toluapp to support Lua 5.3. With this change, support for Lua 5.1 is dropped. This resolve #116. * Add some comments to clarify the toluapp handling. * Add minor sonar fix.
2018-12-20 20:18:51 +00:00
endif(BUILD_LUA_IMLIB2)
if(BUILD_LUA_RSVG)
pkg_check_modules(RSVG REQUIRED librsvg-2.0)
set(luarsvg_libs ${RSVG_LIBRARIES} ${LUA_LIBRARIES})
set(luarsvg_includes ${RSVG_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS})
endif(BUILD_LUA_RSVG)
endif(BUILD_X11)
2009-12-06 19:30:06 +00:00
2009-12-06 19:43:12 +00:00
if(BUILD_AUDACIOUS)
set(WANT_GLIB true)
pkg_check_modules(NEW_AUDACIOUS audacious>=1.4.0)
if(NEW_AUDACIOUS_FOUND)
pkg_check_modules(AUDACIOUS REQUIRED audclient>=1.4.0)
pkg_check_modules(DBUS_GLIB REQUIRED dbus-glib-1)
else(NEW_AUDACIOUS_FOUND)
pkg_check_modules(AUDACIOUS REQUIRED audacious<1.4.0)
endif(NEW_AUDACIOUS_FOUND)
set(conky_libs ${conky_libs} ${AUDACIOUS_LIBRARIES} ${DBUS_GLIB_LIBRARIES})
set(conky_includes
${conky_includes}
${AUDACIOUS_INCLUDE_DIRS}
${DBUS_GLIB_INCLUDE_DIRS})
2009-12-06 19:43:12 +00:00
endif(BUILD_AUDACIOUS)
2009-12-08 04:46:49 +00:00
if(BUILD_XMMS2)
pkg_check_modules(XMMS2 REQUIRED xmms2-client>=0.6)
set(conky_libs ${conky_libs} ${XMMS2_LIBRARIES})
set(conky_includes ${conky_includes} ${XMMS2_INCLUDE_DIRS})
2009-12-08 04:46:49 +00:00
endif(BUILD_XMMS2)
if(BUILD_CURL)
set(WANT_CURL true)
2009-12-08 04:46:49 +00:00
endif(BUILD_CURL)
if(BUILD_RSS)
set(WANT_CURL true)
set(WANT_LIBXML2 true)
2009-12-08 04:46:49 +00:00
endif(BUILD_RSS)
if(BUILD_WEATHER_METAR)
set(WANT_CURL true)
set(BUILD_WEATHER true)
2009-12-08 04:46:49 +00:00
endif(BUILD_WEATHER_METAR)
if(BUILD_NVIDIA)
find_path(XNVCtrl_INCLUDE_PATH NVCtrl/NVCtrl.h ${INCLUDE_SEARCH_PATH})
find_library(XNVCtrl_LIB NAMES XNVCtrl)
if(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)
set(XNVCtrl_FOUND true)
set(conky_libs ${conky_libs} ${XNVCtrl_LIB})
set(conky_includes ${conky_includes} ${XNVCtrl_INCLUDE_PATH})
else(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)
message(FATAL_ERROR "Unable to find XNVCtrl library")
endif(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)
2009-12-08 04:46:49 +00:00
endif(BUILD_NVIDIA)
2009-12-11 04:37:56 +00:00
if(BUILD_IMLIB2)
pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)
Add toluapp subtree (#712) * First commit! * Import to git * Droping down CMake requirement * Corrected installation of libraries * Adding travis build * Updated cmake macros * Fixed find package * Updated travis hook * Updated travis hook * Patch to support Lua 5.3. * Fix Lua header include directives in tolua++.h Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers. As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble. But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers. Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first. See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195 * Remove email notifications. * Update travis build. * Build shared and static libs. * Patch toluapp to support Lua 5.3. With this change, support for Lua 5.1 is dropped. This resolve #116. * Add some comments to clarify the toluapp handling. * Add minor sonar fix.
2018-12-20 20:18:51 +00:00
set(conky_libs ${conky_libs} ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS})
set(conky_includes ${conky_includes} ${IMLIB2_INCLUDE_DIRS})
2009-12-11 04:37:56 +00:00
endif(BUILD_IMLIB2)
if(BUILD_JOURNAL)
pkg_search_module(SYSTEMD REQUIRED libsystemd libsystemd-journal)
set(conky_libs ${conky_libs} ${SYSTEMD_LIB} ${SYSTEMD_LDFLAGS})
Add toluapp subtree (#712) * First commit! * Import to git * Droping down CMake requirement * Corrected installation of libraries * Adding travis build * Updated cmake macros * Fixed find package * Updated travis hook * Updated travis hook * Patch to support Lua 5.3. * Fix Lua header include directives in tolua++.h Use angle bracket rather than double quotes when including Lua headers in the tolua++ header. This fixes a problem on systems that default to a Lua version newer than 5.1 and install the tolua++ header to the same directory as newer Lua headers. As there are (usually) no Lua headers in the same directory when building tolua++ itself, the preprocessor will look to the include directories passed to the compiler, one of which would be the Lua 5.1 include directory, and tolua++ will build with those (correct) headers. Then the tolua++ header is usually installed in the default include directory, alongside the newer Lua headers, which you wouldn't expect to cause any trouble. But it does cause trouble when trying to build other programs that include the tolua++ header, because now the preprocessor does find Lua headers in the same directory as the tolua++ header, which are the newer (incorrect) headers. Now the program will either fail to compile, because it doesn't support the newer headers, or fail to link with the tolua++ shared object because they were compiled against different Lua headers. Using angle brackets instead of double quotes in the include directives will fix the problem, because then the preprocessor will look to the include directories passed to the compiler first. See http://www.cegui.org.uk/forum/viewtopic.php?f=10&t=7195 * Remove email notifications. * Update travis build. * Build shared and static libs. * Patch toluapp to support Lua 5.3. With this change, support for Lua 5.1 is dropped. This resolve #116. * Add some comments to clarify the toluapp handling. * Add minor sonar fix.
2018-12-20 20:18:51 +00:00
set(conky_includes ${conky_includes} ${SYSTEMD_INCLUDE_DIRS})
endif(BUILD_JOURNAL)
if(BUILD_PULSEAUDIO)
pkg_check_modules(PULSEAUDIO REQUIRED libpulse)
set(conky_libs ${conky_libs} ${PULSEAUDIO_LIBRARIES})
set(conky_includes ${conky_includes} ${PULSEAUDIO_INCLUDE_DIRS})
endif(BUILD_PULSEAUDIO)
2009-12-08 04:46:49 +00:00
# Common libraries
2009-12-06 19:30:06 +00:00
if(WANT_GLIB)
pkg_check_modules(GLIB REQUIRED glib-2.0>=2.36)
set(conky_libs ${conky_libs} ${GLIB_LIBRARIES})
set(conky_includes ${conky_includes} ${GLIB_INCLUDE_DIRS})
2009-12-06 19:30:06 +00:00
endif(WANT_GLIB)
2009-12-08 04:46:49 +00:00
if(WANT_CURL)
pkg_check_modules(CURL REQUIRED libcurl)
set(conky_libs ${conky_libs} ${CURL_LIBRARIES})
set(conky_includes ${conky_includes} ${CURL_INCLUDE_DIRS})
2009-12-08 04:46:49 +00:00
endif(WANT_CURL)
if(WANT_LIBXML2)
include(FindLibXml2)
if(NOT LIBXML2_FOUND)
message(FATAL_ERROR "Unable to find libxml2 library")
endif(NOT LIBXML2_FOUND)
set(conky_libs ${conky_libs} ${LIBXML2_LIBRARIES})
set(conky_includes ${conky_includes} ${LIBXML2_INCLUDE_DIR})
2009-12-08 04:46:49 +00:00
endif(WANT_LIBXML2)
# Look for doc generation programs
if(BUILD_DOCS)
# Used for doc generation
find_program(APP_DB2X_XSLTPROC db2x_xsltproc)
if(NOT APP_DB2X_XSLTPROC)
message(FATAL_ERROR "Unable to find program 'db2x_xsltproc'")
endif(NOT APP_DB2X_XSLTPROC)
find_program(APP_DB2X_MANXML db2x_manxml)
if(NOT APP_DB2X_MANXML)
message(FATAL_ERROR "Unable to find program 'db2x_manxml'")
endif(NOT APP_DB2X_MANXML)
find_program(APP_XSLTPROC xsltproc)
if(NOT APP_XSLTPROC)
message(FATAL_ERROR "Unable to find program 'xsltproc'")
endif(NOT APP_XSLTPROC)
find_program(APP_MAN man)
if(NOT APP_MAN)
message(FATAL_ERROR "Unable to find program 'man'")
endif(NOT APP_MAN)
find_program(APP_LESS less)
if(NOT APP_LESS)
message(FATAL_ERROR "Unable to find program 'less'")
endif(NOT APP_LESS)
find_program(APP_SED sed)
if(NOT APP_SED)
message(FATAL_ERROR "Unable to find program 'sed'")
endif(NOT APP_SED)
mark_as_advanced(APP_DB2X_XSLTPROC
APP_DB2X_MANXML
APP_XSLTPROC
APP_MAN
APP_SED
APP_LESS)
endif(BUILD_DOCS)
2010-11-14 01:27:01 +00:00
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG true)
2010-11-14 01:27:01 +00:00
endif(CMAKE_BUILD_TYPE MATCHES "Debug")
# The version numbers are simply derived from the date and number of commits
# since start of month
if(DEBUG)
execute_process(COMMAND ${APP_GIT} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git
log --since=${VERSION_MAJOR}-${VERSION_MINOR}-01
--pretty=oneline
COMMAND ${APP_WC} -l
COMMAND ${APP_AWK} "{print $1}"
RESULT_VARIABLE RETVAL
OUTPUT_VARIABLE COMMIT_COUNT
OUTPUT_STRIP_TRAILING_WHITESPACE)
2010-11-14 01:27:01 +00:00
endif(DEBUG)