Date: Mon, 1 Mar 2010 23:31:09 -0800 From: Garrett Cooper <yanefbsd@gmail.com> To: "M. Warner Losh" <imp@bsdimp.com> Cc: ports@freebsd.org Subject: Re: Best way to have a port... Message-ID: <7d6fde3d1003012331t607c3950h2e42c9e1ee2980db@mail.gmail.com> In-Reply-To: <20100301.235125.431102609672430399.imp@bsdimp.com> References: <20100301.235125.431102609672430399.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Warner, On Mon, Mar 1, 2010 at 10:51 PM, M. Warner Losh <imp@bsdimp.com> wrote: > ... that builds part of FreeBSD? > > Let me back up... > > I'm trying to create a port for gcc and binutils that is configured > for FreeBSD for a given machine. =A0FreeBSD mips, say. =A0binutils was > relatively easy (once I ported our mips support forward). =A0However, > gcc vexes me. =A0It requires, to build libgcc and friends, a fully > populated include tree. =A0And it wants to use > /usr/local/freebsd-mips/include instead of /usr/include (which is > good). =A0However, the former doesn't exist. =A0I'd like to create a port > for it, but I'm unclear how to even start. =A0This port should consist > of all files from make includes TARGET_ARCH=3Dmips. > > So, some questions: First, how do I know where the FreeBSD source tree > is? =A0Is there some standard define like SYSDIR that contains this > infomration? > > Second, I need to invoke make includes (and a few other things), with > some slightly non-standard args. =A0is there a stylied way to do this? > I'd like to avoid extracting everything into myport/work/FreeBSD :) > > Without solving these problems, the notion that we can use a ports > compiler to build FreeBSD becomes less viable... I don't know a lot of the answers (in fact, this will probably bring up more questions than answers), but here's my experience: 1. There are a number of options available in gcc which will help pick up the appropriate headers: -isysroot dir This option is like the --sysroot option, but applies only to header files. See the --sysroot option for more information. -imultilib dir Use dir as a subdirectory of the directory containing target-spe= - cific C++ headers. -isystem dir Search dir for header files, after all directories specified by = -I but before the standard system directories. Mark it as a system directory, so that it gets the same special treatment as is appl= ied to the standard system directories. I'm not sure why FreeBSD would be a cross-compiled overlay unless you intend on creating a full-blown cross-compiler ala gcc, but then again I can't read minds... 2. Packages (which all ports are converted into eventually) are the foundation for how thing typically gets done. pkg-plist is the answer, and pkg_create(1) is the ultimate resource for that end. 3. There's a porters handbook, but I honestly haven't read it yet: http://www.freebsd.org/doc/en/books/porters-handbook/ . It does have a lot of helpful info in it though I see from just glancing at the ToC. 4. As for the non-standard includes, make wrappers are the best way to go. If you use make -m {BLAH}/share/mk, it'll use that version's equivalent of /usr/share/mk . There's also -I as well, just like with cc / c++, etc. This is how I hope to resolve an ease-of-use issue with compiling against custom src.conf's at Ironport -- it's pretty basic, almost like straight make(1), and it gets the job done with minimal overhead (23 lines of shell and 2 additional characters on the command line). 5. SRCDIR is a great idea for folks who are used to Gnu projects, but it doesn't work with the source tree. I learned that the hard way after wasting a day with slow compile machines... Hopefully there will be some helpful info in there for you... Cheers, -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d1003012331t607c3950h2e42c9e1ee2980db>