diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk index e3b733d35821..8f6bf1576723 100644 --- a/Mk/Uses/cargo.mk +++ b/Mk/Uses/cargo.mk @@ -1,419 +1,419 @@ # This file contains logic to ease porting of Rust packages or # binaries using the `cargo` command. # # Feature: cargo # Usage: USES=cargo # Valid ARGS: none # # MAINTAINER: rust@FreeBSD.org .if !defined(_INCLUDE_USES_CARGO_MK) _INCLUDE_USES_CARGO_MK= yes . if !empty(cargo_ARGS) IGNORE+= USES=cargo takes no arguments . endif .sinclude "${MASTERDIR}/Makefile.crates" # List of static dependencies. The format is cratename-version. # CARGO_CRATES will be downloaded from MASTER_SITE_CRATESIO. CARGO_CRATES?= # List of features to build (space separated list). # Use special token --no-default-features to disable default # features by passing it to cargo build/install/test. CARGO_FEATURES?= # Name of the local directory for vendoring crates. CARGO_VENDOR_DIR?= ${WRKSRC}/cargo-crates # Default path for cargo manifest. CARGO_CARGOTOML?= ${WRKSRC}/Cargo.toml CARGO_CARGOLOCK?= ${WRKSRC}/Cargo.lock # Save crates inside ${DISTDIR}/rust/crates by default. CARGO_DIST_SUBDIR?= rust/crates # Generate list of DISTFILES. # Prefer canonical file extension .crate going forward . if make(makesum) CARGO_CRATE_EXT= .crate . else # If there is a rust/crates/*.tar.gz in distinfo keep using the old # extension. We need to delay eval until the last moment for # DISTINFO_FILE. We cache the command output to avoid multiple # slow grep runs for every CARGO_CRATE_EXT access. CARGO_CRATE_EXT= ${defined(_CARGO_CRATE_EXT_CACHE):?${_CARGO_CRATE_EXT_CACHE}:${:!if ${GREP} -q '\(${CARGO_DIST_SUBDIR}/.*\.tar\.gz\)' "${DISTINFO_FILE}" 2>/dev/null; then ${ECHO_CMD} .tar.gz; else ${ECHO_CMD} .crate; fi!:_=_CARGO_CRATE_EXT_CACHE}} . endif _CARGO_CRATES:= ${CARGO_CRATES:N*@git+*} _CARGO_GIT_SOURCES:= ${CARGO_CRATES:M*@git+*} # enumerate crates for unqiue and sane distfile group names _CARGO_CRATES:= ${empty(_CARGO_CRATES):?:${_CARGO_CRATES:range:@i@$i ${_CARGO_CRATES:[$i]}@}} # split up crates into (index, crate, name, version) 4-tuples _CARGO_CRATES:= ${_CARGO_CRATES:C/^([-_a-zA-Z0-9]+)-([0-9].*)/\0 \1 \2/} . for _index _crate _name _version in ${_CARGO_CRATES} # Resolving CRATESIO alias is very inefficient with many MASTER_SITES, consume MASTER_SITE_CRATESIO directly MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_name}/${_version},:S,$,:_cargo_${_index},} DISTFILES+= ${CARGO_DIST_SUBDIR}/${_crate}${CARGO_CRATE_EXT}:_cargo_${_index} # Provide pointer to the crate's extraction dir WRKSRC_crate_${_name}= ${CARGO_VENDOR_DIR}/${_crate} # ... also with version suffix in case of multiple versions of the # same crate WRKSRC_crate_${_crate}= ${CARGO_VENDOR_DIR}/${_crate} . endfor _CARGO_AWK= ${AWK} -vCP="${CP}" -vFIND="${FIND}" -vGREP="${GREP}" \ -vCARGO_VENDOR_DIR="${CARGO_VENDOR_DIR}" \ -vGIT_SOURCES="${_CARGO_GIT_SOURCES}" \ -vWRKDIR="${WRKDIR}" -vWRKSRC="${WRKSRC}" \ -f${SCRIPTSDIR}/split-url.awk \ -f${SCRIPTSDIR}/cargo-crates-git-common.awk -f . if !empty(_CARGO_GIT_SOURCES) . for _index _site _filename _wrksrc _crates in ${:!${_CARGO_AWK} ${SCRIPTSDIR}/cargo-crates-git-fetch.awk /dev/null!} MASTER_SITES+= ${_site}:_cargo_git${_index} DISTFILES+= ${_filename}:_cargo_git${_index} . for _crate in ${_crates:S/,/ /g} # Make sure the build dependencies checks below can work for git sourced crates too _CARGO_CRATES+= @git ${_crate} ${_crate} @git # Provide pointer to the crate's extraction dir # # This might not point to the actual crate's sources since a # single git source can contain multiple crates. We cannot collect # subdir information until after the full extraction is done and we # cannot set make variables at that point. This is better than # nothing. WRKSRC_crate_${_crate}= ${WRKDIR}/${_wrksrc} . endfor . endfor . endif # Build dependencies. CARGO_BUILDDEP?= yes . if ${CARGO_BUILDDEP:tl} == "yes" BUILD_DEPENDS+= ${RUST_DEFAULT}>=1.77.0:lang/${RUST_DEFAULT} . elif ${CARGO_BUILDDEP:tl} == "any-version" BUILD_DEPENDS+= ${RUST_DEFAULT}>=0:lang/${RUST_DEFAULT} . endif # Location of toolchain (default to lang/rust's toolchain) CARGO?= ${LOCALBASE}/bin/cargo RUSTC?= ${LOCALBASE}/bin/rustc RUSTDOC?= ${LOCALBASE}/bin/rustdoc # Location of the cargo output directory. CARGO_TARGET_DIR?= ${WRKDIR}/target # Default target platform (affects some RUSTFLAGS if passed) CARGO_BUILD_TARGET?= ${_CARGO_RUST_ARCH_${ARCH}:U${ARCH}}-unknown-${OPSYS:tl} _CARGO_RUST_ARCH_amd64= x86_64 _CARGO_RUST_ARCH_i386= i686 _CARGO_RUST_ARCH_riscv64= riscv64gc # Environment for cargo # - CARGO_HOME: local cache of the registry index # - CARGO_BUILD_JOBS: configure number of jobs to run # - CARGO_TARGET_DIR: location of where to place all generated artifacts # - RUST_BACKTRACE: produce backtraces when something in the build panics # - RUSTC: path of rustc binary (default to lang/rust) # - RUSTDOC: path of rustdoc binary (default to lang/rust) # - RUSTFLAGS: custom flags to pass to all compiler invocations that Cargo performs CARGO_ENV+= \ CARGO_HOME=${WRKDIR}/cargo-home \ CARGO_BUILD_JOBS=${MAKE_JOBS_NUMBER} \ CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET} \ CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \ CARGO_TARGET_${CARGO_BUILD_TARGET:S/-/_/g:tu}_LINKER="${CC}" \ RUSTC=${RUSTC} \ RUSTDOC=${RUSTDOC} \ RUSTFLAGS="${RUSTFLAGS} ${LDFLAGS:C/.+/-C link-arg=&/}" . if ${ARCH} != powerpc CARGO_ENV+= RUST_BACKTRACE=1 . endif . if !defined(_WITHOUT_LTO) && (!defined(WITHOUT_LTO_PORTS) || ${WITHOUT_LTO_PORTS:N${PKGORIGIN}}) _CARGO_MSG= "===> Additional optimization to port applied" _WITH_LTO= yes .undef _WITHOUT_LTO . endif # Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk . if ${ARCH} == amd64 || ${ARCH} == i386 RUSTFLAGS+= ${CFLAGS:M-march=*:S/-march=/-C target-cpu=/} . elif ${ARCH:Mpowerpc*} RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/:S/power/pwr/} . elif ${ARCH} == aarch64 || ${ARCH} == armv7 RUSTFLAGS+= -C target-cpu=${CPUTYPE:C/\+.+//g} . else RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/} . endif # Helper to shorten cargo calls. _CARGO_RUN= ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${CARGO_ENV} ${CARGO} CARGO_CARGO_RUN= cd ${WRKSRC}; ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${CARGO_ENV} \ CARGO_FREEBSD_PORTS_SKIP_GIT_UPDATE=1 ${CARGO} # User arguments for cargo targets. CARGO_BUILD_ARGS?= CARGO_INSTALL_ARGS?= CARGO_INSTALL_PATH?= . CARGO_TEST_ARGS?= CARGO_UPDATE_ARGS?= # Use module targets ? CARGO_BUILD?= yes CARGO_CONFIGURE?= yes CARGO_INSTALL?= yes CARGO_TEST?= yes # rustc stashes intermediary files in TMPDIR (default /tmp) which # might cause issues for users that for some reason space limit # their /tmp. WRKDIR should have plenty of space. # Allow users and ports to still overwrite it. . if ${TMPDIR:U/tmp} == /tmp TMPDIR= ${WRKDIR} . endif # Manage crate features. . if !empty(CARGO_FEATURES:M--no-default-features) CARGO_BUILD_ARGS+= --no-default-features CARGO_INSTALL_ARGS+= --no-default-features CARGO_TEST_ARGS+= --no-default-features . endif . if !empty(CARGO_FEATURES:N--no-default-features) CARGO_BUILD_ARGS+= --features='${CARGO_FEATURES:N--no-default-features}' CARGO_INSTALL_ARGS+= --features='${CARGO_FEATURES:N--no-default-features}' CARGO_TEST_ARGS+= --features='${CARGO_FEATURES:N--no-default-features}' . endif -. if !defined(WITH_DEBUG) +. if !defined(_WITH_DEBUG) CARGO_BUILD_ARGS+= --release CARGO_TEST_ARGS+= --release . else CARGO_INSTALL_ARGS+= --debug . endif . if ${_CARGO_CRATES:Mcmake} BUILD_DEPENDS+= cmake:devel/cmake-core . endif . if ${_CARGO_CRATES:Mgettext-sys} CARGO_ENV+= GETTEXT_BIN_DIR=${LOCALBASE}/bin \ GETTEXT_INCLUDE_DIR=${LOCALBASE}/include \ GETTEXT_LIB_DIR=${LOCALBASE}/lib . endif . if ${_CARGO_CRATES:Mjemalloc-sys} BUILD_DEPENDS+= gmake:devel/gmake . endif . if ${_CARGO_CRATES:Mlibgit2-sys} # Use the system's libgit2 instead of building the bundled version CARGO_ENV+= LIBGIT2_SYS_USE_PKG_CONFIG=1 . endif . if ${_CARGO_CRATES:Mlibssh2-sys} # Use the system's libssh2 instead of building the bundled version CARGO_ENV+= LIBSSH2_SYS_USE_PKG_CONFIG=1 . endif . if ${_CARGO_CRATES:Monig_sys} # onig_sys always prefers the system library but will try to link # statically with it. Since devel/oniguruma doesn't provide a static # library it'll link to libonig.so instead. Strictly speaking setting # RUSTONIG_SYSTEM_LIBONIG is not necessary, but will force onig_sys to # always use the system's libonig as returned by `pkg-config oniguruma`. CARGO_ENV+= RUSTONIG_SYSTEM_LIBONIG=1 . endif . if ${_CARGO_CRATES:Mopenssl-src} DEV_WARNING+= "Please make sure this port uses the system OpenSSL and consider removing CARGO_CRATES=${CARGO_CRATES:Mopenssl-src-[0-9]*} (a vendored copy of OpenSSL) from the build, e.g., by patching Cargo.toml appropriately." . endif . if ${_CARGO_CRATES:Mopenssl-sys} # Make sure that openssl-sys can find the correct version of OpenSSL CARGO_ENV+= OPENSSL_LIB_DIR=${OPENSSLLIB} \ OPENSSL_INCLUDE_DIR=${OPENSSLINC} . endif . if ${_CARGO_CRATES:Mpkg-config} .include "${USESDIR}/pkgconfig.mk" . endif . if ${_CARGO_CRATES:Mzstd-sys} # Use the system's zstd instead of building the bundled version CARGO_ENV+= ZSTD_SYS_USE_PKG_CONFIG=1 . endif . for _index _crate _name _version in ${_CARGO_CRATES} # Split up semantic version and try to sanitize it by removing # pre-release identifier (-) or build metadata (+) . if ${_version:S/./ /:S/./ /:C/[-+].*//:_:[#]} == 3 . for _major _minor _patch in $_ # FreeBSD 12.0 changed ABI: r318736 and r320043 # https://github.com/rust-lang/libc/commit/78f93220d70e # https://github.com/rust-lang/libc/commit/969ad2b73cdc . if ${_name} == libc && ${_major} == 0 && (${_minor} < 2 || (${_minor} == 2 && ${_patch} < 38)) DEV_ERROR+= "CARGO_CRATES=${_crate} may be unstable on FreeBSD 12.0. Consider updating to the latest version \(higher than 0.2.37\)." . endif . if ${_name} == libc && ${_major} == 0 && (${_minor} < 2 || (${_minor} == 2 && ${_patch} < 49)) DEV_ERROR+= "CARGO_CRATES=${_crate} may be unstable on aarch64 or not build on armv6, armv7, powerpc64. Consider updating to the latest version \(higher than 0.2.49\)." . endif # FreeBSD 12.0 updated base OpenSSL in r339270: # https://github.com/sfackler/rust-openssl/commit/276577553501 . if ${_name} == openssl && !exists(${PATCHDIR}/patch-openssl-1.1.1) && ${_major} == 0 && (${_minor} < 10 || (${_minor} == 10 && ${_patch} < 4)) DEV_WARNING+= "CARGO_CRATES=${_crate} does not support OpenSSL 1.1.1. Consider updating to the latest version \(higher than 0.10.3\)." . endif . endfor . endif . endfor _USES_extract+= 600:cargo-extract cargo-extract: # target for preparing crates directory. It will put all crates in # the local crates directory. @${ECHO_MSG} "===> Moving crates to ${CARGO_VENDOR_DIR}" @${MKDIR} ${CARGO_VENDOR_DIR} . for _index _crate _name _version in ${_CARGO_CRATES} . if ${_index} != @git @${MV} ${WRKDIR}/${_crate} ${CARGO_VENDOR_DIR}/${_crate} @${PRINTF} '{"package":"%s","files":{}}' \ $$(${SHA256} -q ${_DISTDIR}/${CARGO_DIST_SUBDIR}/${_crate}${CARGO_CRATE_EXT}) \ > ${CARGO_VENDOR_DIR}/${_crate}/.cargo-checksum.json @if [ -r ${CARGO_VENDOR_DIR}/${_crate}/Cargo.toml.orig ]; then \ ${MV} ${CARGO_VENDOR_DIR}/${_crate}/Cargo.toml.orig \ ${CARGO_VENDOR_DIR}/${_crate}/Cargo.toml.orig-cargo; \ fi . endif . endfor . if ${CARGO_CONFIGURE:tl} == "yes" _USES_configure+= 250:cargo-configure # configure hook. Place a config file for overriding crates-io index # by local source directory. cargo-configure: # Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 @${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ ${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh . if defined(_CARGO_MSG) @${ECHO_MSG} ${_CARGO_MSG} . endif @${ECHO_MSG} "===> Cargo config:" @${MKDIR} ${WRKDIR}/.cargo @: > ${WRKDIR}/.cargo/config.toml @${ECHO_CMD} "[source.cargo]" >> ${WRKDIR}/.cargo/config.toml @${ECHO_CMD} "directory = '${CARGO_VENDOR_DIR}'" >> ${WRKDIR}/.cargo/config.toml @${ECHO_CMD} "[source.crates-io]" >> ${WRKDIR}/.cargo/config.toml @${ECHO_CMD} "replace-with = 'cargo'" >> ${WRKDIR}/.cargo/config.toml . if !empty(_CARGO_GIT_SOURCES) @${_CARGO_AWK} ${SCRIPTSDIR}/cargo-crates-git-configure.awk \ /dev/null >> ${WRKDIR}/.cargo/config.toml . endif @${CAT} ${WRKDIR}/.cargo/config.toml @if ! ${GREP} -qF '[profile.release]' ${CARGO_CARGOTOML}; then \ ${ECHO_CMD} "" >> ${CARGO_CARGOTOML}; \ ${ECHO_CMD} "[profile.release]" >> ${CARGO_CARGOTOML}; \ ${ECHO_CMD} "opt-level = 2" >> ${CARGO_CARGOTOML}; \ ${ECHO_CMD} "debug = false" >> ${CARGO_CARGOTOML}; \ fi @${ECHO_MSG} "===> Updating Cargo.lock" @${CARGO_CARGO_RUN} update \ --manifest-path ${CARGO_CARGOTOML} \ --verbose \ --verbose \ ${CARGO_UPDATE_ARGS} . endif . if !target(do-build) && ${CARGO_BUILD:tl} == "yes" do-build: @${CARGO_CARGO_RUN} build \ --manifest-path ${CARGO_CARGOTOML} \ --verbose \ --verbose \ ${CARGO_BUILD_ARGS} . endif . if !target(do-install) && ${CARGO_INSTALL:tl} == "yes" do-install: . for path in ${CARGO_INSTALL_PATH} @${CARGO_CARGO_RUN} install \ --no-track \ --path "${path}" \ --root "${STAGEDIR}${PREFIX}" \ --verbose \ --verbose \ ${CARGO_INSTALL_ARGS} . endfor . endif . if !target(do-test) && ${CARGO_TEST:tl} == "yes" do-test: @${CARGO_CARGO_RUN} test \ --manifest-path ${CARGO_CARGOTOML} \ --verbose \ --verbose \ ${CARGO_TEST_ARGS} . endif # # Helper targets for port maintainers # # cargo-audit generates a vulnerability report using # security/cargo-audit based on the crates in Cargo.lock. cargo-audit: configure @if ! type cargo-audit > /dev/null 2>&1; then \ ${ECHO_MSG} "===> Please install \"security/cargo-audit\""; exit 1; \ fi @${ECHO_MSG} "===> Checking for vulnerable crates" @${CARGO} audit --file ${CARGO_CARGOLOCK} # cargo-crates will output the crates list from Cargo.lock. If there # is no Cargo.lock for some reason, try and generate it first. cargo-crates: cargo-crates-generate-lockfile @${_CARGO_AWK} ${SCRIPTSDIR}/cargo-crates.awk ${CARGO_CARGOLOCK} # cargo-crates-generate-lockfile will try to generate a Cargo.lock file # if it does not exist. cargo-crates-generate-lockfile: extract @if [ ! -r "${CARGO_CARGOLOCK}" ]; then \ ${ECHO_MSG} "===> ${CARGO_CARGOLOCK} not found. Trying to generate it..."; \ cd ${WRKSRC}; ${_CARGO_RUN} generate-lockfile \ --manifest-path ${CARGO_CARGOTOML} \ --verbose; \ fi # cargo-crates-licenses will try to grab license information from # all downloaded crates. cargo-crates-licenses: configure @${FIND} ${CARGO_VENDOR_DIR} -name 'Cargo.toml' -maxdepth 2 \ -exec ${GREP} -H '^license' {} \; \ | ${SED} \ -e 's@^${CARGO_VENDOR_DIR}/@@' \ -e 's@/Cargo.toml:license.*= *"@|@' \ -e 's@"$$@@g' | sort | /usr/bin/column -t -s '|' # cargo-crates-merge will in-place update CARGO_CRATES in the port # based on the crates list from Cargo.lock. If there is no Cargo.lock # for some reason, try and generate it first. cargo-crates-merge: @if ! type portedit > /dev/null 2>&1; then \ ${ECHO_MSG} "===> Please install \"ports-mgmt/portfmt\""; exit 1; \ fi @${MAKE} clean cargo-crates-generate-lockfile @f="${MASTERDIR}/Makefile"; [ -r "${MASTERDIR}/Makefile.crates" ] && f="${MASTERDIR}/Makefile.crates"; \ ${_CARGO_AWK} ${SCRIPTSDIR}/cargo-crates.awk ${CARGO_CARGOLOCK} | \ portedit merge -i $$f; \ ${MAKE} clean makesum; \ ${ECHO_MSG} "${DISTINFO_FILE} and CARGO_CRATES in $$f were updated"; .endif diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk index 4129f0f341fc..307bd04d98f8 100644 --- a/Mk/Uses/cmake.mk +++ b/Mk/Uses/cmake.mk @@ -1,199 +1,199 @@ # Provide support for CMake based projects # # Feature: cmake # Usage: USES=cmake or USES=cmake:ARGS # Valid ARGS: indirect, insource, noninja, run, testing # ARGS description: # indirect do not run cmake for configure step, only add build dependency. # This should be set only for ports which use other build systems, # e.g. pep517 or meson, but rely internally on cmake. # insource do not perform an out-of-source build # noninja do not use ninja instead of make # Setting this should be an exception, and hints to an issue # inside the ports build system. # A few corner cases never use ninja, and are handled, to reduce # the usage of 'noninja'.: # 1) fortran ports # 2) ports that set BUILD_- or INSTALL_WRKSRC to # something different than CONFIGURE_WRKSRC # run add a runtime dependency on cmake # testing add the test target based on ctest # Additionally, CMAKE_TESTING_ON, CMAKE_TESTING_OFF, CMAKE_TESTING_ARGS, CMAKE_TESTING_TARGET # can be defined to override the default values. # _internal Not to be used by any other ports than the ones created from the release-tarball of cmake # # # Additional variables that affect cmake behaviour: # # User defined variables: # CMAKE_NOCOLOR - Disable colour build output # Default: not set, unless BATCH or PACKAGE_BUILDING is defined # # Variables for ports: # CMAKE_ON Appends -D:bool=ON to the CMAKE_ARGS, # CMAKE_OFF Appends -D:bool=OFF to the CMAKE_ARGS. # CMAKE_ARGS - Arguments passed to cmake # Default: see below # Variables for ports which use cmake for configure # CMAKE_BUILD_TYPE - Type of build (cmake predefined build types). # Projects may have their own build profiles. # CMake supports the following types: Debug, # Release, RelWithDebInfo and MinSizeRel. # Debug and Release profiles respect system # CFLAGS, RelWithDebInfo and MinSizeRel will set # CFLAGS to "-O2 -g" and "-Os -DNDEBUG". # Default: Release, if neither WITH_DEBUG nor WITH_DEBUGINFO is set, # RelWithDebInfo, if WITH_DEBUGINFO is set, # Debug, if WITH_DEBUG is set. # CMAKE_SOURCE_PATH - Path to the source directory # Default: ${WRKSRC} # Variables for ports which use cmake for testing # CMAKE_TESTING_ARGS - Additional arguments passed to cmake on test target. # CMAKE_TESTING_ON Appends -D:bool=ON to the CMAKE_TESTING_ARGS. # Default: BUILD_TESTING # CMAKE_TESTING_OFF Appends -D:bool=OFF to the CMAKE_TESTING_ARGS. # Default: empty # CMAKE_TESTING_TARGET - Name of the test target. Default: test # # MAINTAINER: kde@FreeBSD.org .if !defined(_INCLUDE_USES_CMAKE_MK) _INCLUDE_USES_CMAKE_MK= yes _valid_ARGS= indirect insource noninja run testing _internal _CMAKE_VERSION= 3.28.3 CMAKE_BIN= ${LOCALBASE}/bin/cmake # Sanity check . for arg in ${cmake_ARGS} . if empty(_valid_ARGS:M${arg}) IGNORE= Incorrect 'USES+= cmake:${cmake_ARGS}' usage: argument [${arg}] is not recognized . endif . endfor . if !empty(cmake_ARGS:M_internal) # _internal is intended only for devel/cmake-core MASTER_SITES?= https://github.com/Kitware/CMake/releases/download/v${DISTVERSION}/ \ https://www.cmake.org/files/v${DISTVERSION}/ . else BUILD_DEPENDS+= ${CMAKE_BIN}:devel/cmake-core . if !empty(cmake_ARGS:Mrun) RUN_DEPENDS+= ${CMAKE_BIN}:devel/cmake-core . endif -. if defined(WITH_DEBUG) +. if defined(_WITH_DEBUG) CMAKE_BUILD_TYPE?= Debug -. elif defined(WITH_DEBUGINFO) +. elif defined(_WITH_DEBUGINFO) CMAKE_BUILD_TYPE?= RelWithDebInfo . else CMAKE_BUILD_TYPE?= Release -. endif #defined(WITH_DEBUG) +. endif #defined(_WITH_DEBUG) CMAKE_ARGS+= -DCMAKE_C_COMPILER:STRING="${CC}" \ -DCMAKE_CXX_COMPILER:STRING="${CXX}" \ -DCMAKE_C_FLAGS:STRING="${CFLAGS}" \ -DCMAKE_C_FLAGS_DEBUG:STRING="${CFLAGS}" \ -DCMAKE_C_FLAGS_RELEASE:STRING="${CFLAGS} -DNDEBUG" \ -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \ -DCMAKE_CXX_FLAGS_DEBUG:STRING="${CXXFLAGS}" \ -DCMAKE_CXX_FLAGS_RELEASE:STRING="${CXXFLAGS} -DNDEBUG" \ -DCMAKE_EXE_LINKER_FLAGS:STRING="${LDFLAGS}" \ -DCMAKE_MODULE_LINKER_FLAGS:STRING="${LDFLAGS}" \ -DCMAKE_SHARED_LINKER_FLAGS:STRING="${LDFLAGS}" \ -DCMAKE_INSTALL_PREFIX:PATH="${CMAKE_INSTALL_PREFIX}" \ -DCMAKE_BUILD_TYPE:STRING="${CMAKE_BUILD_TYPE}" \ -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DFETCHCONTENT_FULLY_DISCONNECTED:BOOL=ON # Handle the option-like CMAKE_ON and CMAKE_OFF lists. . for _bool_kind in ON OFF . if defined(CMAKE_${_bool_kind}) CMAKE_ARGS+= ${CMAKE_${_bool_kind}:C/.*/-D&:BOOL=${_bool_kind}/} . endif . endfor CMAKE_INSTALL_PREFIX?= ${PREFIX} . if defined(BATCH) || defined(PACKAGE_BUILDING) CMAKE_NOCOLOR= yes . endif . if defined(CMAKE_NOCOLOR) CMAKE_ARGS+= -DCMAKE_COLOR_MAKEFILE:BOOL=OFF . endif . endif . if empty(cmake_ARGS:Mindirect) -. if defined(STRIP) && ${STRIP} != "" && !defined(WITH_DEBUG) && !defined(WITH_DEBUGINFO) +. if defined(STRIP) && ${STRIP} != "" && !defined(_WITH_DEBUG) && !defined(_WITH_DEBUGINFO) INSTALL_TARGET?= install/strip . endif . endif # Use cmake for configure stage and for testing . if empty(cmake_ARGS:M_internal) && empty(cmake_ARGS:Mindirect) PLIST_SUB+= CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:tl}" _CMAKE_MSG= "===> Performing in-source build" CMAKE_SOURCE_PATH?= ${WRKSRC} . if empty(cmake_ARGS:Minsource) _CMAKE_MSG= "===> Performing out-of-source build" CONFIGURE_WRKSRC= ${WRKDIR}/.build BUILD_WRKSRC?= ${CONFIGURE_WRKSRC} INSTALL_WRKSRC?= ${CONFIGURE_WRKSRC} TEST_WRKSRC?= ${CONFIGURE_WRKSRC} . endif # By default we use the ninja generator. # Except, if cmake:run is set (cmake not wanted as generator) # fortran is used, as the ninja-generator does not handle it. # or if CONFIGURE_WRKSRC does not match BUILD_WRKSRC or INSTALL_WRKSRC # as the build.ninja file won't be where ninja expects it. . if empty(cmake_ARGS:Mnoninja) && empty(cmake_ARGS:Mrun) && empty(USES:Mfortran) . if "${CONFIGURE_WRKSRC}" == "${BUILD_WRKSRC}" && "${CONFIGURE_WRKSRC}" == "${INSTALL_WRKSRC}" # USES=gmake sets MAKE_CMD and ninja.mk does too (it also messes with MAKEFILE and MAKE_CMD). . if ! empty(USES:Mgmake) BROKEN= USES=gmake is incompatible with cmake's ninja-generator (try cmake:noninja) . endif # USES=emacs appends EMACS= to MAKE_ARGS, which then get passed to ninja. # Since ninja doesn't support that kind of variable-setting on the command-line, # it errors out. . if ! empty(USES:Memacs) BROKEN= USES=emacs is incompatible with cmake's ninja-generator (try cmake:noninja) . endif . include "${USESDIR}/ninja.mk" . endif . endif . if !target(do-configure) do-configure: @${ECHO_MSG} ${_CMAKE_MSG} ${MKDIR} ${CONFIGURE_WRKSRC} @cd ${CONFIGURE_WRKSRC}; ${SETENVI} ${WRK_ENV} ${CONFIGURE_ENV} ${CMAKE_BIN} \ ${CMAKE_ARGS} ${CMAKE_SOURCE_PATH} . endif . if !target(do-test) && ${cmake_ARGS:Mtesting} CMAKE_TESTING_ON?= BUILD_TESTING CMAKE_TESTING_TARGET?= test # Handle the option-like CMAKE_TESTING_ON and CMAKE_TESTING_OFF lists. . for _bool_kind in ON OFF . if defined(CMAKE_TESTING_${_bool_kind}) CMAKE_TESTING_ARGS+= ${CMAKE_TESTING_${_bool_kind}:C/.*/-D&:BOOL=${_bool_kind}/} . endif . endfor do-test: @cd ${BUILD_WRKSRC} && \ ${SETENVI} ${WRK_ENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_TESTING_ARGS} ${CMAKE_SOURCE_PATH} && \ ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} ${_MAKE_JOBS} ${MAKE_ARGS} ${ALL_TARGET} && \ ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${CMAKE_TESTING_TARGET} . endif . endif .endif #!defined(_INCLUDE_USES_CMAKE_MK) diff --git a/Mk/Uses/go.mk b/Mk/Uses/go.mk index 1836f8972357..6d65fc2c22bc 100644 --- a/Mk/Uses/go.mk +++ b/Mk/Uses/go.mk @@ -1,299 +1,299 @@ # This file contains logic to ease porting of Go binaries using the # `go` command. # # Feature: go # Usage: USES=go # Valid ARGS: (none), N.NN, N.NN-devel, modules, no_targets, run # # (none) Setup GOPATH and build in GOPATH mode using default Go version. # N.NN[-devel] Specify Go version # modules If the upstream uses Go modules, this can be set to build # in modules-aware mode. # no_targets Indicates that Go is needed at build time as a part of # make/CMake build. This will setup build environment like # GO_ENV, GO_BUILDFLAGS but will not create post-extract and # do-{build,install,test} targets. # run Indicates that Go is needed at run time and adds it to # RUN_DEPENDS. # # You can set the following variables to control the process. # # GO_MODULE # The name of the module as specified by "module" directive in go.mod. # In most cases, this is the only required variable for ports that # use Go modules. # # GO_PKGNAME # The name of the package when building in GOPATH mode. This # is the directory that will be created in ${GOPATH}/src. If not set # explicitly and GH_SUBDIR or GL_SUBDIR is present, GO_PKGNAME will # be inferred from it. # It is not needed when building in modules-aware mode. # # GO_TARGET # The packages to build. The default value is ${GO_PKGNAME}. # GO_TARGET can also be a tuple in the form package:path where path can be # either a simple filename or a full path starting with ${PREFIX}. # # GO_TESTTARGET # The packages to test. The default value is `./...` (the current package # and all subpackages). # # CGO_CFLAGS # Additional CFLAGS variables to be passed to the C compiler by the `go` # command # # CGO_LDFLAGS # Additional LDFLAGS variables to be passed to the C compiler by the `go` # command # # GO_BUILDFLAGS # Additional build arguments to be passed to the `go build` command # # GO_TESTFLAGS # Additional build arguments to be passed to the `go test` command # # MAINTAINER: go@FreeBSD.org .if !defined(_INCLUDE_USES_GO_MK) _INCLUDE_USES_GO_MK= yes # When adding a version, please keep the comment in # Mk/bsd.default-versions.mk in sync. GO_VALID_VERSIONS= 1.19 1.20 1.21 1.22 1.23-devel # Check arguments sanity . if !empty(go_ARGS:N[1-9].[0-9][0-9]:N*-devel:Nmodules:Nno_targets:Nrun) IGNORE= USES=go has invalid arguments: ${go_ARGS:N[1-9].[0-9][0-9]:N*-devel:Nmodules:Nno_targets:Nrun} . endif # Parse Go version GO_VERSION= ${go_ARGS:Nmodules:Nno_targets:Nrun:C/^$/${GO_DEFAULT}/} . if empty(GO_VALID_VERSIONS:M${GO_VERSION}) IGNORE?= USES=go has invalid version number: ${GO_VERSION} . endif GO_SUFFIX= ${GO_VERSION:S/.//:C/.*-devel/-devel/} GO_PORT= lang/go${GO_SUFFIX} # Settable variables . if empty(GO_PKGNAME) . if !empty(GH_SUBDIR) GO_PKGNAME= ${GH_SUBDIR:S|^src/||} . elif !empty(GL_SUBDIR) GO_PKGNAME= ${GL_SUBDIR:S|^src/||} . else GO_PKGNAME= ${PORTNAME} . endif . endif GO_TARGET?= ${GO_PKGNAME} GO_TESTTARGET?= ./... -. if !defined(PIE_UNSAFE) && defined(WITH_PIE) && ${ARCH} == amd64 +. if !defined(PIE_UNSAFE) && defined(_WITH_PIE) && ${ARCH} == amd64 GO_BUILDFLAGS+= -buildmode=pie . else GO_BUILDFLAGS+= -buildmode=exe . endif GO_BUILDFLAGS+= -v -trimpath -. if !defined(WITH_DEBUG) && empty(GO_BUILDFLAGS:M-ldflags*) +. if !defined(_WITH_DEBUG) && empty(GO_BUILDFLAGS:M-ldflags*) GO_BUILDFLAGS+= -ldflags=-s . endif GO_TESTFLAGS+= -v . if ${GO_VERSION} != 1.17 GO_BUILDFLAGS+= -buildvcs=false GO_TESTFLAGS+= -buildvcs=false . endif CGO_ENABLED?= 1 CGO_CFLAGS+= -I${LOCALBASE}/include CGO_LDFLAGS+= -L${LOCALBASE}/lib . if ${ARCH} == armv6 || ${ARCH} == armv7 GOARM?= ${ARCH:C/armv//} . endif GO_GOPROXY?= https://proxy.golang.org GO_GOSUMDB?= sum.golang.org # Read-only variables GO_CMD= ${LOCALBASE}/bin/go${GO_SUFFIX} GO_WRKDIR_BIN= ${WRKDIR}/bin GO_ENV+= CGO_ENABLED=${CGO_ENABLED} \ CGO_CFLAGS="${CGO_CFLAGS}" \ CGO_LDFLAGS="${CGO_LDFLAGS}" \ GOAMD64=${GOAMD64} \ GOARM=${GOARM} \ GOTMPDIR="${WRKDIR}" . if ${go_ARGS:Mmodules} GO_BUILDFLAGS+= -mod=vendor GO_TESTFLAGS+= -mod=vendor GO_GOPATH= ${DISTDIR}/go/${PKGORIGIN:S,/,_,g} GO_MODCACHE= file://${GO_GOPATH}/pkg/mod/cache/download GO_WRKSRC= ${WRKSRC} GO_ENV+= GOPATH="${GO_GOPATH}" \ GOBIN="${GO_WRKDIR_BIN}" \ GO111MODULE=on \ GOFLAGS=-modcacherw \ GOSUMDB=${GO_GOSUMDB} . if defined(GO_MODULE) GO_MODNAME= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\1/} . if empty(DISTFILES:Mgo.mod\:*) && empty(DISTFILES:Mgo.mod) # Unless already setup for download by other means, # arrange to pull go.mod and distribution archive from GOPROXY. GO_MODVERSION= ${GO_MODULE:C/^([^@]*)(@([^@]*)?)/\2/:M@*:S/^@//:S/^$/${DISTVERSIONFULL}/} GO_MODFILE= ${GO_MODVERSION}.mod GO_DISTFILE= ${GO_MODVERSION}.zip MASTER_SITES+= ${GO_GOPROXY}/${GO_MODNAME:C/([A-Z])/!\1/g:tl}/@v/ DISTFILES+= ${GO_MODFILE} ${GO_DISTFILE} WRKSRC= ${WRKDIR}/${GO_MODNAME}@${GO_MODVERSION} . endif EXTRACT_ONLY?= ${DISTFILES:N*.mod\:*:N*.mod:C/:.*//} DIST_SUBDIR= go/${PKGORIGIN:S,/,_,g}/${DISTNAME} FETCH_DEPENDS+= ${GO_CMD}:${GO_PORT} \ ca_root_nss>0:security/ca_root_nss USES+= zip . else GO_ENV+= GO_NO_VENDOR_CHECKS=1 . endif . else GO_GOPATH= ${WRKDIR} GO_WRKSRC= ${WRKDIR}/src/${GO_PKGNAME} GO_ENV+= GOPATH="${GO_GOPATH}" \ GOBIN="" \ GO111MODULE=off . endif BUILD_DEPENDS+= ${GO_CMD}:${GO_PORT} BINARY_ALIAS+= go=go${GO_SUFFIX} gofmt=gofmt${GO_SUFFIX} . if ${go_ARGS:Mrun} RUN_DEPENDS+= ${GO_CMD}:${GO_PORT} . endif _USES_POST+= go .endif # !defined(_INCLUDE_USES_GO_MK) .if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GO_POST_MK) _INCLUDE_USES_GO_POST_MK= yes . if ${go_ARGS:Mmodules} && defined(GO_MODULE) _USES_fetch+= 200:go-pre-fetch 800:go-post-fetch # Check that pkg can be installed or is already available, # otherwise it will be impossible to install go and fetch dependencies. go-pre-fetch: . if defined(CLEAN_FETCH_ENV) && !exists(${PKG_BIN}) @${ECHO_MSG} "===> CLEAN_FETCH_ENV is defined, cannot download Go modules (pkg and go are required)"; \ exit 1 . endif # Download all required build dependencies to GOMODCACHE. go-post-fetch: @${ECHO_MSG} "===> Fetching ${GO_MODNAME} dependencies"; @(cd ${DISTDIR}/${DIST_SUBDIR}; \ [ -e go.mod ] || ${RLN} ${GO_MODFILE} go.mod; \ ${SETENVI} ${WRK_ENV} \ ${HTTP_PROXY:DHTTP_PROXY=${HTTP_PROXY:Q}} \ ${http_proxy:Dhttp_proxy=${http_proxy:Q}} \ ${HTTPS_PROXY:DHTTPS_PROXY=${HTTPS_PROXY:Q}} \ ${https_proxy:Dhttps_proxy=${https_proxy:Q}} \ ${NO_PROXY:DNO_PROXY=${NO_PROXY:Q}} \ ${no_proxy:Dno_proxy=${no_proxy:Q}} \ ${GO_ENV} GOPROXY=${GO_GOPROXY} ${GO_CMD} mod download -x all) . endif _USES_extract+= 800:go-post-extract . if ${go_ARGS:Mmodules} && defined(GO_MODULE) # Module-aware build mode. Although not strictly necessary (all build dependencies should be # already in MODCACHE), vendor them so we can patch them if needed. go-post-extract: @${ECHO_MSG} "===> Tidying ${GO_MODNAME} dependencies"; @(cd ${GO_WRKSRC}; ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=${GO_MODCACHE} ${GO_CMD} mod tidy -e) @${ECHO_MSG} "===> Vendoring ${GO_MODNAME} dependencies"; @(cd ${GO_WRKSRC}; ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=${GO_MODCACHE} ${GO_CMD} mod vendor -e) . else # Legacy (GOPATH) build mode, setup directory structure expected by Go for the main module. go-post-extract: @${MKDIR} ${GO_WRKSRC:H} @${LN} -sf ${WRKSRC} ${GO_WRKSRC} . endif . if !target(do-build) && empty(go_ARGS:Mno_targets) do-build: (cd ${GO_WRKSRC}; \ for t in ${GO_TARGET}; do \ out=$$(${BASENAME} $$(${ECHO_CMD} $${t} | \ ${SED} -Ee 's/^[^:]*:([^:]+).*$$/\1/' -e 's/^\.$$/${PORTNAME}/')); \ pkg=$$(${ECHO_CMD} $${t} | \ ${SED} -Ee 's/^([^:]*).*$$/\1/' -e 's/^${PORTNAME}$$/./'); \ ${ECHO_MSG} "===> Building $${out} from $${pkg}"; \ ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${GO_ENV} GOMAXPROCS=${MAKE_JOBS_NUMBER} GOPROXY=off ${GO_CMD} build ${GO_BUILDFLAGS} \ -o ${GO_WRKDIR_BIN}/$${out} \ $${pkg}; \ done) . endif . if !target(do-install) && empty(go_ARGS:Mno_targets) do-install: for t in ${GO_TARGET}; do \ dst=$$(${ECHO_CMD} $${t} | \ ${SED} -Ee 's/^[^:]*:([^:]+).*$$/\1/' -e 's/^\.$$/${PORTNAME}/'); \ src=$$(${BASENAME} $${dst}); \ case $${dst} in \ /*) dst=${STAGEDIR}$${dst}; ${MKDIR} $$(${DIRNAME} $${dst}) ;; \ *) dst=${STAGEDIR}${PREFIX}/bin/$${src} ;; \ esac; \ ${ECHO_MSG} "===> Installing $${src} as $${dst}"; \ ${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/$${src} $${dst}; \ done . endif . if !target(do-test) && empty(go_ARGS:Mno_targets) do-test: (cd ${GO_WRKSRC}; \ for t in ${GO_TESTTARGET}; do \ ${ECHO_MSG} "===> Testing $${t}"; \ ${SETENVI} ${WRK_ENV} ${MAKE_ENV} ${GO_ENV} GOPROXY=off ${GO_CMD} test ${GO_TESTFLAGS} $${t}; \ done) . endif . if ${go_ARGS:Mmodules} && defined(GO_MODULE) gomod-clean: . if exists(${GO_CMD}) @${ECHO_MSG} "===> Cleaning Go module cache" @${SETENVI} ${WRK_ENV} ${GO_ENV} ${GO_CMD} clean -modcache . else @${ECHO_MSG} "===> Skipping since ${GO_CMD} is not installed" . endif # Hook up to distclean . if !target(post-clean) && !make(clean) post-clean: gomod-clean @${RM} -r ${GO_GOPATH} . endif . endif # Helper targets for port maintainers . if ${go_ARGS:Mmodules} && !defined(GO_MODULE) _MODULES2TUPLE_CMD= modules2tuple gomod-vendor-deps: @if ! type ${GO_CMD} > /dev/null 2>&1; then \ ${ECHO_MSG} "===> Please install \"${GO_PORT}\""; exit 1; \ fi; \ if ! type ${_MODULES2TUPLE_CMD} > /dev/null 2>&1; then \ ${ECHO_MSG} "===> Please install \"ports-mgmt/modules2tuple\""; exit 1; \ fi gomod-vendor: gomod-vendor-deps patch @cd ${WRKSRC}; ${SETENVI} ${WRK_ENV} ${GO_ENV} ${GO_CMD} mod vendor; \ [ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt gomod-vendor-diff: gomod-vendor-deps patch @cd ${WRKSRC}; ${SETENVI} ${WRK_ENV} ${GO_ENV} ${GO_CMD} mod vendor; \ [ -r vendor/modules.txt ] && ${_MODULES2TUPLE_CMD} vendor/modules.txt | ${SED} 's|GH_TUPLE=| |; s| \\$$||' | ${GREP} -v ' \\' > ${WRKDIR}/GH_TUPLE-new.txt && \ echo ${GH_TUPLE} | ${TR} -s " " "\n" | ${SED} "s|^| |" > ${WRKDIR}/GH_TUPLE-old.txt && \ ${DIFF} ${WRKDIR}/GH_TUPLE-old.txt ${WRKDIR}/GH_TUPLE-new.txt || exit 0 . endif .endif # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_GO_POST_MK) diff --git a/Mk/Uses/grantlee.mk b/Mk/Uses/grantlee.mk index f050981966f1..23ceb969743f 100644 --- a/Mk/Uses/grantlee.mk +++ b/Mk/Uses/grantlee.mk @@ -1,74 +1,74 @@ # Handle dependency on grantlee # # Feature: grantlee # Usage: USES=grantlee:ARGS # Valid ARGS: ,selfbuild # # version The chooseable versions is 5. # USES=grantlee:5 # Use grantlee 5.x (qt5-based) # # selfbuild Used in devel/grantlee and devel/grantlee5 to suck in versions # but not LIB_DEPENDS. # # Using USES=grantlee:ARGS will export some usesful variables and plist subs # Variables: # GRANTLEE_VERSION - the version of the chosen grantlee # Subs: # GRANTLEE_VERSION_FULL - full version of the chosen grantlee # GRANTLEE_VERSION_SHORT - short version of the chosen grantlee # GRANTLEE_DEBUG_SUFFIX - a suffix to the library name depending # the buildtype (WITH_DEBUG) that gets # appended to library names of plugins # for grantlee5. # # Further it will also append the proper LIB_DEPENDS line. # # MAINTAINER: kde@FreeBSD.org # .if ! defined(_INCLUDE_USES_GRANTLEE_MK) _INCLUDE_USES_GRANTLEE_MK= YES GRANTLEE_SUPPORTED= 5 GRANTLEE5_VER= 5.3.0 GRANTLEE5_LIB_DEPEND= libGrantlee_Templates.so:devel/grantlee5 _grantlee_version= # . for ver in ${GRANTLEE_SUPPORTED:O:u} . if ${grantlee_ARGS:M${ver}} . if empty(_grantlee_version) _grantlee_version= ${ver} . else IGNORE= Incorrect USES=grantlee:${grantlee_ARGS} - multiple versions defined . endif . endif . endfor . if empty(_grantlee_version) IGNORE= Incorrect USES=grantlee:${grantlee_ARGS} - no/unhandled version defined . endif # Export the version of the chosen grantlee port GRANTLEE_VERSION= ${GRANTLEE${_grantlee_version}_VER} # Append the correct LIB_DEPENDS . if empty(grantlee_ARGS:Mselfbuild) LIB_DEPENDS+= ${GRANTLEE${_grantlee_version}_LIB_DEPEND} . endif # Export the plist substitutions PLIST_SUB+= GRANTLEE_VERSION_FULL=${GRANTLEE_VERSION} \ GRANTLEE_VERSION_SHORT=${GRANTLEE_VERSION:R} # GrantleeMacros.cmake provides grantlee_adjust_plugin_name() which appends a # letter 'd' to the library name in Debug mode. Provide a PLIST_SUB which can be # appended in the plist. -. if defined(WITH_DEBUG) +. if defined(_WITH_DEBUG) PLIST_SUB+= GRANTLEE_DEBUG_SUFFIX=d . else PLIST_SUB+= GRANTLEE_DEBUG_SUFFIX="" . endif .endif diff --git a/Mk/Uses/meson.mk b/Mk/Uses/meson.mk index 571e8a990be0..c4c57af3fa18 100644 --- a/Mk/Uses/meson.mk +++ b/Mk/Uses/meson.mk @@ -1,83 +1,83 @@ # Provide support for Meson based projects # # Feature: meson # Usage: USES=meson # # The following files are bundled in source tar files. # meson.build - Instructions for meson like autoconf configure, # there is no changeable parts in the file. # meson_options.txt - All the options meson understands # # Variables for ports: # MESON_ARGS - Arguments passed to meson # format: -Denable_foo=true # MESON_BUILD_DIR - Path to the build directory relative to ${WRKSRC} # Default: _build # # MAINTAINER: desktop@FreeBSD.org .if !defined(_INCLUDE_USES_MESON_MK) _INCLUDE_USES_MESON_MK= yes # Sanity check . if !empty(meson_ARGS) IGNORE= Incorrect 'USES+= meson:${meson_ARGS}'. meson takes no arguments . endif BUILD_DEPENDS+= meson:devel/meson # meson uses ninja .include "${USESDIR}/ninja.mk" # meson might have issues with non-unicode locales USE_LOCALE?= en_US.UTF-8 CONFIGURE_ARGS+= --prefix ${PREFIX} \ --infodir ${INFO_PATH} # Enable all optional features to make builds deterministic. Consumers can # expose those as port OPTIONS_* or explicitly pass -D