Re: WIP: update radare2 and move cutter to iaito

2022-08-03 Thread Edd Barrett
Hi,

On Mon, Aug 01, 2022 at 10:20:28PM +0100, Edd Barrett wrote:
>  - I've undoubtedly done something daft, but during `pkg_add -u`, why doesn't
>cutter get replaced by iaito? The @pkgpath marker is present and since the
>iaito version number is smaller than the cutter version number, I also
>bumped EPOCH (right?)... What have I missed?

sthen@ pointed out that the quirk was missing, but that it would probably make
more sense (instead of having iaito replace cutter) to mark cutter obsolete for
now.

Tested this:

```
ports# pkg_info | grep -E 'radare|cutter' 
cutter-1.12.0p1 RE platform powered by radare2
radare2-4.5.1   libre and portable reverse engineering framework
ports# PKG_PATH=`pwd` pkg_add -Dunsigned -u
quirks-6.12->6.13: ok
radare2-4.5.1->5.7.6: ok
Read shared items: ok
Obsolete package: cutter-1.12.0p1 (use iaito instead (until we have a rizin 
package that cutter can use))
```

How do we feel about the double bracketing there? Maybe it's better as:

```
Obsolete package: cutter-1.12.0p1 (use iaito until we have a rizin package that 
cutter can use)
```

Thoughts?
 
>  - After this change, the devel/cutter port will be orphaned. Should we mark 
> it
>BROKEN until we have rizin, or just kill it?

As sthen@ also suggested, I've marked it BROKEN and added a comment reminding
us that we have a quirk marking it obsolete.

>  - jasper@, do you still want to be MAINTAINER of the gui?

For now I've left jasper@ MAINTAINER on devel/cutter, and left devel/iaito with
no MAINTAINER.

New tarball for iaito attached. Diff below is the remainder of the necessary
changes.

Thank you Stuart for you input.

OK?


Index: devel/radare2/main/Makefile
===
RCS file: /cvs/ports/devel/radare2/main/Makefile,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile
--- devel/radare2/main/Makefile 11 Mar 2022 18:53:08 -  1.26
+++ devel/radare2/main/Makefile 3 Aug 2022 08:10:07 -
@@ -1,23 +1,23 @@
 COMMENT =  libre and portable reverse engineering framework
 
-V =4.5.1
+V =5.7.6
 SUBST_VARS +=  V
 
 GH_PROJECT =   radare2
 GH_TAGNAME =   ${V}
 
-# When updating, use the output from the command below to set
-# the extra distfiles so as not to invoke clone_3rd_repo.sh during build:
-# grep -E '^TS_TIP' ${WRKSRC}/shlr/Makefile
-TREESITTER_COMMIT =86a5dabb
-MASTER_SITES0 =
https://github.com/tree-sitter/tree-sitter/archive/
-
-MASTER_SITES = https://distfiles.sigtrap.nl/
+# When updating, grep the sources for `ARCH_ARM64_COMMIT` and
+# `ARCH_ARM7_COMMIT`.
+VECTOR35_ARM64_COMMIT =9ab2b0be
+VECTOR35_ARMV7_COMMIT =dde39f69
+MASTER_SITES0 =
https://github.com/radareorg/vector35-arch-arm64/archive/
+MASTER_SITES1 =
https://github.com/radareorg/vector35-arch-armv7/archive/
 DISTFILES =${DISTNAME}${EXTRACT_SUFX} \
-   treesitter-{}${TREESITTER_COMMIT}.tar.gz:0
+   vector35-arch-arm64-{}${VECTOR35_ARM64_COMMIT}.tar.gz:0 
\
+   vector35-arch-armv7-{}${VECTOR35_ARMV7_COMMIT}.tar.gz:1
 
-# In radare, all libs have the same version
-LIBV = 8.0 # 4.4.0
+# In radare, all libs have the same version.
+LIBV = 9.0 # Upstream lib versions same as ${V}.
 .for _lib in r_anal r_asm r_bin r_bp r_config r_cons r_core \
