aboutsummaryrefslogtreecommitdiffstats
path: root/community/mtex2mml
diff options
context:
space:
mode:
Diffstat (limited to 'community/mtex2mml')
-rw-r--r--community/mtex2mml/APKBUILD63
-rw-r--r--community/mtex2mml/cmake-fix-install.patch51
-rw-r--r--community/mtex2mml/fix-uthash-includes.patch102
3 files changed, 216 insertions, 0 deletions
diff --git a/community/mtex2mml/APKBUILD b/community/mtex2mml/APKBUILD
new file mode 100644
index 0000000000..c2fe141182
--- /dev/null
+++ b/community/mtex2mml/APKBUILD
@@ -0,0 +1,63 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=mtex2mml
+_pkgname=mtex2MML
+pkgver=1.3.1
+pkgrel=1
+pkgdesc="A Bison grammar to convert TeX math into MathML"
+url="https://github.com/gjtorikian/mtex2MML"
+arch="all"
+license="GPL2 MPL2 LGPL2.1"
+makedepends="cmake bison flex-dev python3"
+subpackages="$pkgname-dev $pkgname-libs $pkgname-fixtures::noarch"
+source="$pkgname-$pkgver.tar.gz::https://github.com/gjtorikian/$pkgname/archive/v$pkgver.tar.gz
+ cmake-fix-install.patch
+ fix-uthash-includes.patch"
+builddir="$srcdir/$_pkgname-$pkgver"
+
+prepare() {
+ default_prepare
+
+ # Note: This bundled uthash is modified, so we can't replace it with
+ # system-provided. Thus we must move them to the other sources, where
+ # they really belongs.
+ # Upstream-Issue: https://github.com/gjtorikian/mtex2MML/issues/59
+ cd deps/uthash
+ mv utarray.h uthash.h utstring.h ../../src/
+ rm *.h
+}
+
+build() {
+ mkdir -p "$builddir"/build
+ cd "$builddir"/build
+
+ cmake .. \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
+ -DCMAKE_C_FLAGS="$CFLAGS" \
+ -DCMAKE_VERBOSE_MAKEFILE=TRUE
+ make
+}
+
+check() {
+ cd "$builddir"/build
+ ctest -V
+}
+
+package() {
+ cd "$builddir"/build
+ make DESTDIR="$pkgdir" install
+}
+
+fixtures() {
+ pkgdesc="$pkgdesc (test fixtures)"
+ local destdir="$subpkgdir/usr/share/$_pkgname"
+
+ mkdir -p "$destdir"
+ mv "$builddir"/tests/fixtures "$destdir"/
+}
+
+sha512sums="584a02d8312233a08d527973ddca7d5d26429cd4d97e0a5db671d90ac1e9f2587746b38fbdb69366ed6e1f38a706335309a3fc04c10aa93658a7b773cc752fed mtex2mml-1.3.1.tar.gz
+54c8da2a63d4b2e9f5bccdcbc8130399c0772badda41f62dfb8ef91c10681e477e291b71fce95dda80f0c5b57277d5a94c597fe515b94eeb1c9178a587bcc3ff cmake-fix-install.patch
+1754951f71e085fd8c2e6cebf6c5cd07604c671b9ac027fc2cbc16be891ffcf433ba48135e08e51479fac1cf3b129de85929cef8151e776e9b50ed4be8728b3c fix-uthash-includes.patch"
diff --git a/community/mtex2mml/cmake-fix-install.patch b/community/mtex2mml/cmake-fix-install.patch
new file mode 100644
index 0000000000..48e59abf6a
--- /dev/null
+++ b/community/mtex2mml/cmake-fix-install.patch
@@ -0,0 +1,51 @@
+From 5169eaf0eefd635f18a04e4d403e6beb97c5b679 Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Fri, 24 Mar 2017 20:39:23 +0100
+Subject: [PATCH] Fix cmake rules to install executable, libraries and headers
+
+I should note that I don't have much experience with CMake, so I'm not
+sure if this solution is _correct_. However, it works as expected.
+
+Fixes #58
+
+Upstream-Issue: https://github.com/gjtorikian/mtex2MML/pull/60
+---
+ CMakeLists.txt | 7 ++++++-
+ src/libmtex2MML.pc.in | 2 +-
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a19eab4..f4d6bcc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -42,7 +42,7 @@ set(MTEX2MML_VERSION_STRING "${MTEX2MML_VERSION_MAJOR}.${MTEX2MML_VERSION_MINOR}
+ #
+ set(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
+ set(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
+-set(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.")
++set(INCLUDE_INSTALL_DIR include/${PROJECT_NAME} CACHE PATH "Where to install headers to.")
+
+ #
+ #
+@@ -107,6 +107,11 @@ add_library(${STATICLIBRARY} STATIC
+ )
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libmtex2MML.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/libmtex2MML.pc @ONLY)
++
++install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${BIN_INSTALL_DIR})
++install(TARGETS ${LIBRARY} LIBRARY DESTINATION ${LIB_INSTALL_DIR})
++install(TARGETS ${STATICLIBRARY} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
++install(FILES ${SRC_H} DESTINATION ${INCLUDE_INSTALL_DIR})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmtex2MML.pc
+ DESTINATION lib/pkgconfig)
+
+diff --git a/src/libmtex2MML.pc.in b/src/libmtex2MML.pc.in
+index 0bc2557..b49c75f 100644
+--- a/src/libmtex2MML.pc.in
++++ b/src/libmtex2MML.pc.in
+@@ -7,4 +7,4 @@ Name: libmtex2MML
+ Description: A Bison grammar to convert TeX math into MathML.
+ Version: @PROJECT_VERSION@
+ Libs: -L${libdir} -lmtex2MML
+-Cflags: -I${includedir}
++Cflags: -I${includedir}/mtex2MML
diff --git a/community/mtex2mml/fix-uthash-includes.patch b/community/mtex2mml/fix-uthash-includes.patch
new file mode 100644
index 0000000000..b17649df50
--- /dev/null
+++ b/community/mtex2mml/fix-uthash-includes.patch
@@ -0,0 +1,102 @@
+--- a/src/colors.h
++++ a/src/colors.h
+@@ -1,7 +1,7 @@
+ #ifndef COLORS_H
+ #define COLORS_H
+
+-#include "../deps/uthash/uthash.h"
++#include "uthash.h"
+
+ #ifdef __cplusplus
+ extern "C" {
+--- a/src/em.c
++++ a/src/em.c
+@@ -2,7 +2,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include "string_dup.h"
+-#include "../deps/uthash/utstring.h"
++#include "utstring.h"
+
+ float mtex2MML_extract_number_from_pxstring(char * str)
+ {
+--- a/src/environment.h
++++ a/src/environment.h
+@@ -1,8 +1,8 @@
+ #ifndef ENVIRONMENT_H
+ #define ENVIRONMENT_H
+
+-#include "../deps/uthash/uthash.h"
+-#include "../deps/uthash/utarray.h"
++#include "uthash.h"
++#include "utarray.h"
+
+ #ifdef __cplusplus
+ extern "C" {
+--- a/src/main.c
++++ a/src/main.c
+@@ -1,7 +1,7 @@
+ #include <string.h>
+ #include <stdio.h>
+ #include "mtex2MML.h"
+-#include "../deps/uthash/utstring.h"
++#include "utstring.h"
+
+ int main (int argc, char ** argv)
+ {
+--- a/src/parser.y
++++ a/src/parser.y
+@@ -13,7 +13,7 @@
+ #include "string_extras.h"
+
+ #include "string_dup.h"
+-#include "../deps/uthash/uthash.h"
++#include "uthash.h"
+
+ struct css_colors *colors = NULL;
+
+--- a/src/string_extras.h
++++ a/src/string_extras.h
+@@ -3,7 +3,7 @@
+ #ifndef STRING_EXTRAS_H
+ #define STRING_EXTRAS_H
+
+-#include "../deps/uthash/utstring.h"
++#include "utstring.h"
+
+ /* all for str_replace */
+ #include <stdio.h>
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -56,8 +56,8 @@
+ # Find required dependencies
+ #
+ #
+-include_directories(src deps ${CMAKE_CURRENT_BINARY_DIR})
++include_directories(src ${CMAKE_CURRENT_BINARY_DIR})
+
+ find_package(BISON REQUIRED)
+ find_package(FLEX REQUIRED)
+ find_library(M_LIB m) # only necessary for true *nix systems
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -80,7 +80,7 @@
+ #
+
+ # Collect sourcefiles, exclude main.c from libraries
+-file(GLOB SRC_H ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h deps/uthash/*.h)
++file(GLOB SRC_H ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
+ file(GLOB SRC_MTEX2MML ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c)
+ list(REMOVE_ITEM SRC_MTEX2MML "${CMAKE_CURRENT_SOURCE_DIR}/src/main.c")
+
+--- a/deps/uthash/utarray.h
++++ b/deps/uthash/utarray.h
+@@ -37,7 +37,7 @@
+ #include <stddef.h> /* size_t */
+ #include <string.h> /* memset, etc */
+ #include <stdlib.h> /* exit */
+-#include "../../src/string_dup.h"
++#include "string_dup.h"
+
+ #ifndef oom
+ #define oom() exit(-1)