From 59864c5451fc9c1e353699ce1bf8d57c01ee1851 Mon Sep 17 00:00:00 2001 From: Zach DeCook <zachdecook@librem.one> Date: Mon, 6 Jun 2022 22:03:10 +0000 Subject: [PATCH] testing/verovio: new aport --- ...hange-directory-to-usr-share-verovio.patch | 39 ++++++ testing/verovio/APKBUILD | 118 ++++++++++++++++++ testing/verovio/commit-version.patch | 12 ++ testing/verovio/fix-c-wrapper.patch | 38 ++++++ testing/verovio/install-prefix.patch | 12 ++ testing/verovio/python-data-path.patch | 11 ++ 6 files changed, 230 insertions(+) create mode 100644 testing/verovio/0001-data-change-directory-to-usr-share-verovio.patch create mode 100644 testing/verovio/APKBUILD create mode 100644 testing/verovio/commit-version.patch create mode 100644 testing/verovio/fix-c-wrapper.patch create mode 100644 testing/verovio/install-prefix.patch create mode 100644 testing/verovio/python-data-path.patch diff --git a/testing/verovio/0001-data-change-directory-to-usr-share-verovio.patch b/testing/verovio/0001-data-change-directory-to-usr-share-verovio.patch new file mode 100644 index 000000000000..5e20892849da --- /dev/null +++ b/testing/verovio/0001-data-change-directory-to-usr-share-verovio.patch @@ -0,0 +1,39 @@ +From ae64b962a05237711ca79f6c9a7a529cf9d367f3 Mon Sep 17 00:00:00 2001 +From: Zach DeCook <zachdecook@librem.one> +Date: Thu, 2 Jun 2022 19:34:03 -0400 +Subject: [PATCH] data: change directory to /usr/share/verovio + +--- + src/options.cpp | 2 +- + src/resources.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/options.cpp b/src/options.cpp +index 2fd3868af..90c4aa16f 100644 +--- a/src/options.cpp ++++ b/src/options.cpp +@@ -902,7 +902,7 @@ Options::Options() + m_baseOptions.AddOption(&m_page); + + m_resourcePath.SetInfo("Resource path", "Path to the directory with Verovio resources"); +- m_resourcePath.Init("/usr/local/share/verovio"); ++ m_resourcePath.Init("/usr/share/verovio"); + m_resourcePath.SetKey("resourcePath"); + m_resourcePath.SetShortOption('r', true); + m_baseOptions.AddOption(&m_resourcePath); +diff --git a/src/resources.cpp b/src/resources.cpp +index d143beb14..c46affb35 100644 +--- a/src/resources.cpp ++++ b/src/resources.cpp +@@ -22,7 +22,7 @@ namespace vrv { + // Static members with some default values + //---------------------------------------------------------------------------- + +-thread_local std::string Resources::s_defaultPath = "/usr/local/share/verovio"; ++thread_local std::string Resources::s_defaultPath = "/usr/share/verovio"; + const Resources::StyleAttributes Resources::k_defaultStyle{ data_FONTWEIGHT::FONTWEIGHT_normal, + data_FONTSTYLE::FONTSTYLE_normal }; + +-- +2.36.1 + diff --git a/testing/verovio/APKBUILD b/testing/verovio/APKBUILD new file mode 100644 index 000000000000..91083d94b2f1 --- /dev/null +++ b/testing/verovio/APKBUILD @@ -0,0 +1,118 @@ +# Maintainer: Zach DeCook <zachdecook@librem.one> +pkgname=verovio +pkgver=3.10.0 +pkgrel=0 +_commit=845ab54 +pkgdesc="Music notation engraving for MEI with MusicXML and Humdrum support" +url="https://www.verovio.org/index.xhtml" +arch="all" +license="LGPL-3.0-only" +depends_dev="$pkgname-libs" +makedepends=" + cmake + py3-setuptools + python3-dev + samurai + swig + " +subpackages=" + $pkgname-data::noarch + $pkgname-libs + $pkgname-dev + py3-$pkgname:py3 + " +source=" + $pkgname-$pkgver.tar.gz::https://github.com/rism-digital/verovio/archive/refs/tags/version-$pkgver.tar.gz + 0001-data-change-directory-to-usr-share-verovio.patch + fix-c-wrapper.patch + install-prefix.patch + commit-version.patch + python-data-path.patch + " +builddir="$srcdir/$pkgname-version-$pkgver" + +prepare() { + default_prepare + + sed -i "s|@@COMMIT@@|$_commit|" tools/get_git_commit.sh +} + +build() { + cmake -B build-tools -G Ninja \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -S cmake + + cmake -B build-c-bindings -G Ninja \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=MinSizeRel \ + -DBUILD_AS_LIBRARY=ON \ + -S cmake + + cmake --build build-tools + cmake --build build-c-bindings + python3 setup.py build_ext +} + +check() { + ( + cd build-tools + ./verovio -r ../data ../doc/importer.mei + ) + + ( + cp bindings/c/main.c build-c-bindings/main.c + # include is only one level up now + sed -i 's|/../|/|' build-c-bindings/main.c + cd build-c-bindings + gcc main.c -o main -L./ $CFLAGS -lverovio + LD_LIBRARY_PATH=./ ./main + ) +} + +package() { + depends="$pkgname-data" + DESTDIR="$pkgdir" cmake --install build-tools + DESTDIR="$pkgdir" cmake --install build-c-bindings + python3 setup.py install --root="$pkgdir" + + install -Dm644 tools/c_wrapper.h -t "$pkgdir"/usr/include/verovio + install -Dm644 fonts/VerovioText-1.0.ttf -t "$pkgdir"/usr/share/fonts/verovio/ +} + +data() { + pkgdesc="$pkgdesc (data)" + depends="font-times" + + amove usr/share/verovio + amove usr/share/fonts +} + +libs() { + default_libs + depends="$pkgname-data" + + # no versions for now + amove usr/lib/libverovio.so +} + +py3() { + pkgdesc="$pkgdesc (python module)" + depends="$pkgname-data" + + amove usr/lib/python3.* + # data is already in -data + rm -rf "$subpkgdir"/usr/lib/python3.*/site-packages/verovio/data + # this should not be installed + rm -f "$subpkgdir"/usr/lib/python3.*/site-packages/verovio/setup.py + rm -f "$subpkgdir"/usr/lib/python3.*/site-packages/verovio/__pycache__/setup.cpython-*.pyc +} + +sha512sums=" +eb691e7c0fb87b954c0bae716a7ab8968db765c374b81fe321d9cea18676c9d335f2e70586cd82b32f92b90c3cd61482ab8cdf27c217cc8579a56db6be9fc051 verovio-3.10.0.tar.gz +89f0d0f797910462ceb1043dee210e74fc00a6c309ef0637173a018224967def5eb1f66c30bfd7499040ccc2f67015d0ec2b37e9e8edc2a5c26c4865ba8c07df 0001-data-change-directory-to-usr-share-verovio.patch +87dd5763a4cdf61dec179659173a1fb207f55f5428ae429f4a5bbe59a997097c5ebc7ca19389974138b446f9837c9a6114625e0869b224fbe6af13a2dfe63c87 fix-c-wrapper.patch +22cf4be4ddd55231980d8cf4740f1152273800811fd78ecc2c82b3ea228b7406d4186a28780146111242c1dc53bfff0e2e264b624ae5871802242bd5ec86eae7 install-prefix.patch +8438687d6b707c08e53fc87598ad74412b530139008bbbd7c4300f83104d2481ebe00923c1681d762445e9eb3c307b0c087c89ab49e2d60b22d7a31ce313063a commit-version.patch +f62560a8a28d13d25e78a1b33c20a7e69662002c30767853e24ca6268775b3ff48792034803f39b5a9398a46f6ff9b18fbc09a5bef9d38539eeebeefaeb0cdc3 python-data-path.patch +" diff --git a/testing/verovio/commit-version.patch b/testing/verovio/commit-version.patch new file mode 100644 index 000000000000..ea10433d2893 --- /dev/null +++ b/testing/verovio/commit-version.patch @@ -0,0 +1,12 @@ +instead of getting aports git, give them the actual commit sha in prepare +--- a/tools/get_git_commit.sh ++++ b/tools/get_git_commit.sh +@@ -2,7 +2,7 @@ + + cd .. + output="./include/vrv/git_commit.h" +-COMMIT=$(git describe --abbrev=7 --always --dirty) ++COMMIT="@@COMMIT@@" + + if [ -z "$COMMIT" ]; then + echo "Undefined git commit version" diff --git a/testing/verovio/fix-c-wrapper.patch b/testing/verovio/fix-c-wrapper.patch new file mode 100644 index 000000000000..803945a92293 --- /dev/null +++ b/testing/verovio/fix-c-wrapper.patch @@ -0,0 +1,38 @@ +Patch-Source: https://github.com/rism-digital/verovio/pull/2911 +From a2b287c28fc120e682fceb71c8fd46cd617a2f2f Mon Sep 17 00:00:00 2001 +From: Zach DeCook <zachdecook@librem.one> +Date: Fri, 3 Jun 2022 12:52:42 -0400 +Subject: [PATCH] c wrapper: Remove default values as they aren't supported by + C + +See discussion at https://github.com/rism-digital/verovio/commit/c6cfec6b00eb025e8a502209f79cd30301ab2214#r75216422 +--- + tools/c_wrapper.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/c_wrapper.h b/tools/c_wrapper.h +index 318ece6423..67dc65bd87 100644 +--- a/tools/c_wrapper.h ++++ b/tools/c_wrapper.h +@@ -28,7 +28,7 @@ const char *vrvToolkit_convertHumdrumToHumdrum(void *tkPtr, const char *humdrumD + const char *vrvToolkit_convertHumdrumToMIDI(void *tkPtr, const char *humdrumData); + const char *vrvToolkit_convertMEIToHumdrum(void *tkPtr, const char *meiData); + const char *vrvToolkit_getLog(void *tkPtr); +-const char *vrvToolkit_getMEI(void *tkPtr, const char *options = ""); ++const char *vrvToolkit_getMEI(void *tkPtr, const char *options); + const char *vrvToolkit_getMIDIValuesForElement(void *tkPtr, const char *xmlId); + const char *vrvToolkit_getNotatedIdForElement(void *tkPtr, const char *xmlId); + const char *vrvToolkit_getOptions(void *tkPtr, bool default_values); +@@ -41,9 +41,9 @@ bool vrvToolkit_loadZipDataBase64(void *tkPtr, const char *data); + bool vrvToolkit_loadZipDataBuffer(void *tkPtr, const unsigned char *data, int length); + const char *vrvToolkit_renderToMIDI(void *tkPtr, const char *c_options); + const char *vrvToolkit_renderToPAE(void *tkPtr); +-const char *vrvToolkit_renderToSVG(void *tkPtr, int page_no = 1, bool xmlDeclaration = false); +-const char *vrvToolkit_renderToTimemap(void *tkPtr, const char *c_options = ""); +-void vrvToolkit_redoLayout(void *tkPtr, const char *c_options = ""); ++const char *vrvToolkit_renderToSVG(void *tkPtr, int page_no, bool xmlDeclaration); ++const char *vrvToolkit_renderToTimemap(void *tkPtr, const char *c_options); ++void vrvToolkit_redoLayout(void *tkPtr, const char *c_options); + void vrvToolkit_redoPagePitchPosLayout(void *tkPtr); + const char *vrvToolkit_renderData(void *tkPtr, const char *data, const char *options); + void vrvToolkit_resetOptions(void *tkPtr); diff --git a/testing/verovio/install-prefix.patch b/testing/verovio/install-prefix.patch new file mode 100644 index 000000000000..512708c116d8 --- /dev/null +++ b/testing/verovio/install-prefix.patch @@ -0,0 +1,12 @@ +install to the correct binary dir +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -236,7 +236,7 @@ + + install( + TARGETS verovio +- DESTINATION /usr/local/bin ++ DESTINATION "${CMAKE_INSTALL_BINDIR}" + ) + install( + DIRECTORY ../data/ diff --git a/testing/verovio/python-data-path.patch b/testing/verovio/python-data-path.patch new file mode 100644 index 000000000000..17b3b5ca8440 --- /dev/null +++ b/testing/verovio/python-data-path.patch @@ -0,0 +1,11 @@ +don't depend on py3-setuptools, and also import the system data dir +--- a/bindings/python/__init__.py ++++ b/bindings/python/__init__.py +@@ -1,5 +1,3 @@ +-from pkg_resources import resource_filename +- + from .verovio import * + +-verovio.setDefaultResourcePath(resource_filename('verovio', 'data')) +\ No newline at end of file ++verovio.setDefaultResourcePath('/usr/share/verovio') -- GitLab