Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calcmysky: New package #18697

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions mingw-w64-calcmysky/002-missing-symbol-clang-static-lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff -bur CalcMySky-0.3.1-orig/CMakeLists.txt CalcMySky-0.3.1/CMakeLists.txt
--- CalcMySky-0.3.1-orig/CMakeLists.txt 2023-10-03 11:12:11.352394800 -0600
+++ CalcMySky-0.3.1/CMakeLists.txt 2023-10-03 11:13:15.279851400 -0600
@@ -111,16 +111,16 @@
# The first command is a dummy, it doesn't actually create its output: it's
# only needed to force re-running of gen_version.cmake for the case when we've changed
# the version but didn't touch other dependencies.
-add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/check version update" COMMAND $<IF:$<BOOL:${WIN32}>,echo.,true>)
-add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/version.cpp"
- DEPENDS "${PROJECT_BINARY_DIR}/check version update"
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
- COMMAND "${CMAKE_COMMAND}"
- -D "staticVersion=${staticProjectVersion}"
- -D "inputFile=${PROJECT_SOURCE_DIR}/version.cpp.in"
- -D "outputFile=${PROJECT_BINARY_DIR}/version.cpp"
- -P "${PROJECT_SOURCE_DIR}/cmake/gen_version.cmake")
-add_library(version STATIC "${PROJECT_BINARY_DIR}/version.cpp")
+# add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/check version update" COMMAND $<IF:$<BOOL:${WIN32}>,echo.,true>)
+# add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/version.cpp"
+# DEPENDS "${PROJECT_BINARY_DIR}/check version update"
+# WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
+# COMMAND "${CMAKE_COMMAND}"
+# -D "staticVersion=${staticProjectVersion}"
+# -D "inputFile=${PROJECT_SOURCE_DIR}/version.cpp.in"
+# -D "outputFile=${PROJECT_BINARY_DIR}/version.cpp"
+# -P "${PROJECT_SOURCE_DIR}/cmake/gen_version.cmake")
+# add_library(version STATIC "${PROJECT_BINARY_DIR}/version.cpp")
add_library(common STATIC
common/EclipsedDoubleScatteringPrecomputer.cpp
common/TextureAverageComputer.cpp
diff -bur CalcMySky-0.3.1-orig/config.h.in CalcMySky-0.3.1/config.h.in
--- CalcMySky-0.3.1-orig/config.h.in 2023-10-03 11:12:11.352394800 -0600
+++ CalcMySky-0.3.1/config.h.in 2023-10-03 11:13:46.489890600 -0600
@@ -1,6 +1,6 @@
#pragma once

-extern const char*const PROJECT_VERSION;
+static const char*const PROJECT_VERSION = "@PROJECT_VERSION@";
#define DATA_ROOT_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/${CMAKE_PROJECT_NAME}/"
#define INSTALL_BINDIR "${CMAKE_INSTALL_FULL_BINDIR}/"
#define BUILD_BINDIR "${CMAKE_BINARY_DIR}/"
12 changes: 12 additions & 0 deletions mingw-w64-calcmysky/003-dll-install-location.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -bur CalcMySky-0.3.1-orig/ShowMySky/CMakeLists.txt CalcMySky-0.3.1/ShowMySky/CMakeLists.txt
--- CalcMySky-0.3.1-orig/ShowMySky/CMakeLists.txt 2023-10-03 12:55:58.401386500 -0600
+++ CalcMySky-0.3.1/ShowMySky/CMakeLists.txt 2023-10-03 12:56:49.974489900 -0600
@@ -58,7 +58,7 @@
install(TARGETS ShowMySky
EXPORT ShowMySky-Qt${QT_VERSION}Config
LIBRARY DESTINATION "${installLibDir}"
- RUNTIME DESTINATION "${installLibDir}"
+ RUNTIME DESTINATION "${installBinDir}"
ARCHIVE DESTINATION "${installLibDir}"
INCLUDES DESTINATION "${installIncDir}"
)
12 changes: 12 additions & 0 deletions mingw-w64-calcmysky/004-dynamic-lib-prefix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -bur CalcMySky-0.3.1-orig/ShowMySky/api/ShowMySky/AtmosphereRenderer.hpp CalcMySky-0.3.1/ShowMySky/api/ShowMySky/AtmosphereRenderer.hpp
--- CalcMySky-0.3.1-orig/ShowMySky/api/ShowMySky/AtmosphereRenderer.hpp 2023-10-03 16:27:38.436405700 -0600
+++ CalcMySky-0.3.1/ShowMySky/api/ShowMySky/AtmosphereRenderer.hpp 2023-10-03 16:27:49.348575900 -0600
@@ -306,7 +306,7 @@
*
* This is the name that should be passed to dlopen-like functions. Use this macro for portability instead of hard-coding a string.
*/
-#define SHOWMYSKY_LIB_NAME (QT_VERSION_MAJOR==5 ? "ShowMySky-Qt5" : "ShowMySky-Qt6")
+#define SHOWMYSKY_LIB_NAME (QT_VERSION_MAJOR==5 ? "libShowMySky-Qt5" : "libShowMySky-Qt6")
Copy link
Member

@Biswa96 Biswa96 Oct 4, 2023

Choose a reason for hiding this comment

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

Is this for DLL name? DLL name can be without 'lib' prefix but import library name should have 'lib' prefix.

Copy link
Contributor Author

@hmartinez82 hmartinez82 Oct 4, 2023

Choose a reason for hiding this comment

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

Yes, for the DLL. But the DLL was created with the lib prefix. :( . I don't know why it was created with that prefix. I'll take a look again if I can find what is adding the prefix.

Copy link
Member

Choose a reason for hiding this comment

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

Some projects add the following line for mingw only to prevent DLLs with 'lib' prefix.

SET_TARGET_PROPERTIES(target_name PROPERTIES PREFIX "")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome, thanks! I'll look into that!

}

#endif
90 changes: 90 additions & 0 deletions mingw-w64-calcmysky/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

_realname=calcmysky
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.3.1
pkgrel=1
pkgdesc="Planetary atmosphere light scattering simulator"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pkgdesc="Planetary atmosphere light scattering simulator"
pkgdesc="Planetary atmosphere light scattering simulator (mingw-w64)"

arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://10110111.github.io/CalcMySky"
license=("spdx:GPL-3.0-only")
makedepends=(
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-doxygen"
"${MINGW_PACKAGE_PREFIX}-glslang"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-qt6-tools"
"${MINGW_PACKAGE_PREFIX}-shaderc"
)
depends=(
"${MINGW_PACKAGE_PREFIX}-eigen3"
"${MINGW_PACKAGE_PREFIX}-glm"
"${MINGW_PACKAGE_PREFIX}-qt6-base"
"${MINGW_PACKAGE_PREFIX}-vulkan-loader"
)
source=("https://github.com/10110111/CalcMySky/archive/refs/tags/v${pkgver}.tar.gz"
"001-mingw.patch::https://github.com/10110111/CalcMySky/pull/17.patch"
"002-missing-symbol-clang-static-lib.patch"
"003-dll-install-location.patch"
"004-dynamic-lib-prefix.patch")
sha256sums=('d284eaabcf21ad3d1f520a1d1b1b533f7c5f5a44ba92495dd38e238874e8e4d7'
'290b26213e9b139742135329df28ffb87dbb63db6809634dee013d0272f62756'
'e951d29ba317118692d892472be02b8d5395fba2b3b39cafa8335164444f0651'
'2ffbc317cd73a8b0653b5691b411cd47634e6d075fcc3ed16cf3913271b38275'
'12ca2f34efc802a48676cf4ec2ddf1b2d7ad78a49d2de953f6934bc7efb11ab0')

apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -Nbp1 -i "${srcdir}/${_patch}"
done
}