r_crypto r_debug r_egg r_flag r_fs r_hash r_io r_lang \
r_main r_magic r_parse r_reg r_search r_socket \
@@ -26,7 +26,7 @@ SHARED_LIBS+= ${_lib} ${LIBV}
 .endfor
 
 # uses pledge()
-WANTLIB =  c capstone crypto kvm m pthread ssl util uv z zip
+WANTLIB =  c capstone crypto kvm m pthread ssl uv z zip
 
 DEBUG_PACKAGES =   ${BUILD_PACKAGES}
 
@@ -42,16 +42,22 @@ CONFIGURE_ARGS +=   --mandir=${PREFIX}/man
--with-syszip
 
 CONFIGURE_ENV +=   LDFLAGS="-L${LOCALBASE}/lib"
-MAKE_ENV = HOST_CC="${CC}"
+MAKE_ENV = HOST_CC="${CC}" HOST_CFLAGS="${CFLAGS}"
 
-# Requires downloading a number of test binaries
+# Requires network to download a number of test binaries.
+# Test suite seems very broken, but we kind of expected *some* failures, as we
+# use an older capstone than r2 embeds by default.
 TEST_DEPENDS = devel/git \
-   textproc/jq
+   textproc/jq \
+   ${BASE_PKGPATH}=${V}
 TEST_IS_INTERACTIVE =  Yes
 TEST_TARGET =  tests
 
 post-extract:
-   mv ${WRKDIR}/tree-sitter-${TREESITTER_COMMIT}* 
${WRKSRC}/shlr/tree-sitter
+   mv ${WRKDIR}/vector35-arch-arm64-${VECTOR35_ARM64_COMMIT}* \
+   ${WRKSRC}/libr/asm/arch/arm/v35arm64/arch-arm64
+   mv ${WRKDIR}/vector35-arch-armv7-${VECTOR35_ARMV7_COMMIT}* \
+   ${WRKSRC}/libr/asm/arch/arm/v35arm64/arch-armv7
 
 post-patch:
sed -i 

WIP: update radare2 and move cutter to iaito

2022-08-01 Thread Edd Barrett
Hi,

I'm trying to update radare2 (and the GUI) to the latest versions.

As we've discussed previously on-list, due to upstream politics radare2 was
forked to "rizin" a while ago, and the "iaito" GUI was forked to cutter.

We don't have a port of rizin, but we do have a port of cutter (using
radare2!). I suspect this is because there was once a time where cutter could
still use radare2, but now cutter can only work with rizin.

Anyway, until we get a port of rizin (I know gonzalo@ did some work on this,
but hit problems), we should probably remove cutter from our ports tree in
favour of iaito.

Below is a diff to update radare2, and a tarball of a new iaito port, which I
intend our old cutter package to transition to during `pkg_add -u`.

Notes:

 - radare2 doesn't use treesitter (confirmed with upstream).
 - iaito's python support was deprecated (confirmed with upstream).
 - iaito aims to be more lean than cutter, hence fewer deps.
 - radare2 test suite is broken, but radare2 seems to work nonetheless.

Questions:

 - I've undoubtedly done something daft, but during `pkg_add -u`, why doesn't
   cutter get replaced by iaito? The @pkgpath marker is present and since the
   iaito version number is smaller than the cutter version number, I also
   bumped EPOCH (right?)... What have I missed?

 - After this change, the devel/cutter port will be orphaned. Should we mark it
   BROKEN until we have rizin, or just kill it?

 - jasper@, do you still want to be MAINTAINER of the gui?


Index: Makefile
===
RCS file: /cvs/ports/devel/radare2/main/Makefile,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile
--- Makefile11 Mar 2022 18:53:08 -  1.26
+++ Makefile1 Aug 2022 21:11:53 -
@@ -1,23 +1,23 @@
 COMMENT =  libre and portable reverse engineering framework
 
