Skip to content

Commit

Permalink
use python plugin in packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
m32 committed Oct 13, 2024
1 parent e9095b8 commit 87523e6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ if (DEFINED PYTHON AND PYTHON)
DESTINATION "lib/far2l/Plugins/python/plug/" USE_SOURCE_PERMISSIONS
COMPONENT base FILES_MATCHING
PATTERN "*")
install(DIRECTORY "${INSTALL_DIR}/Plugins/python/plug/plugins"
DESTINATION "lib/far2l/Plugins/python/plug/" USE_SOURCE_PERMISSIONS
COMPONENT base FILES_MATCHING
PATTERN "*")
else()
message(STATUS "${ColorRed}PYTHON plugin disabled, use -DPYTHON=yes if you need it${ColorNormal}")
install(CODE "
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ See also [Community packages & binaries](#community_bins)
* `libarchive-dev` (_optional_ - needed for better archives support in **multiarc**)
* `libunrar-dev` (_optional_ - needed for RAR archives support in **multiarc**, see `UNRAR` command line option)
* `libpcre2-dev` (_optional_ - needed for advanced custom archive formats support in **multiarc**)
* `libpython3-dev` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `libffi-dev` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `python3-venv` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `python3-dev` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `python3-cffi` (_optional_ - needed for **python plugins** support, see `-DPYTHON` command line option)
* `cmake` ( >= 3.2.2 )
* `pkg-config`
* `g++`
Expand Down Expand Up @@ -187,9 +186,8 @@ To eliminate libuchardet requirement to reduce far2l dependencies by cost of los

To build with Python plugin: add argument `-DPYTHON=yes`
but you must have installed additional packages within yours system:
`libpython3-dev`,
`libffi-dev`,
`python3-venv`.
`python3-dev`,
`python3-cffi`.


To control how RAR archives will be handled in multiarc:
Expand Down
3 changes: 2 additions & 1 deletion dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ libxml2-dev
libarchive-dev
libssh-dev

python3
python3-dev
python3-cffi
3 changes: 3 additions & 0 deletions packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ endif(PCRE_FOUND)
if(LibArchive_FOUND)
LIST(APPEND PACKAGE_DEPENDENCIES libarchive13)
endif(LibArchive_FOUND)
IF (${PYTHON})
LIST(APPEND PACKAGE_DEPENDENCIES "python3, python3-cffi")
ENDIF()

string(REPLACE ";" ", " PACKAGE_DEPENDENCIES "${PACKAGE_DEPENDENCIES}")

Expand Down
13 changes: 9 additions & 4 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ set_target_properties(python PROPERTIES
)

add_custom_command(
#TARGET python POST_BUILD
OUTPUT "${INSTALL_DIR}/Plugins/python/plug/far2l/far2lcffi.h"
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/configs
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/far2lcffi.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/far2lcffidefs.h
DEPENDS ../far2l/far2sdk/farplug-wide.h
Expand All @@ -53,6 +51,13 @@ add_custom_command(
DEPENDS ../WinPort/WinCompat.h
DEPENDS ../WinPort/WinPort.h
DEPENDS ../WinPort/WinPortDecl.h
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/configs" "${INSTALL_DIR}/Plugins/python"
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/src/prebuild.sh "${CMAKE_SOURCE_DIR}" "${INSTALL_DIR}/Plugins/python/plug/far2l/far2lcffi.h" "${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS}"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/configs/plug/far2l" "${INSTALL_DIR}/Plugins/python/plug/far2l"
COMMAND echo ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -E -P -xc -I"${CMAKE_SOURCE_DIR}/far2l/far2sdk" -I"${CMAKE_SOURCE_DIR}/WinPort" "${CMAKE_SOURCE_DIR}/python/src/far2lcffi.h" > "${INSTALL_DIR}/Plugins/python/plug/far2l/far2lcffi.h"
COMMAND cat "${CMAKE_SOURCE_DIR}/python/src/far2lcffidefs.h" >> "${INSTALL_DIR}/Plugins/python/plug/far2l/far2lcffi.h"
)

add_custom_command(
TARGET python POST_BUILD
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/configs/plug/plugins
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/configs/plug/plugins" "${INSTALL_DIR}/Plugins/python/plug/plugins"
)
10 changes: 0 additions & 10 deletions python/src/prebuild.sh

This file was deleted.

0 comments on commit 87523e6

Please sign in to comment.