Index: rtems/config/databases/sqlite.bset
===================================================================
--- rtems/config/databases/sqlite.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/databases/sqlite.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for Sqlite
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build Sqlite
+#
+databases/sqlite-3.8.8.1-1
Index: rtems/config/graphics/freetype2.bset
===================================================================
--- rtems/config/graphics/freetype2.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/freetype2.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for freetype
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build freetype.
+#
+graphics/freetype-2.4.10-1.cfg
Index: rtems/config/graphics/graphics-all.bset
===================================================================
--- rtems/config/graphics/graphics-all.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/graphics-all.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,9 @@
+#
+# All RTEMS Graphics Build Sets
+#
+
+graphics/libjpeg
+graphics/libpng
+graphics/libtiff
+graphics/t1lib
+graphics/nxlib
Index: rtems/config/graphics/libjpeg.bset
===================================================================
--- rtems/config/graphics/libjpeg.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/libjpeg.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for libjpeg
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build libjpeg.
+#
+graphics/libjpeg-9a-1.cfg
Index: rtems/config/graphics/libpng-1.6.21-1.cfg
===================================================================
--- rtems/config/graphics/libpng-1.6.21-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/libpng-1.6.21-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,22 @@
+#
+# libpng 1.6.21
+#
+
+%if %{release} == %{nil}
+ %define release 1
+%endif
+
+%include %{_configdir}/rtems-bsp.cfg
+
+#
+# libpng Version
+#
+%define libpng_version 1.6.21
+%define libpng_src_dir_revision 16
+
+#%hash md5 libpng-%{libpng_version}.tar.gz 6652e428d1d3fc3c6cb1362159b1cf3b
+
+#
+# libpng Build configuration
+#
+%include %{_configdir}/libpng-1.cfg
Index: rtems/config/graphics/libpng.bset
===================================================================
--- rtems/config/graphics/libpng.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/libpng.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for libpng
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build libpng.
+#
+graphics/libpng-1.6.21-1.cfg
Index: rtems/config/graphics/libtiff.bset
===================================================================
--- rtems/config/graphics/libtiff.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/libtiff.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for libtiff
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build libtiff.
+#
+graphics/libtiff-4.0.2-1.cfg
Index: rtems/config/graphics/microwindows-0.93-dev-1.cfg
===================================================================
--- rtems/config/graphics/microwindows-0.93-dev-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ rtems/config/graphics/microwindows-0.93-dev-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -14,4 +14,12 @@
 %define microwindows_version 0.93-dev
 
+%define rtems_git_tools_4_11 %{rtems_http_git}/rtems-tools/plain/tools/4.11
+
+%source set microwindows git://github.com/alex-sever-h/microwin.git
+%patch add microwindows %{rtems_git_tools_4_11}/microwindows/microwindows-0.93-dev.diff
+%hash md5 microwindows-0.93-dev.diff 5b06e77d9ee42c8ff0032bba07d01c1a
+%patch add microwindows %{rtems_git_tools_4_11}/microwindows/microwindows-0.93-dev-without-keyboard.diff
+%hash md5 microwindows-0.93-dev-without-keyboard.diff a675f55750754e1cd82a17496f0e8fab
+
 #
 # microwindows Build configuration
Index: rtems/config/graphics/microwindows.bset
===================================================================
--- rtems/config/graphics/microwindows.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/microwindows.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,16 @@
+#
+# Build set for Nano-X Window System
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build microwindows.
+#
+graphics/freetype2
+graphics/microwindows-0.93-dev-1.cfg
Index: rtems/config/graphics/nxlib.bset
===================================================================
--- rtems/config/graphics/nxlib.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/nxlib.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,16 @@
+#
+# Build set for nxlib
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build nxlib.
+#
+graphics/microwindows
+graphics/nxlib-0.47-dev-1.cfg
Index: rtems/config/graphics/t1lib-5.1.2-1.cfg
===================================================================
--- rtems/config/graphics/t1lib-5.1.2-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ rtems/config/graphics/t1lib-5.1.2-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -17,4 +17,10 @@
 
 #
+# Patch for RTEMS.
+#
+%patch add t1lib https://raw.githubusercontent.com/yangqiao/rtems-tools/graphics/tools/4.11/t1lib/t1lib-5.1.2.diff
+%hash md5 t1lib-5.1.2.diff 98eeed85780227adf8525deab3679877
+
+#
 # t1lib Build configuration
 #
