diff --git a/ports-mgmt/sccache-overlay/Makefile b/ports-mgmt/sccache-overlay/Makefile index 3aa94da0d083..791f931c6de0 100644 --- a/ports-mgmt/sccache-overlay/Makefile +++ b/ports-mgmt/sccache-overlay/Makefile @@ -1,425 +1,425 @@ PORTNAME= sccache DISTVERSIONPREFIX= v DISTVERSION= 0.2.15 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= ports-mgmt PKGNAMESUFFIX= -overlay MAINTAINER= rust@FreeBSD.org COMMENT= Ports overlay for sccache LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE USES= cargo ssl:build USE_GITHUB= yes GH_ACCOUNT= mozilla CARGO_CRATES= addr2line-0.14.1 \ adler-0.2.3 \ aho-corasick-0.7.15 \ ansi_term-0.11.0 \ anyhow-1.0.37 \ ar-0.8.0 \ arrayref-0.3.6 \ arrayvec-0.5.2 \ ascii-0.8.7 \ assert_cmd-1.0.2 \ async-channel-1.5.1 \ async-executor-1.4.0 \ async-global-executor-1.4.3 \ async-io-1.3.1 \ async-mutex-1.4.0 \ async-std-1.8.0 \ async-task-4.0.3 \ async-trait-0.1.42 \ atomic-waker-1.0.0 \ atty-0.2.14 \ autocfg-0.1.7 \ autocfg-1.0.1 \ backtrace-0.3.55 \ base64-0.9.3 \ base64-0.10.1 \ base64-0.12.3 \ base64-0.13.0 \ bincode-0.8.0 \ bincode-1.3.1 \ bitflags-1.2.1 \ blake2b_simd-0.5.11 \ blake3-0.3.7 \ block-buffer-0.9.0 \ blocking-1.0.2 \ boxfnonce-0.1.1 \ buf_redux-0.8.4 \ bufstream-0.1.4 \ bumpalo-3.4.0 \ byteorder-1.3.4 \ bytes-0.4.12 \ bytes-0.5.6 \ bytes-1.0.0 \ cache-padded-1.1.1 \ case-0.1.0 \ cc-1.0.66 \ cfg-if-0.1.10 \ cfg-if-1.0.0 \ chrono-0.4.19 \ chunked_transfer-0.3.1 \ clap-2.33.3 \ cloudabi-0.0.3 \ combine-4.5.2 \ concurrent-queue-1.2.2 \ conhash-0.4.0 \ constant_time_eq-0.1.5 \ cookie-0.12.0 \ cookie_store-0.7.0 \ core-foundation-0.9.1 \ core-foundation-sys-0.8.2 \ counted-array-0.1.2 \ cpuid-bool-0.1.2 \ crc32fast-1.2.1 \ crossbeam-deque-0.7.3 \ crossbeam-epoch-0.8.2 \ crossbeam-queue-0.1.2 \ crossbeam-queue-0.2.3 \ crossbeam-utils-0.6.6 \ crossbeam-utils-0.7.2 \ crossbeam-utils-0.8.1 \ crypto-mac-0.8.0 \ crypto-mac-0.10.0 \ daemonize-0.4.1 \ derive-error-0.0.3 \ difference-2.0.0 \ digest-0.9.0 \ directories-3.0.1 \ dirs-1.0.5 \ dirs-sys-0.3.5 \ doc-comment-0.3.3 \ dtoa-0.4.7 \ either-1.6.1 \ encoding_rs-0.8.26 \ env_logger-0.8.2 \ error-chain-0.12.4 \ event-listener-2.5.1 \ failure-0.1.8 \ failure_derive-0.1.8 \ fastrand-1.4.0 \ filetime-0.2.13 \ flate2-1.0.19 \ float-cmp-0.8.0 \ fnv-1.0.7 \ foreign-types-0.3.2 \ foreign-types-shared-0.1.1 \ form_urlencoded-1.0.0 \ fuchsia-cprng-0.1.1 \ fuchsia-zircon-0.3.3 \ fuchsia-zircon-sys-0.3.3 \ futures-0.1.30 \ futures-0.3.9 \ futures-channel-0.3.9 \ futures-core-0.3.9 \ futures-cpupool-0.1.8 \ futures-executor-0.3.9 \ futures-io-0.3.9 \ futures-lite-1.11.3 \ futures-macro-0.3.9 \ futures-sink-0.3.9 \ futures-task-0.3.9 \ futures-util-0.3.9 \ generic-array-0.14.4 \ getopts-0.2.21 \ getrandom-0.1.16 \ gimli-0.23.0 \ glob-0.3.0 \ gloo-timers-0.2.1 \ h2-0.1.26 \ hashbrown-0.9.1 \ hermit-abi-0.1.17 \ hmac-0.10.1 \ http-0.1.21 \ http-body-0.1.0 \ httparse-1.3.4 \ humantime-2.0.1 \ hyper-0.12.35 \ hyper-tls-0.3.2 \ hyperx-0.12.0 \ idna-0.1.5 \ idna-0.2.0 \ indexmap-1.6.1 \ instant-0.1.9 \ iovec-0.1.4 \ itertools-0.9.0 \ itertools-0.10.0 \ itoa-0.4.7 \ jobserver-0.1.21 \ js-sys-0.3.46 \ jsonwebtoken-7.2.0 \ kernel32-sys-0.2.2 \ kv-log-macro-1.0.7 \ language-tags-0.2.2 \ lazy_static-1.4.0 \ libc-0.2.82 \ libmount-0.1.15 \ linked-hash-map-0.5.3 \ local-encoding-0.2.0 \ lock_api-0.3.4 \ log-0.3.9 \ log-0.4.11 \ matches-0.1.8 \ maybe-uninit-2.0.0 \ md-5-0.9.1 \ md5-0.3.8 \ memcached-rs-0.4.2 \ memchr-2.3.4 \ memoffset-0.5.6 \ mime-0.2.6 \ mime-0.3.16 \ mime_guess-1.8.8 \ mime_guess-2.0.3 \ miniz_oxide-0.4.3 \ mio-0.6.23 \ mio-named-pipes-0.1.7 \ mio-uds-0.6.8 \ miow-0.2.2 \ miow-0.3.6 \ multipart-0.15.4 \ native-tls-0.2.7 \ nb-connect-1.0.2 \ net2-0.2.37 \ nix-0.14.1 \ nix-0.19.1 \ normalize-line-endings-0.3.0 \ num-bigint-0.2.6 \ num-integer-0.1.44 \ num-traits-0.1.43 \ num-traits-0.2.14 \ num_cpus-1.13.0 \ number_prefix-0.4.0 \ object-0.22.0 \ once_cell-1.5.2 \ opaque-debug-0.3.0 \ openssl-0.10.32 \ openssl-probe-0.1.2 \ openssl-sys-0.9.60 \ parking-2.0.0 \ parking_lot-0.9.0 \ parking_lot_core-0.6.2 \ pem-0.8.2 \ percent-encoding-1.0.1 \ percent-encoding-2.1.0 \ phf-0.7.24 \ phf_codegen-0.7.24 \ phf_generator-0.7.24 \ phf_shared-0.7.24 \ pin-project-lite-0.1.11 \ pin-project-lite-0.2.1 \ pin-utils-0.1.0 \ pkg-config-0.3.19 \ polling-2.0.2 \ ppv-lite86-0.2.10 \ predicates-1.0.6 \ predicates-core-1.0.1 \ predicates-tree-1.0.1 \ proc-macro-hack-0.5.19 \ proc-macro-nested-0.1.6 \ proc-macro2-1.0.24 \ publicsuffix-1.5.4 \ pulldown-cmark-0.0.3 \ quick-error-1.2.3 \ quote-0.3.15 \ quote-1.0.8 \ rand-0.4.6 \ rand-0.5.6 \ rand-0.6.5 \ rand-0.7.3 \ rand_chacha-0.1.1 \ rand_chacha-0.2.2 \ rand_core-0.3.1 \ rand_core-0.4.2 \ rand_core-0.5.1 \ rand_hc-0.1.0 \ rand_hc-0.2.0 \ rand_isaac-0.1.1 \ rand_jitter-0.1.4 \ rand_os-0.1.3 \ rand_pcg-0.1.2 \ rand_xorshift-0.1.1 \ rdrand-0.4.0 \ redis-0.17.0 \ redox_syscall-0.1.57 \ redox_users-0.3.5 \ regex-1.4.2 \ regex-syntax-0.6.21 \ remove_dir_all-0.5.3 \ reqwest-0.9.24 \ retry-1.2.0 \ ring-0.16.19 \ rouille-3.0.0 \ rust-argon2-0.8.3 \ rustc-demangle-0.1.18 \ rustc_version-0.2.3 \ ryu-1.0.5 \ safemem-0.3.3 \ same-file-1.0.6 \ schannel-0.1.19 \ scopeguard-1.1.0 \ security-framework-2.0.0 \ security-framework-sys-2.0.0 \ selenium-rs-0.1.2 \ semver-0.9.0 \ semver-parser-0.7.0 \ serde-1.0.118 \ serde_derive-1.0.118 \ serde_json-1.0.61 \ serde_urlencoded-0.5.5 \ sha-1-0.9.2 \ sha1-0.6.0 \ sha2-0.9.2 \ signal-hook-registry-1.3.0 \ simple_asn1-0.4.1 \ siphasher-0.2.3 \ skeptic-0.4.0 \ slab-0.4.2 \ smallvec-0.6.13 \ socket2-0.3.19 \ spin-0.5.2 \ string-0.2.1 \ strip-ansi-escapes-0.1.0 \ strsim-0.8.0 \ subtle-2.4.0 \ syn-0.11.11 \ syn-1.0.58 \ synom-0.11.3 \ synstructure-0.12.4 \ syslog-5.0.0 \ tar-0.4.30 \ tempdir-0.3.7 \ tempfile-3.1.0 \ term-0.5.2 \ termcolor-1.1.2 \ textwrap-0.11.0 \ thiserror-1.0.23 \ thiserror-impl-1.0.23 \ thread_local-1.1.0 \ threadpool-1.8.1 \ time-0.1.44 \ tiny_http-0.6.2 \ tinyvec-1.1.0 \ tinyvec_macros-0.1.0 \ tokio-0.1.22 \ tokio-0.2.24 \ tokio-buf-0.1.1 \ tokio-codec-0.1.2 \ tokio-compat-0.1.6 \ tokio-current-thread-0.1.7 \ tokio-executor-0.1.10 \ tokio-fs-0.1.7 \ tokio-io-0.1.13 \ tokio-named-pipes-0.1.0 \ tokio-process-0.2.5 \ tokio-reactor-0.1.12 \ tokio-serde-0.1.0 \ tokio-serde-bincode-0.1.1 \ tokio-signal-0.2.9 \ tokio-sync-0.1.8 \ tokio-tcp-0.1.4 \ tokio-threadpool-0.1.18 \ tokio-timer-0.2.13 \ tokio-udp-0.1.6 \ tokio-uds-0.2.7 \ tokio-util-0.3.1 \ toml-0.5.8 \ tower-0.1.1 \ tower-buffer-0.1.2 \ tower-discover-0.1.0 \ tower-layer-0.1.0 \ tower-limit-0.1.3 \ tower-load-shed-0.1.0 \ tower-retry-0.1.0 \ tower-service-0.2.0 \ tower-timeout-0.1.1 \ tower-util-0.1.0 \ tracing-0.1.22 \ tracing-attributes-0.1.11 \ tracing-core-0.1.17 \ treeline-0.1.0 \ try-lock-0.2.3 \ try_from-0.3.2 \ twoway-0.1.8 \ typenum-1.12.0 \ unicase-1.4.2 \ unicase-2.6.0 \ unicode-bidi-0.3.4 \ unicode-normalization-0.1.16 \ unicode-width-0.1.8 \ unicode-xid-0.0.4 \ unicode-xid-0.2.1 \ unix_socket-0.5.0 \ untrusted-0.7.1 \ url-1.7.2 \ url-2.2.0 \ utf8parse-0.1.1 \ uuid-0.7.4 \ uuid-0.8.1 \ vcpkg-0.2.11 \ vec-arena-1.0.0 \ vec_map-0.8.2 \ version-compare-0.0.11 \ version_check-0.1.5 \ version_check-0.9.2 \ void-1.0.2 \ vte-0.3.3 \ wait-timeout-0.2.0 \ waker-fn-1.1.0 \ walkdir-2.3.1 \ want-0.2.0 \ wasi-0.9.0+wasi-snapshot-preview1 \ wasi-0.10.0+wasi-snapshot-preview1 \ wasm-bindgen-0.2.69 \ wasm-bindgen-backend-0.2.69 \ wasm-bindgen-futures-0.4.19 \ wasm-bindgen-macro-0.2.69 \ wasm-bindgen-macro-support-0.2.69 \ wasm-bindgen-shared-0.2.69 \ web-sys-0.3.46 \ wepoll-sys-3.0.1 \ which-4.0.2 \ winapi-0.2.8 \ winapi-0.3.9 \ winapi-build-0.1.1 \ winapi-i686-pc-windows-gnu-0.4.0 \ winapi-util-0.1.5 \ winapi-x86_64-pc-windows-gnu-0.4.0 \ winreg-0.6.2 \ ws2_32-sys-0.2.1 \ xattr-0.2.2 \ zip-0.5.9 \ zstd-0.6.0+zstd.1.4.8 \ zstd-safe-3.0.0+zstd.1.4.8 \ zstd-sys-1.4.19+zstd.1.4.8 CARGO_FEATURES= --no-default-features QA_ENV= IGNORE_QA_proxydeps=1 LDFLAGS+= -Wl,-rpath=\$$ORIGIN/../lib \ -Wl,-dynamic-linker,/tmp/sccache-overlay/ld-elf.so.1 SUB_FILES= pkg-message post-install: @${MKDIR} ${STAGEDIR}${DATADIR}/overlay/Mk \ ${STAGEDIR}${DATADIR}/overlay/bin \ ${STAGEDIR}${DATADIR}/overlay/lib @${MV} ${STAGEDIR}${PREFIX}/bin/sccache \ ${STAGEDIR}${DATADIR}/overlay/bin @${STRIP_CMD} ${STAGEDIR}${DATADIR}/overlay/bin/sccache ${INSTALL_DATA} ${FILESDIR}/Mk/bsd.overlay.mk \ ${STAGEDIR}${DATADIR}/overlay/Mk # rustc seems to have no support for fully static binaries on # FreeBSD, so we package up the required base libraries together # with -Wl,-rpath and -Wl,-dynamic-linker in LDFLAGS to be able # to run the binary in non-native Poudriere jails. ${INSTALL_PROGRAM} /libexec/ld-elf.so.1 \ ${STAGEDIR}${DATADIR}/overlay/lib @${LN} -Fs ${STAGEDIR}${DATADIR}/overlay/lib /tmp/sccache-overlay ldd -f '%p\n' ${STAGEDIR}${DATADIR}/overlay/bin/sccache | \ ${XARGS} -J% ${INSTALL_LIB} % ${STAGEDIR}${DATADIR}/overlay/lib cd ${STAGEDIR}${PREFIX}; \ ${FIND} ${DATADIR_REL} -type f >>${TMPPLIST} .include diff --git a/ports-mgmt/sccache-overlay/files/Mk/bsd.overlay.mk b/ports-mgmt/sccache-overlay/files/Mk/bsd.overlay.mk index da959aae4e3a..90f590b701fc 100644 --- a/ports-mgmt/sccache-overlay/files/Mk/bsd.overlay.mk +++ b/ports-mgmt/sccache-overlay/files/Mk/bsd.overlay.mk @@ -1,53 +1,54 @@ .if !defined(_SCCACHE_OVERLAY_INCLUDED) && !defined(NO_SCCACHE) _SCCACHE_OVERLAY_INCLUDED= yes -_SCCACHE_SIZE_DEFAULT= 16G -SCCACHE_SIZE?= ${_SCCACHE_SIZE_DEFAULT} +SCCACHE_SIZE?= 16G +SCCACHE_UNIX_LISTEN?= /tmp/sccache-overlay.socket _SCCACHE_LIBS= ${LOCALBASE}/share/sccache/overlay/lib .for odir in ${OVERLAYS} . if exists(${odir}/bin/sccache) SCCACHE_BIN?= ${odir}/bin/sccache _SCCACHE_LIBS= ${odir}/lib . endif .endfor SCCACHE_BIN?= ${LOCALBASE}/share/sccache/overlay/bin/sccache .if !exists(${SCCACHE_BIN}) IGNORE= could not find sccache: ${SCCACHE_BIN} .endif .if defined(CCACHE_DIR) SCCACHE_DIR?= ${CCACHE_DIR}/sccache .endif .if !defined(SCCACHE_DIR) IGNORE= SCCACHE_DIR not set .endif _SCCACHE_ENV= RUSTC_WRAPPER="${SCCACHE_BIN}" \ SCCACHE_CACHE_SIZE="${SCCACHE_SIZE}" \ SCCACHE_DIR="${SCCACHE_DIR}" \ - SCCACHE_MAX_FRAME_LENGTH=104857600 + SCCACHE_MAX_FRAME_LENGTH=104857600 \ + SCCACHE_UNIX_LISTEN="${SCCACHE_UNIX_LISTEN}" CONFIGURE_ENV+= ${_SCCACHE_ENV} MAKE_ENV+= ${_SCCACHE_ENV} _USES_configure+= 250:sccache-start _USES_stage+= 950:sccache-stats sccache-start: @${ECHO_MSG} "==> Starting sccache" @${LN} -Fs ${_SCCACHE_LIBS} /tmp/sccache-overlay @${SETENV} ${_SCCACHE_ENV} ${SCCACHE_BIN} --start-server || ${TRUE} @${SETENV} ${_SCCACHE_ENV} ${SCCACHE_BIN} --show-stats sccache-stats: @${ECHO_MSG} "==> sccache statistics" @${SETENV} ${_SCCACHE_ENV} ${SCCACHE_BIN} --show-stats || ${TRUE} # We let Poudriere clean up the server. Users who build locally # can stop the server with `make sccache-stop` manually or wait # 10 minutes after the build until it shuts down automatically. sccache-stop: @${ECHO_MSG} "==> Stopping sccache" @${SETENV} ${_SCCACHE_ENV} ${SCCACHE_BIN} --stop-server .endif diff --git a/ports-mgmt/sccache-overlay/files/patch-src_client.rs b/ports-mgmt/sccache-overlay/files/patch-src_client.rs new file mode 100644 index 000000000000..84ed56b0e4eb --- /dev/null +++ b/ports-mgmt/sccache-overlay/files/patch-src_client.rs @@ -0,0 +1,38 @@ +--- src/client.rs.orig 2021-01-12 22:25:51 UTC ++++ src/client.rs +@@ -17,20 +17,21 @@ use crate::protocol::{Request, Response}; + use crate::util; + use byteorder::{BigEndian, ByteOrder}; + use retry::{delay::Fixed, retry}; ++use std::env; + use std::io::{self, BufReader, BufWriter, Read}; +-use std::net::TcpStream; ++use std::os::unix::net::UnixStream; + + /// A connection to an sccache server. + pub struct ServerConnection { + /// A reader for the socket connected to the server. +- reader: BufReader, ++ reader: BufReader, + /// A writer for the socket connected to the server. +- writer: BufWriter, ++ writer: BufWriter, + } + + impl ServerConnection { + /// Create a new connection using `stream`. +- pub fn new(stream: TcpStream) -> io::Result { ++ pub fn new(stream: UnixStream) -> io::Result { + let writer = stream.try_clone()?; + Ok(ServerConnection { + reader: BufReader::new(stream), +@@ -65,7 +66,8 @@ impl ServerConnection { + /// Establish a TCP connection to an sccache server listening on `port`. + pub fn connect_to_server(port: u16) -> io::Result { + trace!("connect_to_server({})", port); +- let stream = TcpStream::connect(("127.0.0.1", port))?; ++ let unix_socket_path = env::var_os("SCCACHE_UNIX_LISTEN").unwrap(); ++ let stream = UnixStream::connect(unix_socket_path)?; + ServerConnection::new(stream) + } + diff --git a/ports-mgmt/sccache-overlay/files/patch-src_server.rs b/ports-mgmt/sccache-overlay/files/patch-src_server.rs new file mode 100644 index 000000000000..70e9f5fcd2a2 --- /dev/null +++ b/ports-mgmt/sccache-overlay/files/patch-src_server.rs @@ -0,0 +1,66 @@ +--- src/server.rs.orig 2021-01-12 22:25:51 UTC ++++ src/server.rs +@@ -63,6 +63,7 @@ use tokio_io::{AsyncRead, AsyncWrite}; + use tokio_serde_bincode::{ReadBincode, WriteBincode}; + use tokio_tcp::TcpListener; + use tokio_timer::{Delay, Timeout}; ++use tokio_uds::UnixListener; + use tower::Service; + + use crate::errors::*; +@@ -430,8 +431,9 @@ pub fn start_server(config: &Config, port: u16) -> Res + } + + pub struct SccacheServer { ++ unix_socket_path: String, + runtime: Runtime, +- listener: TcpListener, ++ listener: UnixListener, + rx: mpsc::Receiver, + timeout: Duration, + service: SccacheService, +@@ -447,8 +449,8 @@ impl SccacheServer { + dist_client: DistClientContainer, + storage: Arc, + ) -> Result> { +- let addr = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), port); +- let listener = TcpListener::bind(&SocketAddr::V4(addr))?; ++ let unix_socket_path = env::var("SCCACHE_UNIX_LISTEN")?; ++ let listener = UnixListener::bind(&unix_socket_path)?; + + // Prepare the service which we'll use to service all incoming TCP + // connections. +@@ -457,6 +459,7 @@ impl SccacheServer { + let service = SccacheService::new(dist_client, storage, &client, pool, tx, info); + + Ok(SccacheServer { ++ unix_socket_path, + runtime, + listener, + rx, +@@ -493,7 +496,7 @@ impl SccacheServer { + /// Returns the port that this server is bound to + #[allow(dead_code)] + pub fn port(&self) -> u16 { +- self.listener.local_addr().unwrap().port() ++ 0 + } + + /// Runs this server to completion. +@@ -510,6 +513,7 @@ impl SccacheServer { + + fn _run<'a>(self, shutdown: Box + 'a>) -> io::Result<()> { + let SccacheServer { ++ unix_socket_path, + mut runtime, + listener, + rx, +@@ -593,6 +597,8 @@ impl SccacheServer { + io::Error::new(io::ErrorKind::Other, e) + } + })?; ++ ++ std::fs::remove_file(unix_socket_path); + + info!("ok, fully shutting down now"); + diff --git a/ports-mgmt/sccache-overlay/files/pkg-message.in b/ports-mgmt/sccache-overlay/files/pkg-message.in index 800247b91ec1..d84fccb4eceb 100644 --- a/ports-mgmt/sccache-overlay/files/pkg-message.in +++ b/ports-mgmt/sccache-overlay/files/pkg-message.in @@ -1,40 +1,47 @@ [ { type: install message: <