commit c7feb08367c72455fa77ef7125b7ef20a0444e23 Author: EnumDev Date: Wed Jul 29 12:14:07 2026 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d96df7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore BPM archives and signatures +*.bpm +*.bpm.sig diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..25f3cd6 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Github repository +REPO="metabrainz/libmusicbrainz" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name') + +# Get version number from tag name +VERSION=$(echo "$TAG_NAME" | rev | cut -d'-' -f1 | rev) + +# Trim 'v' character in VERSION variable +VERSION=$(echo "$VERSION" | tr -d 'v') + +echo "$VERSION" diff --git a/info.yml b/info.yml new file mode 100644 index 0000000..1fafcfa --- /dev/null +++ b/info.yml @@ -0,0 +1,20 @@ +name: libmusicbrainz +description: Library That Provides Access to the MusicBrainz Server +version: 5.1.0 +revision: 1 +url: https://musicbrainz.org/doc/libmusicbrainz +license: LGPL-2.1-or-later +architecture: any +type: source +depends: + - gcc-libs + - libxml2 + - neon +make_depends: + - cmake + - doxygen +downloads: + - url: https://github.com/metabrainz/libmusicbrainz/releases/download/release-${BPM_PKG_VERSION}/libmusicbrainz-${BPM_PKG_VERSION}.tar.gz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 6749259e89bbb273f3f5ad7acdffb7c47a2cf8fcaeab4c4695484cef5f4c6b46 diff --git a/recipe.sh b/recipe.sh new file mode 100644 index 0000000..52d49f5 --- /dev/null +++ b/recipe.sh @@ -0,0 +1,33 @@ +# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +# The prepare function is executed in the root of the temp directory +# This function is used for putting downloaded files to the correct location or applying patches +prepare() { + cd "$BPM_SOURCE" + patch -Np1 -i "$BPM_WORKDIR"/libmusicbrainz-5.patch + patch -Np1 -i "$BPM_WORKDIR"/libmusicbrainz-16.patch + patch -Np1 -i "$BPM_WORKDIR"/libmusicbrainz-19.patch +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + cmake -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_POLICY_VERSION_MINIMUM=3.5 + cmake --build build + cmake --build build --target docs +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + DESTDIR="$BPM_OUTPUT" cmake --install build + + # Install documentation + mkdir -p "$BPM_OUTPUT"/usr/share/doc/libmusicbrainz + cp -r build/docs "$BPM_OUTPUT"/usr/share/doc/libmusicbrainz/html + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING.txt "$BPM_OUTPUT"/usr/share/licenses/libmusicbrainz5/COPYING.txt +} diff --git a/source-files/libmusicbrainz-16.patch b/source-files/libmusicbrainz-16.patch new file mode 100644 index 0000000..b14d17e --- /dev/null +++ b/source-files/libmusicbrainz-16.patch @@ -0,0 +1,24 @@ +From 36262d60fe92fe7a2c9bfb40e736bfcd29a6c3bd Mon Sep 17 00:00:00 2001 +From: Abderrahim Kitouni +Date: Fri, 13 Apr 2018 09:56:57 +0100 +Subject: [PATCH] src/CMakelists.txt: do not use wildcards for dependencies + +This is discouraged by cmake's documentation and doesn't work with the ninja generator. +--- + src/CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 68c04e3..f7439d3 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -37,7 +37,8 @@ ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mb5_c.cc ${CMAKE_CURRENT_BINARY_DIR}/mb5_c.h ${CMAKE_CURRENT_BINARY_DIR}/../include/musicbrainz5/mb5_c.h + COMMAND make-c-interface ${CMAKE_CURRENT_SOURCE_DIR} cinterface.xml ${CMAKE_CURRENT_BINARY_DIR} mb5_c.cc mb5_c.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/mb5_c.h ${CMAKE_CURRENT_BINARY_DIR}/../include/musicbrainz5/mb5_c.h +- DEPENDS make-c-interface cinterface.xml *.inc ++ DEPENDS make-c-interface cinterface.xml c-int-medium-defines.inc c-int-query-source.inc c-int-source-funcs.inc ++ c-int-medium-source.inc c-int-release-defines.inc c-int-query-defines.inc c-int-release-source.inc + ) + + ADD_CUSTOM_TARGET(src_gen DEPENDS mb5_c.h) diff --git a/source-files/libmusicbrainz-19.patch b/source-files/libmusicbrainz-19.patch new file mode 100644 index 0000000..5ca9147 --- /dev/null +++ b/source-files/libmusicbrainz-19.patch @@ -0,0 +1,64 @@ +From 9ba00067a15479a52262a5126bcb6889da5884b7 Mon Sep 17 00:00:00 2001 +From: Christopher Degawa +Date: Sun, 8 Oct 2023 11:41:30 -0500 +Subject: [PATCH 1/2] libxml: include parser.h + +libxml2 removed the inclusion of global.h in a few of its include files, +so we can no longer rely on transitive includes. + +This applies to functions like xmlParseFile. + +Signed-off-by: Christopher Degawa +--- + src/xmlParser.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/xmlParser.cc b/src/xmlParser.cc +index e63df55..53dec25 100644 +--- a/src/xmlParser.cc ++++ b/src/xmlParser.cc +@@ -30,6 +30,7 @@ + + #include + #include ++#include + + XMLResults::XMLResults() + : line(0), + +From 558c9ba0e6d702d5c877f75be98176f57abf1b02 Mon Sep 17 00:00:00 2001 +From: Christopher Degawa +Date: Sun, 8 Oct 2023 11:42:55 -0500 +Subject: [PATCH 2/2] libxml: constify the storage of xmlGetLastError() + +libxml2 recently made it a const return. +Since nothing is being modified of it, this should have no real effect +past satisfying the compiler. + +Signed-off-by: Christopher Degawa +--- + src/xmlParser.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/xmlParser.cc b/src/xmlParser.cc +index 53dec25..fee684c 100644 +--- a/src/xmlParser.cc ++++ b/src/xmlParser.cc +@@ -57,7 +57,7 @@ XMLNode *XMLRootNode::parseFile(const std::string &filename, XMLResults* results + + doc = xmlParseFile(filename.c_str()); + if ((doc == NULL) && (results != NULL)) { +- xmlErrorPtr error = xmlGetLastError(); ++ const xmlError *error = xmlGetLastError(); + results->message = error->message; + results->line = error->line; + results->code = error->code; +@@ -72,7 +72,7 @@ XMLNode *XMLRootNode::parseString(const std::string &xml, XMLResults* results) + + doc = xmlParseMemory(xml.c_str(), xml.length()); + if ((doc == NULL) && (results != NULL)) { +- xmlErrorPtr error = xmlGetLastError(); ++ const xmlError *error = xmlGetLastError(); + results->message = error->message; + results->line = error->line; + results->code = error->code; diff --git a/source-files/libmusicbrainz-5.patch b/source-files/libmusicbrainz-5.patch new file mode 100644 index 0000000..afb846e --- /dev/null +++ b/source-files/libmusicbrainz-5.patch @@ -0,0 +1,47 @@ +From 3c8d945c20a6fd6eabe9fc3ef24809b88cb50301 Mon Sep 17 00:00:00 2001 +From: Sebastian Ramacher +Date: Thu, 20 Nov 2014 18:54:17 +0100 +Subject: [PATCH 1/2] Allow doxygen out-of-tree builds + +Signed-off-by: Sebastian Ramacher +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 384cb65..83c5b23 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -29,7 +29,7 @@ SET(LIB_INSTALL_DIR ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "Install + SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Installation prefix for C header files" FORCE) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libmusicbrainz5.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libmusicbrainz5.pc) +-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile) ++CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h) + + FILE(GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/include/musicbrainz5/*.h) + +From 3407ac7df846b141b05d5bd747a1f001e9fc08b5 Mon Sep 17 00:00:00 2001 +From: Sebastian Ramacher +Date: Thu, 20 Nov 2014 19:07:36 +0100 +Subject: [PATCH 2/2] Also move generated config.h to CMAKE_BINARY_DIR + +Signed-off-by: Sebastian Ramacher +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 83c5b23..e8d68c0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,7 +30,7 @@ SET(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "Installation + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libmusicbrainz5.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libmusicbrainz5.pc) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) +-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h) ++CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h) + + FILE(GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/include/musicbrainz5/*.h) + INSTALL(FILES ${headers} ${CMAKE_CURRENT_BINARY_DIR}/include/musicbrainz5/mb5_c.h DESTINATION ${INCLUDE_INSTALL_DIR}/musicbrainz5)