Index: rtems/config/graphics/t1lib.bset
===================================================================
--- rtems/config/graphics/t1lib.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/graphics/t1lib.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for adobe type 1 library
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build t1lib.
+#
+graphics/t1lib-5.1.2-1.cfg
Index: rtems/config/net-mgmt/net-snmp.bset
===================================================================
--- rtems/config/net-mgmt/net-snmp.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/net-mgmt/net-snmp.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,20 @@
+#
+# Build set for NetSNMP
+#
+
+%define release 1
+
+#
+# RTEMS Version
+#
+%define rtems_version 4.11
+
+#
+# The RTEMS URL paths.
+#
+%include rtems-urls.bset
+
+#
+# Build NetSNMP.
+#
+net-mgmt/net-snmp-5.7.2.1-1
Index: rtems/config/net/lwip.bset
===================================================================
--- rtems/config/net/lwip.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/net/lwip.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for LWIP
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build LWIP.
+#
+net/lwip-1-1.cfg
Index: rtems/config/net/ntp.bset
===================================================================
--- rtems/config/net/ntp.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/net/ntp.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for NTP
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build NTP.
+#
+net/ntp-4.2.6p5-1
Index: rtems/config/net/protobuf.bset
===================================================================
--- rtems/config/net/protobuf.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/net/protobuf.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,15 @@
+#
+# Build set for Google Protocol Buffers
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build Protocol Buffers.
+#
+net/protobuf-2.6.1-1
Index: rtems/config/rtems-package.bset
===================================================================
--- rtems/config/rtems-package.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
+++ rtems/config/rtems-package.bset	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -0,0 +1,13 @@
+#
+# Build Set Base defines for RTEMS Packages
+#
+
+#
+# Get the version of RTEMS
+#
+%include rtems-version.bset
+
+#
+# Pick up the RTEMS URLs.
+#
+%include rtems-urls.bset
Index: source-builder/config/freetype-1.cfg
===================================================================
--- source-builder/config/freetype-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ source-builder/config/freetype-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -42,5 +42,8 @@
   %{host_build_flags}
 
-   ../${source_dir_freetype}/configure \
+  %ifos freebsd
+  GNUMAKE=%{__make} \
+  %endif
+  ../${source_dir_freetype}/configure \
     --host=%{_host} \
     --prefix=%{_prefix} \
Index: source-builder/config/libpng-1.cfg
===================================================================
--- source-builder/config/libpng-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ source-builder/config/libpng-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -13,5 +13,5 @@
 Version:   %{libpng_version}
 Release:   %{release}
-URL:     http://www.libpng.org/
+URL:       http://www.libpng.org/
 BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
 
Index: source-builder/config/libtiff-1.cfg
===================================================================
--- source-builder/config/libtiff-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ source-builder/config/libtiff-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -43,5 +43,5 @@
   %{host_build_flags}
 
-  CFLAGS= CXXFLAGS= ../${source_dir_tiff}/configure \
+  ../${source_dir_tiff}/configure \
     --host=%{_host} \
     --prefix=%{_prefix} \
Index: source-builder/config/microwindows-1.cfg
===================================================================
--- source-builder/config/microwindows-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ source-builder/config/microwindows-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -19,9 +19,5 @@
 # microwindows Source
 #
-%source set microwindows git://github.com/alex-sever-h/microwin.git
-%patch add microwindows %{rtems_git_tools}/microwindows/microwindows-0.93-dev.diff
-%hash md5 microwindows-0.93-dev.diff 5b06e77d9ee42c8ff0032bba07d01c1a
-%patch add microwindows %{rtems_git_tools}/microwindows/microwindows-0.93-dev-without-keyboard.diff
-%hash md5 microwindows-0.93-dev-without-keyboard.diff a675f55750754e1cd82a17496f0e8fab
+%source set microwindows ftp://microwindows.censoft.com/pub/microwindows/microwindows-src-%{microwindows_version}.tar.gz
 
 #
@@ -39,5 +35,4 @@
 #
 # Build the source code.
-# The configure should be run in the source dir
 #
 %build
@@ -54,5 +49,5 @@
   export RTEMS_MAKEFILE_PATH=%{rtems_bsp_prefix}
 
-  make -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems -k all
+  %{__make} -f Makefile.rtems CONFIG=`pwd`/Configs/config.rtems -k all
 
   cd ${build_top}
Index: source-builder/config/t1lib-1.cfg
===================================================================
--- source-builder/config/t1lib-1.cfg	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ source-builder/config/t1lib-1.cfg	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -13,5 +13,5 @@
 Version:   %{t1lib_version}
 Release:   %{release}
-URL:     http://www.t1lib.org/
+URL:       http://www.t1lib.org/
 BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
 
