There was an old WinBoard Forum posting written by Mogens Larsen about that, which I have saved as a textfile. The Ruffian 1.x engine executable itself can be used with these parameters to create a book from PGN, running it from the command line in a dox box.
WinBoard Forum: Re: First impression of Ruffian 1.0.5,
Mogens Larsen at 11/08/2003 15:15
It is possible to reduce the size of a selfmade Ruffian book. The available
book options are:
-B FILE Use FILE as opening book
-I PGN-file Build opening book from PGN-file
-D DEPTH Cut book lines at DEPTH
-P MINPLAYED Add moves played more then n-times
-o Disable opening book
Adding a P (>= 3) value should make it easier to use large PGN files
I have just tested it with 1.0.5, and it worked ok and very quickly. It seems you need to have the book filename (by default Ruffian.bok) configured in the file RUFFIAN.CFG though. The entry is
BOOK "Ruffian.bok"
That name was used for the book generation process, too. You may want to rename or backup the original book if you use the same name, prior to the creation of the new book. One little trap I noticed is, that the process may fail when the database contains games which are shorter than the specified depth is.