From nobody Fri Oct 08 07:06:42 2021 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 33BA512D14D6; Fri, 8 Oct 2021 07:06:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQfPb00CQz4gnQ; Fri, 8 Oct 2021 07:06:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD08A22AE5; Fri, 8 Oct 2021 07:06:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19876glD079522; Fri, 8 Oct 2021 07:06:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19876gRm079521; Fri, 8 Oct 2021 07:06:42 GMT (envelope-from git) Date: Fri, 8 Oct 2021 07:06:42 GMT Message-Id: <202110080706.19876gRm079521@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Daniel Engberg Subject: git: b75c465cc063 - main - graphics/airsaned: New port: Apple AirScan compatible SANE web frontend List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: diizzy X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b75c465cc063856bd854ff9e91c4a09d2dea3de4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by diizzy: URL: https://cgit.FreeBSD.org/ports/commit/?id=b75c465cc063856bd854ff9e91c4a09d2dea3de4 commit b75c465cc063856bd854ff9e91c4a09d2dea3de4 Author: J.R. Oldroyd AuthorDate: 2021-10-08 06:14:55 +0000 Commit: Daniel Engberg CommitDate: 2021-10-08 07:06:34 +0000 graphics/airsaned: New port: Apple AirScan compatible SANE web frontend A SANE WebScan frontend that supports Apple's AirScan protocol. Scanners are detected automatically, and published through mDNS. Acquired images may be transferred in JPEG, PNG, and PDF/raster format. WWW: https://github.com/SimulPiscator/AirSane PR: 242144 Approved by: arrowd (mentor) Differential Revision: https://reviews.freebsd.org/D32314 --- graphics/Makefile | 1 + graphics/airsaned/Makefile | 32 ++++++++++ graphics/airsaned/distinfo | 3 + graphics/airsaned/files/airsaned.in | 24 ++++++++ graphics/airsaned/files/patch-CMakeLists.txt | 71 ++++++++++++++++++++++ .../files/patch-imageformats-pngencoder.cpp | 20 ++++++ graphics/airsaned/files/patch-server-server.cpp | 16 +++++ graphics/airsaned/files/patch-web-httpserver.cpp | 12 ++++ .../files/patch-zeroconf-hotplugnotifier.cpp | 14 +++++ graphics/airsaned/pkg-descr | 21 +++++++ graphics/airsaned/pkg-plist | 4 ++ 11 files changed, 218 insertions(+) diff --git a/graphics/Makefile b/graphics/Makefile index 0c49d10e4816..78a28b6466d1 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -43,6 +43,7 @@ SUBDIR += acidwarp SUBDIR += acidwarp-sdl SUBDIR += agg + SUBDIR += airsaned SUBDIR += akira SUBDIR += alembic SUBDIR += aloadimage diff --git a/graphics/airsaned/Makefile b/graphics/airsaned/Makefile new file mode 100644 index 000000000000..0806d824d9aa --- /dev/null +++ b/graphics/airsaned/Makefile @@ -0,0 +1,32 @@ +PORTNAME= airsaned +DISTVERSIONPREFIX= v +DISTVERSION= 0.3.2-50 +DISTVERSIONSUFFIX= -gdeab313 +CATEGORIES= graphics + +MAINTAINER= fbsd@opal.com +COMMENT= Apple AirScan compatible SANE web frontend + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libavahi-client.so:net/avahi-app \ + libpng.so:graphics/png \ + libsane.so:graphics/sane-backends + +USES= cmake compiler:c++11-lib jpeg localbase:ldflags +USE_GITHUB= yes +USE_RC_SUBR= ${PORTNAME} + +GH_ACCOUNT= SimulPiscator +GH_PROJECT= AirSane + +post-patch: + @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ + ${PATCH_WRKSRC}/server/server.cpp + +post-install: + @${MV} ${STAGEDIR}${PREFIX}/etc/airsane/ignore.conf ${STAGEDIR}${PREFIX}/etc/airsane/ignore.conf.sample + @${MV} ${STAGEDIR}${PREFIX}/etc/airsane/options.conf ${STAGEDIR}${PREFIX}/etc/airsane/options.conf.sample + +.include diff --git a/graphics/airsaned/distinfo b/graphics/airsaned/distinfo new file mode 100644 index 000000000000..ff969aa19d17 --- /dev/null +++ b/graphics/airsaned/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1633432825 +SHA256 (SimulPiscator-AirSane-v0.3.2-50-gdeab313_GH0.tar.gz) = a9df4ed9de8f59f07fe9d491bf9eb96c8168001ba0025b96bf97c39ac49e35e9 +SIZE (SimulPiscator-AirSane-v0.3.2-50-gdeab313_GH0.tar.gz) = 115706 diff --git a/graphics/airsaned/files/airsaned.in b/graphics/airsaned/files/airsaned.in new file mode 100644 index 000000000000..02b9a57251ac --- /dev/null +++ b/graphics/airsaned/files/airsaned.in @@ -0,0 +1,24 @@ +#!/bin/sh + +# PROVIDE: airsaned +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following line to /etc/rc.conf[.local] to enable airsaned: +# airsaned_enable="YES" + +. /etc/rc.subr + +name=airsaned +rcvar=airsaned_enable + +load_rc_config airsane + +: ${airsaned_enable:="NO"} +: ${airsaned_args:=""} + +command="%%PREFIX%%/sbin/${name}" +command_args="${airsaned_args} &" +sig_stop="KILL" + +run_rc_command "$1" diff --git a/graphics/airsaned/files/patch-CMakeLists.txt b/graphics/airsaned/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..34f75f731952 --- /dev/null +++ b/graphics/airsaned/files/patch-CMakeLists.txt @@ -0,0 +1,71 @@ +--- CMakeLists.txt.orig 2021-09-18 16:22:32 UTC ++++ CMakeLists.txt +@@ -20,6 +20,7 @@ endif() + + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) ++include(GNUInstallDirs) + + include_directories(.) + if(APPLE) +@@ -66,6 +67,13 @@ add_executable(${PROJECT_NAME} + zeroconf/hotplugnotifier.cpp + ${ZEROCONF_FILES} + ) ++ ++if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD) ++ set(USB_LIBRARY usb) ++else() ++ set(USB_LIBRARY usb-1.0) ++endif() ++ + target_link_libraries( + ${PROJECT_NAME} + Threads::Threads +@@ -73,7 +81,7 @@ target_link_libraries( + jpeg + png + ${ZEROCONF_LIBS} +- usb-1.0 ++ ${USB_LIBRARY} + ) + + if(APPLE) +@@ -105,8 +113,10 @@ install(CODE " + else() + + install(TARGETS ${PROJECT_NAME} +- RUNTIME DESTINATION bin ++ RUNTIME DESTINATION ${BINDIR} + ) ++ ++if(CMAKE_SYSTEM_NAME STREQUAL Linux) + install(FILES systemd/airsaned.service + DESTINATION /lib/systemd/system + ) +@@ -114,21 +124,9 @@ install(FILES systemd/airsaned.default + DESTINATION /etc/default + RENAME airsane + ) ++endif() + +-install(CODE " +- if(NOT EXISTS /etc/airsane/ignore.conf) +- file(INSTALL ${CMAKE_SOURCE_DIR}/etc/ignore.conf DESTINATION /etc/airsane) +- endif() +-") +-install(CODE " +- if(NOT EXISTS /etc/airsane/options.conf) +- file(INSTALL ${CMAKE_SOURCE_DIR}/etc/options.conf DESTINATION /etc/airsane) +- endif() +-") +-install(CODE " +- if(NOT EXISTS /etc/airsane/Gnome-scanner.png) +- file(INSTALL ${CMAKE_SOURCE_DIR}/etc/Gnome-scanner.png DESTINATION /etc/airsane) +- endif() +-") +- ++install(FILES etc/ignore.conf etc/options.conf etc/Gnome-scanner.png ++ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/airsane ++) + endif() diff --git a/graphics/airsaned/files/patch-imageformats-pngencoder.cpp b/graphics/airsaned/files/patch-imageformats-pngencoder.cpp new file mode 100644 index 000000000000..cb604abf0c26 --- /dev/null +++ b/graphics/airsaned/files/patch-imageformats-pngencoder.cpp @@ -0,0 +1,20 @@ +--- imageformats/pngencoder.cpp.orig 2021-10-05 12:35:03 UTC ++++ imageformats/pngencoder.cpp +@@ -17,11 +17,17 @@ along with this program. If not, see ++#else + #include ++#endif + #include + #include + #if __APPLE__ + #include ++#elif __FreeBSD__ ++#include + #else + #include + #endif diff --git a/graphics/airsaned/files/patch-server-server.cpp b/graphics/airsaned/files/patch-server-server.cpp new file mode 100644 index 000000000000..e54242f6f2b1 --- /dev/null +++ b/graphics/airsaned/files/patch-server-server.cpp @@ -0,0 +1,16 @@ +--- server/server.cpp.orig 2021-10-05 17:07:11 UTC ++++ server/server.cpp +@@ -103,11 +103,11 @@ Server::Server(int argc, char** argv) + "ignore SANE network scanners", + localonly }, + { "options-file", +- "/etc/airsane/options.conf", ++ "%%PREFIX%%/etc/airsane/options.conf", + "location of device options file", + optionsfile }, + { "ignore-list", +- "/etc/airsane/ignore.conf", ++ "%%PREFIX%%/etc/airsane/ignore.conf", + "location of device ignore list", + ignorelist }, + { "debug", "false", "log debug information to stderr", debug }, diff --git a/graphics/airsaned/files/patch-web-httpserver.cpp b/graphics/airsaned/files/patch-web-httpserver.cpp new file mode 100644 index 000000000000..0f120845e0d7 --- /dev/null +++ b/graphics/airsaned/files/patch-web-httpserver.cpp @@ -0,0 +1,12 @@ +--- web/httpserver.cpp.orig 2021-10-05 12:35:03 UTC ++++ web/httpserver.cpp +@@ -25,6 +25,9 @@ along with this program. If not, see + + #include ++#ifdef __FreeBSD__ ++#include ++#endif + #include + #include + #include diff --git a/graphics/airsaned/files/patch-zeroconf-hotplugnotifier.cpp b/graphics/airsaned/files/patch-zeroconf-hotplugnotifier.cpp new file mode 100644 index 000000000000..2b7939c493c9 --- /dev/null +++ b/graphics/airsaned/files/patch-zeroconf-hotplugnotifier.cpp @@ -0,0 +1,14 @@ +--- zeroconf/hotplugnotifier.cpp.orig 2021-10-05 12:35:03 UTC ++++ zeroconf/hotplugnotifier.cpp +@@ -20,7 +20,11 @@ along with this program. If not, see + #include ++#ifdef __FreeBSD__ ++#include ++#else + #include ++#endif + #include + #include + diff --git a/graphics/airsaned/pkg-descr b/graphics/airsaned/pkg-descr new file mode 100644 index 000000000000..1ca0700d5026 --- /dev/null +++ b/graphics/airsaned/pkg-descr @@ -0,0 +1,21 @@ +A SANE WebScan frontend that supports Apple's AirScan protocol. +Scanners are detected automatically, and published through mDNS. +Though images may be acquired and transferred in JPEG, PNG, and +PDF/raster format through a simple web interface, AirSane's intended +purpose is to be used with AirScan/eSCL clients such as Apple's +Image Capture. + +Images are encoded on-the-fly during acquisition, keeping memory/storage +demands low. Thus, AirSane will run fine on a Raspberry Pi or similar +device. + +AirSane has been developed by reverse-engineering the communication +protocol implemented in Apple's AirScanScanner client (macos 10.12.6, +/System/Library/Image Capture/Devices/AirScanScanner.app). + +Authentication and secure communication are not supported. + +If you are looking for a powerful SANE web frontend, AirSane may +not be for you. You may be interested in phpSANE instead. + +WWW: https://github.com/SimulPiscator/AirSane diff --git a/graphics/airsaned/pkg-plist b/graphics/airsaned/pkg-plist new file mode 100644 index 000000000000..beed33b17baa --- /dev/null +++ b/graphics/airsaned/pkg-plist @@ -0,0 +1,4 @@ +bin/airsaned +etc/airsane/Gnome-scanner.png +@sample etc/airsane/ignore.conf.sample +@sample etc/airsane/options.conf.sample