Cygwin from Scratch?

Brian Dessent brian@dessent.net
Thu Jun 30 21:46:00 GMT 2005


Tony Karakashian wrote:

> Just a random thought: as a long time Linux from Scratch user, I'm
> intrigued about the possibility of building a Cygwin "distribution"
> from scratch.  Typically when I build an LFS install, I take a lot of
> time building each package to make sure every possible feature is
> available (for example, currently fiddling with Apache2 under Cygwin,
> and ldap modules don't compile unless apr-util is built with ldap
> support, which the default package isn't).  Is such a thing possible?

Maybe a better question would be, "Why do you feel it would not be
possible?"  Every Cygwin binary package is compiled from source by the
maintainer (obviously) and includes a -src package that should build
cleanly, else there's a packaging problem.  So in that sense you can
build everything yourself, no question.

But I think the larger implication in your message is that you would
want to configure things differently, to perhaps use different
prefixes/paths or settings.  That too should be possible given the build
scripts provided in the -src packages.  But you will undoubtedly have to
do some minor tweaking, and know what you're doing.

However, it will never be like LFS, where you just download the upstream
tarballs and "./configure && make && make install" ad nauseam.  Some
*nix software will build under Cygwin out of the box without patching,
but I would say it is the exception to the rule.  Most of the changes
necessary are usually minor, but they still exist, and that is why using
the -src packages is your best bet.  I know that part of the LFS
philosophy is to use unpatched upstream sources as much as possible, but
I don't think this is realistic with Cygwin just yet.

In my experience the two most common changes you have to make when
porting are: a) adding -no-undefined to LDFLAGS (or -Wl,-no-undefined to
CFLAGS), and b) adding missing $(EXEEXT) to Makefiles that reference the
names of binaries.  I believe that a) is just due to how the win32
dynamic loader works (all symbols must be accounted for at link-time) in
contrast to how ld.so works under Linux.

b) is normally taken care of for you by automake but every once in a
while you'll run into a rule in a Makefile that assumes that binaries
have no extension.  You will know when you hit this because you will
either see what seems like a totally random and incorrect rule being
invoked (as make will end up using a built-in implicit rule) or 'make
install' will fail.  In the latter case, /usr/bin/install can normally
work around being called on a filename without the .exe suffix, but if
the package includes its own install-sh script it can possibly be old
and outdated and not have the .exe magic.

In some cases you might have to re-autotoolize and rebuild the generated
files, since the autotools version that the package maintainer used
might be old or might not have Cygwin specific fixes.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list