dimitry-ishenko-cpp / gpio

C++ GPIO Library for Linux
GNU General Public License v3.0
8 stars 3 forks source link

Directory /usr/share/doc/gpio++ violates FHS policy due to not have version numbers. #3

Closed Petross404 closed 3 years ago

Petross404 commented 4 years ago

Hello, I recently found your library and I want to experiment with it and my adafruit board. I am installing gpio (maybe gpio++ or cppgpio would describe the lib better among all the others for gpio programming?) with portage on Gentoo since I don't want to mess my system.

The thing is that I get an error about violating the FHS policy paths:


 * Final size of build directory: 2856 KiB (2.7 MiB)
 * Final size of installed tree:   252 KiB

 * The ebuild is installing to one or more unexpected paths:
 * 
 *   /usr/share/doc/gpio++
 * 
 * Please fix the ebuild to use correct FHS/Gentoo policy paths.
Files matching a file type that is not allowed:
   usr/lib/libgpio++.so.4.0
 * ERROR: dev-libs/gpio++-4.0::testing failed:
 *   multilib-strict check failed!

Now, looking at other examples inside /usr/share/doc/ I see this convention:

$ ls /usr/share/doc/ | grep ++
libsigc++-2.10.1
libsigc++-2.10.3
libsigc++-2.4.0
mysql++-3.1.0
socket++-1.12.12-r1
....

All of these packages install their documentation inside a directory which has the version number too. Like /usr/share/doc/gpio++-${VERSION}. I think this line should change as:

From :

install(FILES ${FILES} DESTINATION share/doc/${PROJECT_NAME})

To:

install(FILES ${FILES} DESTINATION share/doc/${PROJECT_NAME}-${VERSION})

So if ever my ebuild gets in the main portage tree, it will not deal with FHS shortcomings. Thank you from your time.

dimitry-ishenko commented 4 years ago

@Petross404 I am relying on you - haven't tested at all. :smile: Once you confirm it's working, please close the issue.

I'll try to make RPi release later today.

Petross404 commented 4 years ago

@Petross404 I am relying on you - haven't tested at all. smile Once you confirm it's working, please close the issue.

I'll try to make RPi release later today.

Ok I will right now. I will test the master and if it works I will create a small patch to work with the ebuild for version 4.0.

Petross404 commented 4 years ago

Silly me, I hadn't tested the proposed variable (VERSION) and it's not suitable. In fact what is needed is ${PROJECT_VERSION}.

Never mind, I will clone the repo and make a PR later because I suspect further issues with FHS down the road. Thank you and sorry :)

Petross404 commented 4 years ago

Before I commit something you don't like, I want to ask you here a few questions.

1) Pigpio is working only on arm platforms such as RPi because it needs a specific Broadcom chip for gpio functionality. Such thing doesn't exist on a typical x86 Linux pc (even with gpio breakout boards like adafruit's). I have tried and failed to use pigpio on my pc.

Do you mind if the build system prints something like this to inform the user?

/mnt/Volume_3/Gentoo/projects/CPlus/gpio.git/build> /usr/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Debug /mnt/Volume_3/Gentoo/projects/CPlus/gpio.git
CMake Warning at CMakeLists.txt:24 (message):
  PiGPIO is functional only on Arm/RasperyPi platforms!

-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/Volume_3/Gentoo/projects/CPlus/gpio.git/build
*** Finished ***

Code:

option(BUILD_PIGPIO "Build pigpio backend" ON)
if(BUILD_PIGPIO)
    if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
        message(WARNING "PiGPIO is functional only on Arm/RasberyPi platforms!")
    endif()
        # Maybe use this? : find_package(pigpio REQUIRED)
    add_subdirectory(pigpio)
endif(BUILD_PIGPIO)

2) Do you mind to include(GNUInstallDirs)? This way cmake won't use hardcoded install paths but rather will detect them and will act accordingly. More info here. The code will be like:

# install
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${FILES} DESTINATION ${CMAKE_INSTALL_DOCDIR})

3) You are recommending cpp Asio but a) Don't find any package for it b) S.O. proposes using Boost.Asio since Asio is developed in Boost since some time. I don't know anything on the matter, it's totally on you :) .

All the best, Petros

dimitry-ishenko commented 4 years ago

Silly me, I hadn't tested the proposed variable (VERSION) and it's not suitable. In fact what is needed is ${PROJECT_VERSION}.

Never mind, I will clone the repo and make a PR later because I suspect further issues with FHS down the road. Thank you and sorry :)

OK I rolled back the changes. Hopefully no one noticed. :laughing:

dimitry-ishenko commented 4 years ago
  1. Pigpio is working only on arm platforms such as RPi because it needs a specific Broadcom chip for gpio functionality. Such thing doesn't exist on a typical x86 Linux pc (even with gpio breakout boards like adafruit's). I have tried and failed to use pigpio on my pc.

IMHO it should just be a dependent option which depends on ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm". In other words it would only be available on ARM platforms.

  1. Do you mind to include(GNUInstallDirs)? This way cmake won't use hardcoded install paths...

I don't mind.

  1. You are recommending cpp Asio but a) Don't find any package for it

Gentoo: dev-cpp/asio. Ubuntu: libasio-dev.

b) S.O. proposes using Boost.Asio since Asio is developed in Boost since some time. I don't know anything on the matter, it's totally on you :) .

Asio has been included in Boost a while ago, but it's also available as a standalone library. I am not a big fan of adding dependency on boost, so I went with the standalone version.

Petross404 commented 4 years ago

I agree with you on dependent option for pigpio. Also, when I was writing about asio I meant that your cmakelists should use find_package(..., I 've already installed asio ;) And finally I am not a fun of a huge dependency like Boost either.

So, as of now I will stick with GnuInstallDirs :)

Petross404 commented 3 years ago

Yeah, I have to continue what I started here. I will get it ready in the next few days.

Petross404 commented 3 years ago

It's here but a few problems remain.

a) I can't find a solution on how cmake will search for asio during configuration. Anything I found is about boost. b) Ebuilds are supposed to be the same across all platforms. This one doesn't enable pigpio while on arm pigpio will be unconditionally enabled.

Anyway, I can't find an alternative.

dimitry-ishenko commented 3 years ago

a) You had a typo in find_library. b) Add a USE flag that is platform dependent. It's been a while since I've used Gentoo, but it should be possible.

dimitry-ishenko commented 3 years ago

@Petross404 I've switched to GNUInstallDirs and made BUILD_PIGPIO option platform-dependent. Please test version 4.1 and let me know if that works for you.

NB: On my box CMAKE_INSTALL_DOCDIR still expands to /usr/share/doc/gpio++ without the version number. YMMV.

dimitry-ishenko commented 3 years ago

Closing for now. Please reopen as needed.