On 8/5/19 1:43 PM, Stuart Henderson wrote:
On 2019/08/05 13:40, Brian Callahan wrote:
Hi ports --

I would like to start building the libmpv shared library and install it and
the headers alongside the mpv binary. I need it for an upcoming port.

The build system is horrendous; this is the only way I could get it to
create a shared library with the right major/minor numbers.

OK?

~Brian

Index: Makefile
===================================================================
RCS file: /cvs/ports/multimedia/mpv/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- Makefile    14 Jul 2019 00:39:38 -0000      1.48
+++ Makefile    5 Aug 2019 16:54:02 -0000
@@ -6,7 +6,9 @@ GH_ACCOUNT =            mpv-player
  GH_PROJECT =          mpv
  GH_TAGNAME =          v0.29.1
-REVISION = 0
+REVISION =             1
+
+SHARED_LIBS += mpv                       0.0 # 1.101
CATEGORIES = multimedia x11 @@ -60,6 +62,7 @@ CONFIGURE_ARGS = --confloaddir=${SYSCONF
                        --enable-cdda \
                        --enable-dvdnav \
                        --enable-dvdread \
+                       --enable-libmpv-shared \
                        --enable-sndio \
                        --enable-sdl2 \
                        --enable-tv \
Index: patches/patch-libmpv_client_h
===================================================================
RCS file: patches/patch-libmpv_client_h
diff -N patches/patch-libmpv_client_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-libmpv_client_h       5 Aug 2019 16:54:02 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Could not find an easy way to do this.
+Must sync with LIBmpv_VERSION.
+
+Index: libmpv/client.h
+--- libmpv/client.h.orig
++++ libmpv/client.h
+@@ -210,7 +210,7 @@ extern "C" {
+  * relational operators (<, >, <=, >=).
+  */
+ #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
+-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 101)
++#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(0, 0)
NAK, it must be under control of the port. Use a placeholder and have it
do a subst of some kind.

Alright. Couldn't get SUBST_CMD to work, so used plain old sed.

~Brian

+ /**
+  * The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/multimedia/mpv/pkg/PLIST,v
retrieving revision 1.6
diff -u -p -r1.6 PLIST
--- pkg/PLIST   29 Jun 2018 22:16:18 -0000      1.6
+++ pkg/PLIST   5 Aug 2019 16:54:02 -0000
@@ -1,5 +1,14 @@
  @comment $OpenBSD: PLIST,v 1.6 2018/06/29 22:16:18 espie Exp $
  @bin bin/mpv
+include/mpv/
+include/mpv/client.h
+include/mpv/opengl_cb.h
+include/mpv/qthelper.hpp
+include/mpv/render.h
+include/mpv/render_gl.h
+include/mpv/stream_cb.h
+@lib lib/libmpv.so.${LIBmpv_VERSION}
+lib/pkgconfig/mpv.pc
  @man man/man1/mpv.1
  share/applications/mpv.desktop
  share/examples/mpv/

Index: Makefile
===================================================================
RCS file: /cvs/ports/multimedia/mpv/Makefile,v
retrieving revision 1.48
diff -u -p -r1.48 Makefile
--- Makefile	14 Jul 2019 00:39:38 -0000	1.48
+++ Makefile	5 Aug 2019 18:17:50 -0000
@@ -6,7 +6,9 @@ GH_ACCOUNT =		mpv-player
 GH_PROJECT =		mpv
 GH_TAGNAME =		v0.29.1
 
-REVISION =		0
+REVISION =		1
+
+SHARED_LIBS +=	mpv                       0.0 # 1.101
 
 CATEGORIES =		multimedia x11
 
@@ -60,6 +62,7 @@ CONFIGURE_ARGS =	--confloaddir=${SYSCONF
 			--enable-cdda \
 			--enable-dvdnav \
 			--enable-dvdread \
+			--enable-libmpv-shared \
 			--enable-sndio \
 			--enable-sdl2 \
 			--enable-tv \
@@ -110,6 +113,9 @@ post-patch:
 	cp ${DISTDIR}/${WAF:T} ${WAF}
 
 do-configure:
+	sed -i -e "s,LMAJ,`echo ${LIBmpv_VERSION} | cut -f 1 -d .`,g" \
+		-e "s,LMIN,`echo ${LIBmpv_VERSION} | cut -f 2 -d .`,g" \
+			${WRKSRC}/libmpv/client.h
 	${DO_WAF} configure ${CONFIGURE_ARGS}
 
 do-build:
Index: patches/patch-libmpv_client_h
===================================================================
RCS file: patches/patch-libmpv_client_h
diff -N patches/patch-libmpv_client_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-libmpv_client_h	5 Aug 2019 18:17:50 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Could not find an easy way to do this.
+
+Index: libmpv/client.h
+--- libmpv/client.h.orig
++++ libmpv/client.h
+@@ -210,7 +210,7 @@ extern "C" {
+  * relational operators (<, >, <=, >=).
+  */
+ #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
+-#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 101)
++#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(LMAJ, LMIN)
+ 
+ /**
+  * The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/multimedia/mpv/pkg/PLIST,v
retrieving revision 1.6
diff -u -p -r1.6 PLIST
--- pkg/PLIST	29 Jun 2018 22:16:18 -0000	1.6
+++ pkg/PLIST	5 Aug 2019 18:17:50 -0000
@@ -1,5 +1,14 @@
 @comment $OpenBSD: PLIST,v 1.6 2018/06/29 22:16:18 espie Exp $
 @bin bin/mpv
+include/mpv/
+include/mpv/client.h
+include/mpv/opengl_cb.h
+include/mpv/qthelper.hpp
+include/mpv/render.h
+include/mpv/render_gl.h
+include/mpv/stream_cb.h
+@lib lib/libmpv.so.${LIBmpv_VERSION}
+lib/pkgconfig/mpv.pc
 @man man/man1/mpv.1
 share/applications/mpv.desktop
 share/examples/mpv/

Reply via email to