Skip to content

Commit

Permalink
[dumb] New port (microsoft#30740)
Browse files Browse the repository at this point in the history
* [dumb] New port.

* [dumb] Add to baseline.

* [dumb] Apply suggestion from review.

- Remove unofficial config since a pkg-config file is provided.
- Update the match string for pkg-config fixes.
- Limit ONLY_STATIC_LIBRARY to Windows.

* [dumb] Update version.

* [dumb] Remove vcpkg-cmake-config dependency.

This dependency is no longer needed since the unofficial config was
removed.

* [dumb] Update version.
  • Loading branch information
FtZPetruska authored Apr 12, 2023
1 parent f0ee0ca commit bf4958b
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ports/dumb/check-for-math-lib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a793bba..6fd094c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -223,7 +223,10 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(dumb PROPERTIES INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR})
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Darwin")

+find_library(HAS_MATH_LIB NAMES "m")
+if(HAS_MATH_LIB)
target_link_libraries(dumb m)
+endif()

install(FILES ${PKG_CONFIG_FILE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${INSTALL_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

26 changes: 26 additions & 0 deletions ports/dumb/do-not-overwrite-cflags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a793bba..585ef78 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,17 +29,17 @@ check_and_add_c_compiler_flag("-Wall" CMAKE_C_FLAGS)
add_definitions("-D_FILE_OFFSET_BITS=64")
add_definitions("-DDUMB_DECLARE_DEPRECATED")

-set(CMAKE_C_FLAGS_DEBUG "-DDEBUGMODE=1 -D_DEBUG")
+set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUGMODE=1 -D_DEBUG")
check_and_add_c_compiler_flag("-ggdb" CMAKE_C_FLAGS_DEBUG)
check_and_add_c_compiler_flag("-Zi" CMAKE_C_FLAGS_DEBUG)

-set(CMAKE_C_FLAGS_RELEASE "-ffast-math -O2 -DNDEBUG")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math -O2 -DNDEBUG")

-set(CMAKE_C_FLAGS_RELWITHDEBINFO "-ffast-math -O2 -DNDEBUG")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ffast-math -O2 -DNDEBUG")
check_and_add_c_compiler_flag("-g" CMAKE_C_FLAGS_RELWITHDEBINFO)
check_and_add_c_compiler_flag("-Zi" CMAKE_C_FLAGS_RELWITHDEBINFO)

-set(CMAKE_C_FLAGS_MINSIZEREL "-ffast-math -Os -DNDEBUG")
+set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -ffast-math -Os -DNDEBUG")

if(USE_SSE)
check_c_compiler_flag("-msse" "CC_HAS_MSSE")
44 changes: 44 additions & 0 deletions ports/dumb/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO kode54/dumb
REF "${VERSION}"
SHA512 18b10a507d69a754cdf97fbeae41c17f211a6ba1f166a822276bdb6769d3edc326919067a3f4d1247d6715d7a5a8276669d83b9427e7336c6d111593fb7e36cf
HEAD_REF master
PATCHES
"check-for-math-lib.patch"
"do-not-overwrite-cflags.patch"
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_EXAMPLES=OFF
-DBUILD_ALLEGRO4=OFF
)

vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/dumb.pc" "-llibdumb" "-ldumb")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/dumb.pc" "-llibdumb" "-ldumbd")
endif()

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/dumb.pc" " -lm" "")
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/dumb.pc" " -lm" "")
endif()
endif()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
13 changes: 13 additions & 0 deletions ports/dumb/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "dumb",
"version": "2.0.3",
"description": "Module/tracker based music format parser and player library",
"homepage": "https://github.com/kode54/dumb",
"license": null,
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2180,6 +2180,10 @@
"baseline": "2.5.0",
"port-version": 3
},
"dumb": {
"baseline": "2.0.3",
"port-version": 0
},
"dv-processing": {
"baseline": "1.7.8",
"port-version": 1
Expand Down
9 changes: 9 additions & 0 deletions versions/d-/dumb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "fb0e42347cd9ec43e40d2b123990e1705399dc02",
"version": "2.0.3",
"port-version": 0
}
]
}

0 comments on commit bf4958b

Please sign in to comment.