Properly pack all dependencies into nightlies on all platforms (#153)

* Properly bundle all files in linux install step

* Run make install on linux build

* Use correct default magic database

* Set default magic db permissions correctly

* Fixed magic file detection issues

* Don't install default magic file if none was found

* Try fix windows packing issues
This commit is contained in:
WerWolv 2021-02-01 17:26:05 +01:00 committed by GitHub
parent 8603ec1c99
commit 16a1ae3010
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 19 deletions

View file

@ -39,16 +39,24 @@ jobs:
- name: ✋ Build - name: ✋ Build
run: | run: |
# Get path to magic db
MAGICDB_PATH=$(file --version | grep -oP "(?<=magic file from ).+")
mkdir build mkdir build
cd build cd build
CC=gcc-10 CXX=g++-10 cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. CC=gcc-10 CXX=g++-10 cmake \
make -j 4 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
-DEXTRA_MAGICDBS="$MAGICDB_PATH" \
..
make -j 4 install
- name: 📦 Upload ELF - name: 📦 Upload ELF
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: Linux ELF name: Linux ELF
path: build/imhex path: |
build/install/*
win: win:
runs-on: windows-latest runs-on: windows-latest

View file

@ -18,7 +18,6 @@ set(PLUGINS
set(MAGICDBS set(MAGICDBS
magic_dbs/nintendo_magic magic_dbs/nintendo_magic
) )
createMagicDbList()
findLibraries() findLibraries()

View file

@ -187,17 +187,39 @@ macro(createPackage)
]]) ]])
endif() endif()
if (UNIX AND NOT APPLE)
install(TARGETS libimhex DESTINATION ${CMAKE_INSTALL_PREFIX})
string(REPLACE ":" ";" EXTRA_MAGICDBS "${EXTRA_MAGICDBS}")
endif ()
if (NOT EXTRA_MAGICDBS STREQUAL "")
list(GET EXTRA_MAGICDBS -1 EXTRA_MAGICDBS)
if (NOT EXTRA_MAGICDBS STREQUAL "NOTFOUND")
if (EXTRA_MAGICDBS MATCHES ".*\\.mgc")
install(FILES "${EXTRA_MAGICDBS}" DESTINATION magic/)
else ()
install(FILES "${EXTRA_MAGICDBS}.mgc" DESTINATION magic/)
endif ()
endif ()
endif ()
# Compile the imhex-specific magicdb # Compile the imhex-specific magicdb
add_custom_target(magic_dbs ALL add_custom_target(magic_dbs ALL
SOURCES magic_dbs/nintendo_magic SOURCES ${MAGICDBS}
) )
add_custom_command(TARGET magic_dbs add_custom_command(TARGET magic_dbs
COMMAND file -C -m ${CMAKE_SOURCE_DIR}/magic_dbs COMMAND file -C -m ${CMAKE_SOURCE_DIR}/magic_dbs
) )
foreach (plugin IN LISTS PLUGINS)
install(FILES "$<TARGET_FILE:${plugin}>" DESTINATION plugins/)
endforeach ()
# Install the magicdb files. # Install the magicdb files.
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magic_dbs.mgc DESTINATION magic/ RENAME imhex.mgc) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/magic_dbs.mgc DESTINATION magic/ RENAME imhex.mgc)
install(FILES ${EXTRA_MAGICDBS} DESTINATION magic/)
if (CREATE_BUNDLE) if (CREATE_BUNDLE)
include(PostprocessBundle) include(PostprocessBundle)
@ -216,7 +238,11 @@ macro(createPackage)
install(TARGETS imhex BUNDLE DESTINATION .) install(TARGETS imhex BUNDLE DESTINATION .)
else() else()
install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) if (WIN32)
install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else ()
install(TARGETS imhex RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
endif ()
endif() endif()
@ -236,18 +262,6 @@ function(JOIN OUTPUT GLUE)
set(${OUTPUT} "${_TMP_RESULT}" PARENT_SCOPE) set(${OUTPUT} "${_TMP_RESULT}" PARENT_SCOPE)
endfunction() endfunction()
macro(createMagicDbList)
if (DEFINED MAGICDBS)
if (WIN32)
join(EXTRA_MAGICDBS "\;" ${MAGICDBS})
else()
join(EXTRA_MAGICDBS ":" ${MAGICDBS})
endif()
else()
set(EXTRA_MAGICDBS "")
endif()
endmacro()
macro(setDefaultBuiltTypeIfUnset) macro(setDefaultBuiltTypeIfUnset)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Using Release build type as it was left unset" FORCE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Using Release build type as it was left unset" FORCE)