Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions substrate/windows/grep-build/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
# Contributor: Paul Moore <p.f.moore@gmail.com>

_realname=grep
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=3.12
pkgrel=1
pkgdesc="Grep searches one or more input files for lines containing a match to a specified pattern (mingw-w64)"
arch=('any')
mingw_arch=('mingw32', 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://www.gnu.org/software/grep/'
msys2_references=(
"cpe: cpe:/a:gnu:grep"
)
license=('spdx:GPL-3.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-gettext-runtime"
"${MINGW_PACKAGE_PREFIX}-pcre2")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-gettext-tools")
source=("https://ftp.gnu.org/gnu/${_realname}/${_realname}-${pkgver}.tar.xz"{,.sig})
sha256sums=('2649b27c0e90e632eadcd757be06c6e9a4f48d941de51e7c0f83ff76408a07b9'
'SKIP')
validpgpkeys=('155D3FC500C834486D1EEA677FD9FCCB000BEEEE') # Jim Meyering <jim@meyering.net>

build() {
mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}

LDFLAGS+=" -lpthread" \
../${_realname}-${pkgver}/configure \
--prefix=${MINGW_PREFIX}

make
}

package() {
cd "${srcdir}"/build-${MSYSTEM}

make install DESTDIR="${pkgdir}"

# Licenses
install -Dm644 "${srcdir}"/${_realname}-${pkgver}/README \
"${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/README
install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING \
"${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
41 changes: 41 additions & 0 deletions substrate/windows/grep-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

# Determine the root directory of the repository
csource="${BASH_SOURCE[0]}"
while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
root="$( cd -P "$( dirname "$csource" )/../../" && pwd )"

build_dir="${root}/substrate/windows/grep-build"

# Move into the directory with the required build files
if ! pushd "${build_dir}" > /dev/null 2>&1; then
printf "ERROR: Cannot access directory at - %s\n" "${build_dir}"
exit 1
fi

# Validate the destination for the packages was provided
# and that it exists
pkgs_dir="${1?Packages directory is required}"
if [ ! -d "${pkgs_dir}" ]; then
mkdir -p "${pkgs_dir}" || exit
fi

# The PKGBUILD file will end up with windows style line endings
# from git. Force them back to proper new lines.
dos2unix ./PKGBUILD || exit

# Build the 32 bit package
if ! MINGW_ARCH="mingw32" PKGEXT=".pkg.tar.xz" PKGDEST="${pkgs_dir}" makepkg-mingw --skippgpcheck --syncdeps --force --noconfirm; then
printf "ERROR: Failed to build 32-bit grep package\n"
exit 1
fi

# Build the 64 bit package
if ! MINGW_ARCH="mingw64" PKGEXT=".pkg.tar.xz" PKGDEST="${pkgs_dir}" makepkg-mingw --skippgpcheck --syncdeps --force --noconfirm; then
printf "ERROR: Failed to build 64-bit grep package\n"
exit 1
fi

popd > /dev/null 2>&1 || exit

printf "Build of grep package is complete\n"
6 changes: 6 additions & 0 deletions substrate/windows/substrate-builder
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ if ! "${root}/substrate/windows/ruby-builder" "${pkgs_dir}"; then
exit 1
fi

# Build the grep packages
if ! "${root}/substrate/windows/grep-builder" "${pkgs_dir}"; then
printf "ERROR: failed to build required grep packages\n"
exit 1
fi

printf "Contents packages directory after custom builds:\n"
ls -l "${pkgs_dir}"

Expand Down