prepare() {
cd "${srcdir}"/${_realname}-${pkgver}
apply_patch_with_msg \
"001-mingw.patch" \
"002-missing-symbol-clang-static-lib.patch" \
"003-dll-install-location.patch" \
"004-dynamic-lib-prefix.patch"
}

build() {
[[ -d "build-${MSYSTEM}" ]] && rm -rf "build-${MSYSTEM}"
mkdir -p "${srcdir}/build-${MSYSTEM}"
cd "${srcdir}/build-${MSYSTEM}"

declare -a _extra_config
if check_option "debug" "n"; then
_extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
_extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi

MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-G "Ninja" \
"${_extra_config[@]}" \
-DQT_VERSION=6 \
../${_realname}-${pkgver}

${MINGW_PREFIX}/bin/cmake --build .

${MINGW_PREFIX}/bin/cmake --build . --target doc
}

package() {
cd "${srcdir}/build-${MSYSTEM}"

DESTDIR=${pkgdir} ${MINGW_PREFIX}/bin/cmake.exe --install .

install -vDm 644 ${srcdir}/${_realname}-${pkgver}/COPYING -t "${pkgdir}${MINGW_PREFIX}/share/licenses/$_realname/"

# Install documentation
install -vDm 644 ${srcdir}/build-${MSYSTEM}/doc/doxygen/html/*.* -t "${pkgdir}${MINGW_PREFIX}/share/doc/$_realname/"
install -vDm 644 ${srcdir}/build-${MSYSTEM}/doc/doxygen/html/search/*.* -t "${pkgdir}${MINGW_PREFIX}/share/doc/$_realname/search/"
}