Skip to content

Conversation

@CarterLi
Copy link
Member

@CarterLi CarterLi commented Oct 1, 2022

No description provided.

@CarterLi CarterLi changed the title Config: respect CMAKE_INSTALL_SYSCONFDIR macOS: respect CMAKE_INSTALL_SYSCONFDIR; use Cocoa API to parse plist files Oct 1, 2022
Copy link
Collaborator

@LinusDierheimer LinusDierheimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll trust you on the apple code.

Comment on lines +125 to +127
if(NOT TARGET_DIR_ETC)
set(TARGET_DIR_ETC "${CMAKE_INSTALL_SYSCONFDIR}")
endif()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work if CMAKE_INSTALL_SYSCONFDIR is not given during configuring. It is set by include(GNUInstallDirs), which must be called after we set our default values.

TARGET_DIR_ETC and CMAKE_INSTALL_SYSCONFDIR will always be the same, so i would do the following:

Line 125 - 127:

if(NOT CMAKE_INSTALL_SYSCONFDIR)
    set(CMAKE_INSTALL_SYSCONFDIR "${TARGET_DIR_ROOT}/etc" CACHE PATH "..." FORCE)
endif()

fastfetch_config.h.in:

#define FASTFETCH_TARGET_DIR_ETC "@CMAKE_INSTALL_SYSCONFDIR@"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TARGET_DIR_ETC and CMAKE_INSTALL_SYSCONFDIR will always be the same

It's not the case if a user specifies CMAKE_INSTALL_SYSCONFDIR. It's necessary to make it work with macOS homebrew

Copy link
Member Author

@CarterLi CarterLi Oct 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@LinusDierheimer LinusDierheimer Oct 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to be clear we need the following variables:

  • CMAKE_INSTALL_SYSCONFDIR: global fastfetch.conf goes here, only used for parsing the own config file
  • TARGET_DIR_ETC: global config dir, used to parse config files of other applications.

Configuring should be done the following way:

  • If both are given: fine
  • If one is given, initialize the other with the same value
  • If none is given, initialize both with ${TARGET_DIR_ROOT}/etc

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the updated comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please do the code change? I'm not an expert of cmake.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ofc.

@CarterLi
Copy link
Member Author

CarterLi commented Oct 9, 2022

I'll trust you on the apple code.

Thanks.

@LinusDierheimer LinusDierheimer merged commit 2f6613c into fastfetch-cli:master Oct 9, 2022
@CarterLi CarterLi deleted the master branch March 15, 2023 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants