Sebastien Marie <sema...@kapouay.eu.org> writes:

> Hi,
>
> So I wrote a module for
> managing dependencies via sysutils/opam (lang/haxe work by thfr@ was
> also a reason for it).

Below is lang/haxe converted to use sysutils/opam (tarball attached, and
diff from your previous work). I tried to limit the change to
sysutils/opam usage.

Please note that I am not pushing lang/haxe to use (new and hypothetic)
sysutils/opam module. It was mostly an exercice for me to see how the
module would copte with lang/haxe. So comments would be helpful.


To be noticed:
- the patching of luv-0.5.12 is explicit. the upstream tarball is
  fetched and patched by ports infrastructure

- sysutils/opam added to MODULES

- pre-build dance is replaced by CONFIGURE_STYLE += opam

- the opam repository used for dependencies resolution is 
      MODOPAM_REPO_COMMIT =     e25af452e64b0bd6672dce5f38d878780362341d
      MODOPAM_REPO_NAME =       haxe-opam-${V}

  MODOPAM_REPO_COMMIT is mostly cosmetic (it could be removed), but
  ensure reproductibility across "make modopam-repository" usages.

  MODOPAM_REPO_NAME is used for the directory name. I kept the same as
  original diff (with tar.bz2 in distfiles).

- the size of the tarball of opam repository vs opamroot is 37Mo -> 8 Mo

- the opamroot helper is replaced by "modopam-repository" target from
  the module.

- "opam install" time is lot more quick to start. it is due that opam
  repository is a stripped version (to only contains the required
  dependencies). so opam took almost no time to resolve the dependency
  chain and decide which version to build and in which order.


diff --git a/lang/haxe/Makefile b/lang/haxe/Makefile
index cd62211d81..22b23739a8 100644
--- a/lang/haxe/Makefile
+++ b/lang/haxe/Makefile
@@ -9,8 +9,12 @@
                f1f18201e5c0479cb5adf5f6028788b37f37b730 \
                extra/haxelib_src/hx3compat #MIT
 
+LUV_V =                0.5.12
+SITES.luv =    https://github.com/aantron/luv/releases/download/${LUV_V}/
+DISTFILES.luv =        luv-${LUV_V}.tar.gz
+
 SITES.opamroot =       https://thfr.info/distfiles/
-DISTFILES.opamroot =   haxe-opamroot-${V}.tar.bz2
+DISTFILES.opamroot =   haxe-opam-${V}.tar.bz2
 
 CATEGORIES =   lang devel
 HOMEPAGE =     https://haxe.org
@@ -22,7 +26,8 @@
 
 WANTLIB += c m mbedcrypto mbedtls mbedx509 neko pcre2-8 pthread uv z
 
-MODULES =              lang/ocaml
+MODULES =              lang/ocaml \
+                       sysutils/opam
 
 BUILD_DEPENDS =                devel/dune \
                        devel/p5-IPC-System-Simple \
@@ -37,37 +42,19 @@
                        lang/nekovm \
                        security/polarssl
 
-MAKE_ENV +=            OPAMROOT=${WRKDIR}/opamroot
 USE_GMAKE =            Yes
 
 CFLAGS +=              -I${LOCALBASE}/include \
                        -L${LOCALBASE}/lib
 
-pre-build:
-       env OPAMROOT=${WRKDIR}/opamroot opam pin add haxe ${WRKSRC} \
-               --kind=path --no-action
-       env OPAMROOT=${WRKDIR}/opamroot opam pin add luv.0.5.12 \
-               ${WRKDIR}/opamroot/default/.opam-switch/sources/luv.0.5.12 \
-               --kind=path --no-action
-       env OPAMROOT=${WRKDIR}/opamroot LUV_USE_SYSTEM_LIBUV=yes opam \
-               install --deps-only --yes --inplace-build -v haxe
-
-# opamroot-helper:
-#      Helper target to get initial ocaml dependencies and package in
-#      /tmp/haxe-opamroot-${V}.tar.bz2. May need to add additional missing
-#      packages. See `$ opam help install` for syntax. Any patched opam
-#      packages need to be pinned to their source directory, otherwise they
-#      will be overwritten (see `$ opam help pin`).
-#      Needs opam and bzip2; run after `make patch`. Press `5` when prompted
-#      to skip adjusting ~/.profile.
-
-opamroot-helper:
-       mkdir /tmp/opamroot
-       env OPAMROOT=/tmp/opamroot opam init
-       env OPAMROOT=/tmp/opamroot opam pin add haxe ${WRKSRC} \
-               --kind=path --no-action
-       OPAMROOT=/tmp/opamroot opam install haxe --deps-only \
-               --download-only --recursive --verbose
-       tar jcf /tmp/haxe-opamroot-${V}.tar.bz2 -C /tmp opamroot
+MODOPAM_REPO_COMMIT =  e25af452e64b0bd6672dce5f38d878780362341d
+MODOPAM_REPO_NAME =    haxe-opam-${V}
+
+CONFIGURE_STYLE +=     opam
+
+MAKE_ENV +=            LUV_USE_SYSTEM_LIBUV=yes
+
+post-extract:
+       mv ${WRKDIR}/luv-${LUV_V}/ ${WRKSRC}
 
 .include <bsd.port.mk>
diff --git a/lang/haxe/distinfo b/lang/haxe/distinfo
index 3c3406d35c..e967f19460 100644
--- a/lang/haxe/distinfo
+++ b/lang/haxe/distinfo
@@ -1,8 +1,10 @@
 SHA256 (HaxeFoundation-haxe-4.3.6.tar.gz) = 
0WkLbQQxKl+yBdksqi9IyWDLfwhKGCVN7kIic+vWrac=
 SHA256 
(HaxeFoundation-haxelib-f17fffa97554b1bdba37750e3418051f017a5bc2.tar.gz) = 
sGk8vw0KpX7/3VaqdZeS4BSFn4Q8o9Kkq8jxnYo2yb4=
-SHA256 (haxe-opamroot-4.3.6.tar.bz2) = 
XuN6dbrQ9pmrVb4TPhcsfViSwyzUx/ts1zC6J1TfW00=
+SHA256 (haxe-opam-4.3.6.tar.bz2) = S38y/GyxXcIaRvJKonCZdPGHT66jqpf5k5S+5fYEn6Y=
 SHA256 
(haxefoundation-hx3compat-f1f18201e5c0479cb5adf5f6028788b37f37b730.tar.gz) = 
0QDeX2BsGFMDce7YOrrMHCCCZtslz+L6w4d0MDU6by4=
+SHA256 (luv-0.5.12.tar.gz) = dp9qCIYqSdROIAQ+Jw73F3vMe7hnkDe8BgZWImNMVsA=
 SIZE (HaxeFoundation-haxe-4.3.6.tar.gz) = 8027390
 SIZE (HaxeFoundation-haxelib-f17fffa97554b1bdba37750e3418051f017a5bc2.tar.gz) 
= 365126
-SIZE (haxe-opamroot-4.3.6.tar.bz2) = 36884113
+SIZE (haxe-opam-4.3.6.tar.bz2) = 8158746
 SIZE 
(haxefoundation-hx3compat-f1f18201e5c0479cb5adf5f6028788b37f37b730.tar.gz) = 
26695
+SIZE (luv-0.5.12.tar.gz) = 817528
diff --git 
a/lang/haxe/patches/patch-luv-0_5_12_src_c_luv_c_type_descriptions_ml 
b/lang/haxe/patches/patch-luv-0_5_12_src_c_luv_c_type_descriptions_ml
new file mode 100644
index 0000000000..61b4484b53
--- /dev/null
+++ b/lang/haxe/patches/patch-luv-0_5_12_src_c_luv_c_type_descriptions_ml
@@ -0,0 +1,14 @@
+Index: luv-0.5.12/src/c/luv_c_type_descriptions.ml
+--- luv-0.5.12/src/c/luv_c_type_descriptions.ml.orig
++++ luv-0.5.12/src/c/luv_c_type_descriptions.ml
+@@ -736,8 +736,8 @@ struct
+         let canonname = constant "AI_CANONNAME" int
+         let numerichost = constant "AI_NUMERICHOST" int
+         let numericserv = constant "AI_NUMERICSERV" int
+-        let v4mapped = constant "AI_V4MAPPED" int
+-        let all = constant "AI_ALL" int
++        let v4mapped = constant "0" int
++        let all = constant "0" int
+         let addrconfig = constant "AI_ADDRCONFIG" int
+       end
+     end


Regards.
-- 
Sebastien Marie

Attachment: haxe.tgz
Description: Binary data

Reply via email to