I'm not aware of any standalone program that does this in an off-the-shelf manner without requiring larger chunks of Cygwin and its
setup.exe (see edit at bottom if that's what you need). I think that all of the pieces are there to make a super-minimal install relatively easy to script.
There are two parts to this one: retrieving the files, and detecting version changes (if that's part of what you were looking for when you said "latest").
To retrieve specific files, you can examine (or sniff the requests made by) the Cygwin
setup.exe installer/updater to determine where it retrieves individual files. Pick a mirror, navigate to
pub/cygwin/release, and retrieve the files. For example, here's a link to the core cygwin packages directory for the OSU OSL mirror that I use.
I think that if your individual file (like
grep.exe) is included within a specific package, you'll have to grab the whole package. Some third party out there might be providing unpacked individual files from Cygwin, but I would be reluctant to trust anyone but Cygwin and its official mirrors, so I recommend grabbing the whole packages from a trusted source, and then extracting the file that you need.
Determining when the files have been updated is trickier. Pseudocode would be something like:
Fetch current contents of subdirectory from mirror (using
wget or similar). This syntax leaves the more-easily-parsed
.listing file behind.
wget --no-remove-listing ftp://cygwin.osuosl.org/pub/cygwin/release/grep/
Determine newest file that matches the expected filename pattern. I think that that if the file naming conventions are clean (which Cygwin's usually are), you could easily grab the most-recent version by breaking the numeric parts into tokens, and sorting numerically. You could do quick-and-dirty and just grab the last file in the
.listing that matches, but that might put
grep.10.tgz, depending on sorting methods used.
Download and extract/unpack/unzip. Depending on what archiver you're using, you can probably tell it to only extract specific files.
Copy files to your desired destination.
You could schedule the script to check once a day/week/whatever. You'd probably also want to fetch the accompanying
md5.sum file and compare checksums, depending on how important the files are to your use case.
Speaking of that, what is your use case? Do you just want
grep without the other overhead, and keep it updated/patched? If not, my answer might need to be adjusted accordingly.
EDIT: You might also want to check out apt-cyg. I think that it may actually require a good bit of the core install framework, but the page says that it only requires bash, wget, tar, gawk and bzip2, so you might be able to get the dependencies working there.
I'm new, so I've run out of links, but this answer has apt-cyg info, and also how to do command-line installs with
upgrading and installing packages through the cygwin command line?
Your question sort of implies that you might want something more stripped down than that question provides, so I'll leave the rest of my answer intact for folks who are looking for something even more minimal.