@@ -20,6 +20,4 @@
 #
 %source set t1lib ftp://ftp.netbsd.org/pub/pkgsrc/distfiles/t1lib-%{t1lib_version}.tar.gz
-%patch add t1lib https://raw.githubusercontent.com/yangqiao/rtems-tools/graphics/tools/4.11/t1lib/t1lib-5.1.2.diff
-%hash md5 t1lib-5.1.2.diff 98eeed85780227adf8525deab3679877
 
 #
Index: source-builder/defaults.mc
===================================================================
--- source-builder/defaults.mc	(revision 70fc466b48186c2bf192f5bf656cbbd5da3270a2)
+++ source-builder/defaults.mc	(revision f5e724fc077261119129f7a830396d79536cc0f4)
@@ -199,11 +199,12 @@
 SB_SOURCE_DIR="%{_sourcedir}"
 SB_BUILD_DIR="%{_builddir}"
-# host == build, use build; host != build , host uses host and build uses build
+# host == build, use build; host != build, host uses host and build uses build
+SB_HOST_CPPFLAGS="%{host_includes}"
 SB_HOST_CFLAGS="%{host_cflags} %{host_includes}"
 SB_HOST_CXXFLAGS="%{host_cxxflags} %{host_includes}"
-SB_HOST_LDFLAGS="%{?host_ldflags:%{host_ldflags}}%{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
+SB_HOST_LDFLAGS="%{?host_ldflags:%{host_ldflags}} %{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
 SB_BUILD_CFLAGS="%{build_cflags} %{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include}"
 SB_BUILD_CXXFLAGS="%{build_cxxflags} %{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include}"
-SB_BUILD_LDFLAGS="%{?build_ldflags:%{build_ldflags}}%{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
+SB_BUILD_LDFLAGS="%{?build_ldflags:%{build_ldflags}} %{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
 SB_CFLAGS="${SB_BUILD_CFLAGS} %{build_includes}"
 SB_CXXFLAGS="${SB_BUILD_CXXFLAGS} %{build_includes}"
@@ -211,5 +212,5 @@
 SB_OS="%{_os}"
 export SB_SOURCE_DIR SB_BUILD_DIR SB_ARCH SB_OS
-export SB_HOST_CFLAGS SB_HOST_CXXFLAGS SB_HOST_LDFLAGS
+export SB_HOST_CPPFLAGS SB_HOST_CFLAGS SB_HOST_CXXFLAGS SB_HOST_LDFLAGS
 export SB_BUILD_CFLAGS SB_BUILD_CXXFLAGS SB_BUILD_LDFLAGS
 export SB_CFLAGS SB_CXXFLAGS
@@ -299,5 +300,7 @@
 build_directory:     none,    none,     '''
 if test "%{_build}" != "%{_host}" ; then
-  if test -z "%{_target}" ; then
+  # Cross-build (Xc) if no target or the host and target match.
+  # Canadian-cross (Cxc) if build, host and target are all different.
+  if test -z "%{_target}" -o "%{_host}" == "%{_target}" ; then
     build_dir="build-xc"
   else
@@ -317,8 +320,10 @@
   CC=$(echo "%{_host}-%{_host_cc}" | sed -e 's,-std=gnu99 ,,')
   CXX=$(echo "%{_host}-%{_host_cxx}" | sed -e 's,-std=gnu99 ,,')
+  CPPFLAGS="${SB_HOST_CPPFLAGS}"
   CFLAGS="${SB_HOST_CFLAGS}"
   CXXFLAGS="${SB_HOST_CXXFLAGS}"
   LDFLAGS="${SB_HOST_LDFLAGS}"
   # Host
+  CPPFLAGS_FOR_HOST="${SB_HOST_CPPFLAGS}"
   CFLAGS_FOR_HOST="${SB_HOST_CFLAGS}"
   CXXFLAGS_FOR_HOST="${SB_HOST_CXXFLAGS}"
@@ -341,6 +346,6 @@
   CXX_FOR_BUILD=${CXX}
 fi
-export CC CXX CFLAGS CXXFLAGS LDFLAGS
-export CC_FOR_HOST CXX_FOR_HOST CFLAGS_FOR_HOST CXXFLAGS_FOR_HOST LDFLAGS_FOR_HOST
+export CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
+export CC_FOR_HOST CXX_FOR_HOST CPPFLAGS_FOR_HOST CFLAGS_FOR_HOST CXXFLAGS_FOR_HOST LDFLAGS_FOR_HOST
 export CC_FOR_BUILD CXX_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD'''
 
