Saturday, July 09, 2022

Re: [UPDATE] devel/adb

On Thu, January 7, 2021 10:32, Dimitri Karamazov wrote:
> Update adb to 29.0.1
> A gzipped diff attached since this is a huge diff.
>
> A huge chunk of the patches are from freebsd and
> archlinux. The program builds and works fine and tests
> pass except some which fail in freebsd too and are
> disabled hence.
>
> I couldn't connect with usb, but it works over network.
> Although I couldn't connect(usb) with the old adb either.
> Bad device? No core dump while connecting over network
> like old adb does.
>
> Also take MAINTAINER while I'm at it. More effort
> will be required for any future update since google has
> stratified the code as much as possible into different
> BIG repositories for IDK what reason. I'll probably need
> to extract only the required files and make a tarball
> myself.
>
> Any comments? Testing over usb is needed.

Hi.
This diff seems to lack some patch removals (i.e. patch-adb_transport_c).
Anyway adb doesn't compile after fixing this:
/tmp/pobj/adb-29.0.6/platform_system_core-platform-tools-29.0.6/adb/sysdeps.h:29:10:
fatal error: 'string' file not found
#include <string>
^~~~~~~~


>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/adb/Makefile,v
> retrieving revision 1.3
> diff -u -p -r1.3 Makefile
> --- Makefile 17 Jul 2019 14:49:20 -0000 1.3
> +++ Makefile 7 Jan 2021 07:25:08 -0000
> @@ -1,32 +1,39 @@
> -# $OpenBSD: Makefile,v 1.3 2019/07/17 14:49:20 danj Exp $
> +# $OpenBSD: Makefile.template,v 1.88 2020/05/15 01:32:48 abieber Exp $
>
> -COMMENT = Android Debug Bridge
> +COMMENT= Android Debug Bridge
>
> -V = 5.1.1_r4
> -DISTNAME = adb-${V}
> -PKGNAME = ${DISTNAME:S/_r/./}
> -REVISION = 0
> +V= 29.0.6
> +DISTNAME= adb-${V}
>
> -GH_ACCOUNT = android
> -GH_PROJECT = platform_system_core
> -GH_TAGNAME = android-${V}
> +GH_ACCOUNT= aosp-mirror
> +GH_PROJECT= platform_system_core
> +GH_TAGNAME= platform-tools-${V}
>
> -CATEGORIES = devel
> +CATEGORIES= devel
> +
> +HOMEPAGE= https://developer.android.com/studio/command-line/adb
> +
> +MAINTAINER= Dimitri Karamazov <deserter666@danwin1210.me>
>
> -HOMEPAGE = https://developer.android.com/tools/help/adb.html
> # Apache License v2.0
> -PERMIT_PACKAGE = Yes
> +PERMIT_PACKAGE= Yes
> +
> +WANTLIB += ${COMPILER_LIBCXX} c crypto m usb-1.0
> +
> +COMPILER= base-clang ports-gcc base-gcc
> +
> +LIB_DEPENDS= devel/libusb1
> +
> +TEST_DEPENDS= devel/gtest
>
> -WANTLIB = c crypto pthread usb-1.0 z
> -LIB_DEPENDS = devel/libusb1
> +WRKBUILD= $(WRKSRC)/adb
>
> -NO_TEST = Yes
> -USE_GMAKE = Yes
> -WRKBUILD = $(WRKSRC)/adb
> +do-test:
> + ${WRKBUILD}/test
>
> do-install:
> ${INSTALL_PROGRAM} ${WRKBUILD}/adb ${PREFIX}/bin
> ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/adb
> - ${INSTALL_DATA} ${WRKBUILD}/NOTICE ${PREFIX}/share/doc/adb/NOTICE
> + ${INSTALL_DATA} ${WRKBUILD}/*.[Tt][Xx][Tt] ${PREFIX}/share/doc/adb
>
> .include <bsd.port.mk>
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/devel/adb/distinfo,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 distinfo
> --- distinfo 28 May 2015 09:42:37 -0000 1.1.1.1
> +++ distinfo 7 Jan 2021 07:25:08 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (adb-5.1.1_r4.tar.gz) = B2Qhp0LvmBWNXqKQuK7QB/IRVSHx45gy2L41YOmQ6hM=
> -SIZE (adb-5.1.1_r4.tar.gz) = 1210714
> +SHA256 (adb-29.0.6.tar.gz) = PRiYwa0Z9jZBCQV2xgWIq3YRMrQrMG/0l50wcjGH1WI=
> +SIZE (adb-29.0.6.tar.gz) = 72302409
> Index: patches/patch-adb_Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/adb/patches/patch-adb_Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 patch-adb_Makefile
> --- patches/patch-adb_Makefile 28 May 2015 09:42:37 -0000 1.1.1.1
> +++ patches/patch-adb_Makefile 7 Jan 2021 07:25:08 -0000
> @@ -1,52 +1,133 @@
> -$OpenBSD: patch-adb_Makefile,v 1.1.1.1 2015/05/28 09:42:37 ajacoutot Exp $
> ---- adb/Makefile.orig Thu May 28 11:38:32 2015
> -+++ adb/Makefile Thu May 28 11:38:46 2015
> -@@ -0,0 +1,48 @@
> -+SRCS += adb.c
> -+SRCS += adb_auth_host.c
> -+SRCS += adb_client.c
> -+SRCS += commandline.c
> -+SRCS += console.c
> -+SRCS += fdevent.c
> -+SRCS += file_sync_client.c
> -+SRCS += services.c
> -+SRCS += sockets.c
> -+SRCS += transport.c
> -+SRCS += transport_local.c
> -+SRCS += transport_usb.c
> -+SRCS += usb_libusb.c
> -+SRCS += usb_vendors.c
> -+SRCS += get_my_path_generic.c
> -+
> -+VPATH += ../libcutils
> -+SRCS += load_file.c
> -+SRCS += socket_inaddr_any_server.c
> -+SRCS += socket_local_client.c
> -+SRCS += socket_local_server.c
> -+SRCS += socket_loopback_client.c
> -+SRCS += socket_loopback_server.c
> -+SRCS += socket_network_client.c
> -+
> -+VPATH += ../libzipfile
> -+SRCS += centraldir.c
> -+SRCS += zipfile.c
> -+
> -+CPPFLAGS += -DADB_HOST=1
> -+CPPFLAGS += -DHAVE_FORKEXEC=1
> -+CPPFLAGS += -DHAVE_OFF64_T=1
> -+CPPFLAGS += -DHAVE_TERMIO_H
> -+CPPFLAGS += -I.
> -+CPPFLAGS += -I../include
> -+CPPFLAGS += $(shell pkg-config --cflags libusb-1.0)
> -+
> -+LIBS += -lcrypto -lpthread -lz $(shell pkg-config --libs libusb-1.0)
> -+
> -+OBJS= $(SRCS:.c=.o)
> +$OpenBSD$
> +--- adb/Makefile.orig Wed Jan 6 12:17:58 2021
> ++++ adb/Makefile Wed Jan 6 12:17:44 2021
> +@@ -0,0 +1,129 @@
> ++# $OpenBSD$
> ++
> ++PROGS=adb test
> ++NOMAN= noman
> ++VERSION?= 29.0.6
> ++
> ++.PATH: client \
> ++ fdevent \
> ++ sysdeps \
> ++ sysdeps/posix \
> ++ ../base \
> ++ ../diagnose_usb \
> ++ ../libcrypto_utils \
> ++ ../libcrypto_utils/tests \
> ++ ../libcutils \
> ++ ../liblog
> ++
> ++
> ++SRCS_adb+= adb.cpp \
> ++ adb_io.cpp \
> ++ adb_listeners.cpp \
> ++ adb_trace.cpp \
> ++ adb_unique_fd.cpp \
> ++ adb_utils.cpp \
> ++ fdevent.cpp \
> ++ fdevent_poll.cpp \
> ++ services.cpp \
> ++ sockets.cpp \
> ++ socket_spec.cpp \
> ++ errno.cpp \
> ++ transport.cpp \
> ++ transport_fd.cpp \
> ++ transport_local.cpp \
> ++ transport_usb.cpp \
> ++ types.cpp \
> ++ sysdeps_unix.cpp \
> ++ network.cpp \
> ++ auth.cpp \
> ++ usb_libusb.cpp \
> ++ adb_client.cpp \
> ++ bugreport.cpp \
> ++ commandline.cpp \
> ++ file_sync_client.cpp \
> ++ main.cpp \
> ++ console.cpp \
> ++ adb_install.cpp \
> ++ line_printer.cpp \
> ++ shell_service_protocol.cpp \
> ++ chrono_utils.cpp \
> ++ file.cpp \
> ++ liblog_symbols.cpp \
> ++ logging.cpp \
> ++ parsenetaddress.cpp \
> ++ stringprintf.cpp \
> ++ strings.cpp \
> ++ diagnose_usb.cpp \
> ++ android_pubkey.c \
> ++ socket_inaddr_any_server_unix.cpp \
> ++ socket_local_client_unix.cpp \
> ++ socket_local_server_unix.cpp \
> ++ socket_network_client_unix.cpp \
> ++ ../libcutils/sockets.cpp \
> ++ threads.cpp \
> ++ logger_write.cpp \
> ++ ../liblog/properties.cpp
> ++
> ++SRCS_test+= ${SRCS_adb:Nmain.cpp:Ncommandline.cpp:Nadb_install.cpp} \
> ++ adb_io_test.cpp \
> ++ adb_listeners_test.cpp \
> ++ adb_utils_test.cpp \
> ++ bugreport_test.cpp \
> ++ shell_service_protocol_test.cpp \
> ++ socket_spec_test.cpp \
> ++ socket_test.cpp \
> ++ sysdeps_test.cpp \
> ++ transport_test.cpp \
> ++ types_test.cpp \
> ++ fdevent_test.cpp \
> ++ stat_test.cpp \
> ++ file_test.cpp \
> ++ logging_test.cpp \
> ++ parsenetaddress_test.cpp \
> ++ stringprintf_test.cpp \
> ++ strings_test.cpp \
> ++ test_main.cpp \
> ++ test_utils.cpp \
> ++ android_pubkey_test.cpp
> ++
> ++# DragonFly, NetBSD, OpenBSD
> ++CPPFLAGS.sockets.cpp+= -o ${.TARGET}
> ++CPPFLAGS.properties.cpp+= -o ${.TARGET}
> ++
> ++# required by base
> ++
> ++CPPFLAGS+= -DPLATFORM_TOOLS_VERSION="\"${VERSION}\""
> ++CPPFLAGS+= -DADB_HOST=1
> ++CPPFLAGS+= -Doff64_t=off_t
> ++CPPFLAGS+= -Dlseek64=lseek
> ++CPPFLAGS+= -Dpread64=pread
> ++CPPFLAGS+= -Dpwrite64=pwrite
> ++CPPFLAGS+= -I${LOCALBASE}/include
> ++CPPFLAGS+= -I${.CURDIR}
> ++CPPFLAGS+= -I${.CURDIR}/client
> ++CPPFLAGS+= -I${.CURDIR}/../include
> ++CPPFLAGS+= -I${.CURDIR}/../base/include
> ++CPPFLAGS+= -I${.CURDIR}/../diagnose_usb/include
> ++CPPFLAGS+= -I${.CURDIR}/../libcrypto_utils/include
> ++CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
> ++CPPFLAGS+= $$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null)
> ++CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null)
> ++CXXFLAGS+= -std=gnu++2a
> ++
> ++.ifndef COMPILE.c
> ++CFLAGS+= ${CPPFLAGS}
> ++CXXFLAGS+= ${CPPFLAGS}
> ++.endif
> ++
> ++LDADD_adb+= $$(${PKG_CONFIG} libcrypto --libs 2>/dev/null || echo -lcrypto)
> ++LDADD_adb+= $$(${PKG_CONFIG} libusb-1.0 --libs 2>/dev/null || echo -lusb)
> ++LDADD_adb+= -lpthread
> ++DPADD+= ${LIBCRYPTO} ${LIBPTHREAD} ${LIBUSB}
> ++
> ++LDADD_test+= ${LDADD_adb} \
> ++ -L/usr/local/lib -lgtest \
> ++ -L/usr/local/lib -lgmock
> +
> -+all: adb
> ++PKG_CONFIG?= pkg-config
> +
> -+adb: $(OBJS)
> -+ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
> -+
> -+clean:
> -+ rm -f $(OBJS)
> ++.include <bsd.prog.mk>
> Index: patches/patch-adb_adb_c
> ===================================================================
> RCS file: patches/patch-adb_adb_c
> diff -N patches/patch-adb_adb_c
> --- patches/patch-adb_adb_c 28 May 2015 09:42:37 -0000 1.1.1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,21 +0,0 @@
> -$OpenBSD: patch-adb_adb_c,v 1.1.1.1 2015/05/28 09:42:37 ajacoutot Exp $
> ---- adb/adb.c.orig Mon Feb 9 09:10:55 2015
> -+++ adb/adb.c Tue May 5 07:56:50 2015
> -@@ -1191,7 +1191,7 @@ int launch_server(int server_port)
> - char str_port[30];
> - snprintf(str_port, sizeof(str_port), "%d", server_port);
> - // child process
> -- int result = execl(path, "adb", "-P", str_port, "fork-server",
> "server", NULL);
> -+ int result = execlp(path, "adb", "-P", str_port, "fork-server",
> "server", NULL);
> - // this should not return
> - fprintf(stderr, "OOPS! execl returned %d, errno: %d\n", result,
> errno);
> - } else {
> -@@ -1687,6 +1687,8 @@ int handle_host_request(char *service, transport_type
> -
> - int main(int argc, char **argv)
> - {
> -+ init_my_path(argv[0]);
> -+
> - #if ADB_HOST
> - adb_sysdeps_init();
> - adb_trace_init();
> Index: patches/patch-adb_adb_cpp
> ===================================================================
> RCS file: patches/patch-adb_adb_cpp
> diff -N patches/patch-adb_adb_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-adb_adb_cpp 7 Jan 2021 07:25:08 -0000
> @@ -0,0 +1,23 @@
> +$OpenBSD$
> +--- adb/adb.cpp.orig Wed Feb 12 02:14:45 2020
> ++++ adb/adb.cpp Thu Dec 31 19:44:34 2020
> +@@ -44,8 +44,19 @@
> + #include <android-base/parsenetaddress.h>
> + #include <android-base/stringprintf.h>
> + #include <android-base/strings.h>
> ++#ifdef PLATFORM_TOOLS_VERSION
> ++#include <sys/utsname.h>
> ++namespace android { namespace build {
> ++std::string GetBuildNumber() {
> ++ struct utsname uts;
> ++ if (uname(&uts) == -1)
> ++ return "unknown";
> ++ return uts.sysname;
> ++}}}
> ++#else
> + #include <build/version.h>
> + #include <platform_tools_version.h>
> ++

No comments:

Post a Comment