-V =4.5.1
+V =5.7.6
 SUBST_VARS +=  V
 
 GH_PROJECT =   radare2
 GH_TAGNAME =   ${V}
 
-# When updating, use the output from the command below to set
-# the extra distfiles so as not to invoke clone_3rd_repo.sh during build:
-# grep -E '^TS_TIP' ${WRKSRC}/shlr/Makefile
-TREESITTER_COMMIT =86a5dabb
-MASTER_SITES0 =
https://github.com/tree-sitter/tree-sitter/archive/
-
-MASTER_SITES = https://distfiles.sigtrap.nl/
+# When updating, grep the sources for `ARCH_ARM64_COMMIT` and
+# `ARCH_ARM7_COMMIT`.
+VECTOR35_ARM64_COMMIT =9ab2b0be
+VECTOR35_ARMV7_COMMIT =dde39f69
+MASTER_SITES0 =
https://github.com/radareorg/vector35-arch-arm64/archive/
+MASTER_SITES1 =
https://github.com/radareorg/vector35-arch-armv7/archive/
 DISTFILES =${DISTNAME}${EXTRACT_SUFX} \
-   treesitter-{}${TREESITTER_COMMIT}.tar.gz:0
+   vector35-arch-arm64-{}${VECTOR35_ARM64_COMMIT}.tar.gz:0 
\
+   vector35-arch-armv7-{}${VECTOR35_ARMV7_COMMIT}.tar.gz:1
 
-# In radare, all libs have the same version
-LIBV = 8.0 # 4.4.0
+# In radare, all libs have the same version.
+LIBV = 9.0 # Upstream lib versions same as ${V}.
 .for _lib in r_anal r_asm r_bin r_bp r_config r_cons r_core \
r_crypto r_debug r_egg r_flag r_fs r_hash r_io r_lang \
r_main r_magic r_parse r_reg r_search r_socket \
@@ -26,7 +26,7 @@ SHARED_LIBS+= ${_lib} ${LIBV}
 .endfor
 
 # uses pledge()
-WANTLIB =  c capstone crypto kvm m pthread ssl util uv z zip
+WANTLIB =  c capstone crypto kvm m pthread ssl uv z zip
 
 DEBUG_PACKAGES =   ${BUILD_PACKAGES}
 
@@ -42,16 +42,22 @@ CONFIGURE_ARGS +=   --mandir=${PREFIX}/man
--with-syszip
 
 CONFIGURE_ENV +=   LDFLAGS="-L${LOCALBASE}/lib"
-MAKE_ENV = HOST_CC="${CC}"
+MAKE_ENV = HOST_CC="${CC}" HOST_CFLAGS="${CFLAGS}"
 
-# Requires downloading a number of test binaries
+# Requires network to download a number of test binaries.
+# Test suite seems very broken, but we kind of expected *some* failures, as we
+# use an older capstone than r2 embeds by default.
 TEST_DEPENDS = devel/git \
-   textproc/jq
+   textproc/jq \
+   ${BASE_PKGPATH}=${V}
 TEST_IS_INTERACTIVE =  Yes
 TEST_TARGET =  tests
 
 post-extract:
-   mv ${WRKDIR}/tree-sitter-${TREESITTER_COMMIT}* 
${WRKSRC}/shlr/tree-sitter
+   mv ${WRKDIR}/vector35-arch-arm64-${VECTOR35_ARM64_COMMIT}* \
+   ${WRKSRC}/libr/asm/arch/arm/v35arm64/arch-arm64
+   mv ${WRKDIR}/vector35-arch-armv7-${VECTOR35_ARMV7_COMMIT}* \
+   ${WRKSRC}/libr/asm/arch/arm/v35arm64/arch-armv7
 
 post-patch:
sed -i 's/>mips/>mipsen/' ${WRKSRC}/libr/anal/p/anal_mips_cs.c
Index: distinfo
===
RCS file: /cvs/ports/devel/radare2/main/distinfo,v
retrieving