On 2019-10-26 8:37 AM, Klemens Nanni wrote:
On Brad's recent update I reran `make update-patches' to double check
after building and it picked up the version substitution.

That seems dirty and error prone, one might accidentially commit stuff
like this on updates.

Instead, use SUBST_VARS and avoid splitting the version again by using
proper LMAJ and LMIN variables in the first place.

Feedback?
OK?


This dirtiness is my fault; I needed libmpv shared lib for a new port that I haven't gotten around to submitting yet.


Anything that prevents the substitutions from getting picked up by update-patches and accidentally committed sounds good to me.


~Brian



Index: Makefile
===================================================================
RCS file: /cvs/ports/multimedia/mpv/Makefile,v
retrieving revision 1.51
diff -u -p -r1.51 Makefile
--- Makefile    26 Oct 2019 12:03:20 -0000      1.51
+++ Makefile    26 Oct 2019 12:34:50 -0000
@@ -6,7 +6,10 @@ GH_ACCOUNT =           mpv-player
  GH_PROJECT =          mpv
  GH_TAGNAME =          v0.30.0
-SHARED_LIBS += mpv 0.1 # 1.106
+LMAJ =                 0
+LMIN =                 1
+
+SHARED_LIBS +=         mpv             ${LMAJ}.${LMIN} # 1.106
CATEGORIES = multimedia x11 @@ -108,13 +111,14 @@ CFLAGS += -march=i586
  DO_WAF =              cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MODPY_BIN} \
                                ${WAF} ${MAKE_FLAGS}
+SUBST_VARS += LMAJ \
+                       LMIN
+
  post-patch:
        cp ${DISTDIR}/${WAF:T} ${WAF}
+       ${SUBST_CMD} ${WRKSRC}/libmpv/client.h
do-configure:
-       sed -i -e "s,LMAJ,${LIBmpv_VERSION:R},g" \
-               -e "s,LMIN,${LIBmpv_VERSION:E},g" \
-                       ${WRKSRC}/libmpv/client.h
        ${DO_WAF} configure ${CONFIGURE_ARGS}
do-build:
Index: patches/patch-libmpv_client_h
===================================================================
RCS file: /cvs/ports/multimedia/mpv/patches/patch-libmpv_client_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-libmpv_client_h
--- patches/patch-libmpv_client_h       26 Oct 2019 12:03:20 -0000      1.2
+++ patches/patch-libmpv_client_h       26 Oct 2019 12:34:50 -0000
@@ -1,6 +1,6 @@
  $OpenBSD: patch-libmpv_client_h,v 1.2 2019/10/26 12:03:20 kn Exp $
-Could not find an easy way to do this.
+Set shared library version.
Index: libmpv/client.h
  --- libmpv/client.h.orig
@@ -10,7 +10,7 @@ Index: libmpv/client.h
    */
   #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
  -#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 106)
-+#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(LMAJ, LMIN)
++#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(${LMAJ}, ${LMIN})
/**
    * The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before


Reply via email to