Fixes lot of things in the toolchain, etc.
Adding testsuites.
op = OptionParser()
+# toolchain mode
+op.add_option("--toolchain", action="store_const", const=1,
+ dest="toolchain", default=0, help="toolchain mode")
+
# verbosity
op.add_option("-v", "--verbose", action="store_const", const=2,
dest="verbose", default=1, help="verbose build")
self.log = logging.getLogger()
self.config = config
+ self.config["toolchain"] = self.options.toolchain
self.setup_logging()
self.log.info("Started naoki on %s" % time.strftime("%a, %d %b %Y %H:%M:%S"))
elif action == "list-groups":
print "\n".join(package.groups())
+ elif action == "list-tree":
+ for a in package.deptree(package.list()):
+ print a
+
elif action == "rebuild":
+ if not self.packages:
+ self.packages = package.list()
self.build()
+
def build(self):
requeue = []
+ self.packages = package.depsort(self.packages)
while True:
if not self.packages:
return
build = Build(self.packages.pop(0))
if build.package.isBuilt:
+ if self.options.toolchain:
+ self.log.info("Skipping already built package %s..." % build.package.name)
+ continue
self.log.warn("Package is already built. Will overwrite.")
+
+ #if not build.package.canBuild:
+ # self.log.warn("Cannot build package %s. Requeueing. %s" % (build.package.name, build.package.toolchain_deps))
+ # self.packages.append(build.package)
+ # continue
self.log.info("Building %s..." % build.package.name)
build.build()
def init(self):
self.environment.init()
- self.extractAll()
-
+ if not self.package.toolchain:
+ self.extractAll()
+
def extractAll(self):
packages = self.package.deps + self.package.build_deps
for pkg in config["mandatory_packages"]:
def build(self):
self.package.download()
self.init()
- self.make("package")
+ self.environment.make("package")
- def make(self, target):
- file = self.package.filename.replace(BASEDIR, "/usr/src")
- cmd = "make --no-print-directory -C %s -f %s %s" % (os.path.dirname(file),
- file, target,)
- self.environment.doChroot(cmd)
self.package = package
self.config = config
+ # Indication if we run in toolchain mode
+ self.toolchain = self.package.toolchain
+
# mount/umount
- self.umountCmds = [
+ self.umountCmds = []
+ self.mountCmds = []
+
+ if not self.toolchain:
+ self.umountCmds.extend([
+ "umount -n %s" % self.chrootPath("tools_i686"),
"umount -n %s" % self.chrootPath("proc"),
"umount -n %s" % self.chrootPath("sys"),
"umount -n %s" % self.chrootPath("usr", "src", "cache"),
"umount -n %s" % self.chrootPath("usr", "src", "pkgs"),
"umount -n %s" % self.chrootPath("usr", "src", "src"),
"umount -n %s" % self.chrootPath("usr", "src", "tools"),
- ]
- self.mountCmds = [
+ ])
+ self.mountCmds.extend([
+ "mount -n --bind %s/tools_i686 %s" % (TOOLCHAINSDIR, self.chrootPath("tools_i686")),
"mount -n -t proc naoki_chroot_proc %s" % self.chrootPath("proc"),
"mount -n -t sysfs naoki_chroot_sysfs %s" % self.chrootPath("sys"),
- "mount -n --bind -o ro %s %s" % (os.path.join(CACHEDIR), self.chrootPath("usr", "src", "cache")),
- "mount -n --bind -o ro %s %s" % (os.path.join(PACKAGESDIR), self.chrootPath("usr", "src", "packages")),
- "mount -n --bind -o ro %s %s" % (os.path.join(PKGSDIR), self.chrootPath("usr", "src", "pkgs")),
- "mount -n --bind -o ro %s %s" % (os.path.join(BASEDIR, "src"), self.chrootPath("usr", "src", "src")),
- "mount -n --bind -o ro %s %s" % (os.path.join(TOOLSDIR), self.chrootPath("usr", "src", "tools")),
- ]
+ "mount -n --bind %s %s" % (os.path.join(CACHEDIR), self.chrootPath("usr", "src", "cache")),
+ "mount -n --bind %s %s" % (os.path.join(PACKAGESDIR), self.chrootPath("usr", "src", "packages")),
+ "mount -n --bind %s %s" % (os.path.join(PKGSDIR), self.chrootPath("usr", "src", "pkgs")),
+ "mount -n --bind %s %s" % (os.path.join(BASEDIR, "src"), self.chrootPath("usr", "src", "src")),
+ "mount -n --bind %s %s" % (os.path.join(TOOLSDIR), self.chrootPath("usr", "src", "tools")),
+ ])
self.buildroot = "buildroot.%d" % random.randint(0, 1024)
self.log = None
self.chrootPath("sbin"),
self.chrootPath("sys"),
self.chrootPath("tmp"),
+ self.chrootPath("tools_i686"),
self.chrootPath("usr/src/cache"),
self.chrootPath("usr/src/packages"),
self.chrootPath("usr/src/pkgs"),
)
for item in files:
util.touch(self.chrootPath(item))
-
+
self._setupDev()
self._setupUsers()
self._setupToolchain()
pass
def make(self, target):
- file = self.package.filename.replace(BASEDIR, "/usr/src")
- try:
- self._mountall()
- self.doChroot("make --no-print-directory -C %s -f %s %s" % \
- (os.path.dirname(file), file, target), shell=True)
- finally:
- self._umountall()
+ file = self.package.filename
+ if not self.toolchain:
+ file = "/usr/src%s" % file[len(BASEDIR):]
+
+ return self.doChroot("make --no-print-directory -C %s -f %s %s" % \
+ (os.path.dirname(file), file, target), shell=True)
def doChroot(self, command, shell=True, *args, **kwargs):
ret = None
env = config.environment.copy()
env.update({
"HOME" : "/root",
- "PATH" : "/sbin:/bin:/usr/sbin:/usr/bin:/tools_i686/sbin:/tools_i686/bin",
- "TERM" : os.environ["TERM"],
- "PS1" : os.environ.get("PS1", "\u:\w\$ "),
"BASEDIR" : "/usr/src",
- "BUILDROOT" : "/%s" % self.buildroot,
"PKGROOT" : "/usr/src/pkgs",
- "CHROOT" : "1",
+ "TOOLS_DIR" : "/tools_i686",
+ "TARGET" : "i686-ipfire-linux-gnu",
+ "TARGET_MACHINE" : "i686",
})
+ if self.toolchain:
+ env.update({
+ "PATH" : "/tools_i686/sbin:/tools_i686/bin:%s" % os.environ["PATH"],
+ "TOOLCHAIN" : "1",
+ "PKGROOT" : PKGSDIR,
+ "ROOT" : self.chrootPath(),
+ "BASEDIR" : BASEDIR,
+ })
+ else:
+ env.update({
+ "PATH" : "/sbin:/bin:/usr/sbin:/usr/bin:/tools_i686/sbin:/tools_i686/bin",
+ "BUILDROOT" : "/%s" % self.buildroot,
+ "CHROOT" : "1",
+ })
if kwargs.has_key("env"):
env.update(kwargs.pop("env"))
self._mountall()
+
+ if not self.toolchain and not kwargs.has_key("chrootPath"):
+ kwargs["chrootPath"] = self.chrootPath()
- ret = util.do(command, chrootPath=self.chrootPath(),
+ ret = util.do(command,
shell=shell, env=env, logger=self.log, *args, **kwargs)
finally:
return ret
+ do = doChroot
+
def chrootPath(self, *args):
return os.path.join(BUILDDIR, "environments", self.package.id, *args)
+ path = chrootPath
+
def _setupLogging(self):
logfile = os.path.join(LOGDIR, self.package.id, "build.log")
if not os.path.exists(os.path.dirname(logfile)):
self.log.addHandler(fh)
def _setupDev(self):
+ if self.toolchain:
+ return
+
# files in /dev
util.rm(self.chrootPath("dev"))
util.mkdir(self.chrootPath("dev", "pts"))
self.mountCmds.append(devMntCmd)
def _setupUsers(self):
+ if self.toolchain:
+ return
+
## XXX Could be done better
self.log.debug("Creating users")
f = open("/etc/passwd")
f.close()
def _setupToolchain(self):
- if os.path.exists(self.chrootPath("tools_i686")):
- return
-
- self.log.debug("Extracting toolchain...")
-
- util.do("tar xfz %s -C %s" % (TOOLCHAIN_TARBALL, self.chrootPath()),
- shell=True)
-
symlinks = (
"bin/bash",
"bin/sh",
LOGDIR = os.path.join(BASEDIR, "logs")
PKGSDIR = os.path.join(BASEDIR, "pkgs")
PACKAGESDIR = os.path.join(BUILDDIR, "packages")
+TOOLCHAINSDIR = os.path.join(BUILDDIR, "toolchains")
TOOLSDIR = os.path.join(BASEDIR, "tools")
TARBALLDIR = os.path.join(CACHEDIR, "tarballs")
CONFIGFILE = os.path.join(CONFIGDIR, "naoki.conf")
-TOOLCHAIN_TARBALL = os.path.join(BUILDDIR, "tools_i686.tar.gz")
-
class Config(object):
_items = {
+ "toolchain" : False,
"mandatory_packages" : [
"core/bash",
"core/gcc",
@property
def environment(self):
return {
+ "TERM" : os.environ["TERM"],
+ "PS1" : os.environ.get("PS1", "\u:\w\$ "),
+ #
"DISTRO_NAME" : self["distro_name"],
"DISTRO_SNAME" : self["distro_sname"],
"DISTRO_EPOCH" : self["distro_epoch"],
for dir in os.listdir(PKGSDIR):
if not os.path.isdir(os.path.join(PKGSDIR, dir)):
continue
- if dir == "toolchain":
- continue #XXX
+
+ # If we work in toolchain mode we don't return the other
+ # packages and if we are not, we don't return the toolchain packages.
+ if config["toolchain"]:
+ if dir != "toolchain":
+ continue
+ else:
+ if dir == "toolchain":
+ continue
for package in os.listdir(os.path.join(PKGSDIR, dir)):
package = os.path.join(dir, package)
return pkgs
def find(s):
+ if not s:
+ return
+
p = Package(s)
if p in list():
return p
for package in list():
- if package.name.endswith("%s" % s):
+ if os.path.basename(package.name) == s:
return package
def groups():
deps.sort()
return deps
+def deptree(packages):
+ ret = [packages]
+
+ while True:
+ next = []
+ stage = ret[-1][:]
+ for package in stage[:]:
+ for dep in package.getAllDeps(recursive=False):
+ if dep in ret[-1]:
+ stage.remove(package)
+ next.append(package)
+ break
+
+ ret[-1] = sorted(stage)
+ if next:
+ ret.append(sorted(next))
+ continue
+
+ break
+
+ return ret
+
+def depsort(packages):
+ ret = []
+ for l1 in deptree(packages):
+ ret.extend(l1)
+ return ret
+
class Package(object):
info_str = """\
Name : %(name)s
deps.append(package)
return depsolve(deps, recursive)
+ def getAllDeps(self, recursive=True):
+ if self.toolchain:
+ return depsolve(self.toolchain_deps, recursive)
+
+ return depsolve(self.deps + self.build_deps, recursive)
+
@property
def build_deps(self):
deps = []
for package in self.fetch("PKG_BUILD_DEPENDENCIES").split(" "):
- deps.append(find(package))
+ package = find(package)
+ if package:
+ deps.append(package)
deps.sort()
return deps
+ @property
+ def toolchain_deps(self):
+ deps = []
+ for package in self.fetch("PKG_TOOLCHAIN_DEPENDENCIES").split(" "):
+ package = find(package)
+ if package:
+ deps.append(package)
+
+ deps.sort()
+ return deps
+
@property
def url(self):
return self.fetch("PKG_URL")
@property
def isBuilt(self):
+ if self.toolchain:
+ return os.path.exists(self.toolchain_file)
+
for item in self.package_files:
if not os.path.exists(os.path.join(PACKAGESDIR, item)):
return False
@property
def canBuild(self):
+ if self.toolchain:
+ for dep in self.toolchain_deps:
+ if not dep.isBuilt:
+ return False
+ return True
+
deps = self.deps + self.build_deps
for dep in deps:
if not dep.isBuilt:
getLog().debug("Extracting %s..." % self.name)
util.do("%s --root=%s %s" % (os.path.join(TOOLSDIR, "decompressor"),
dest, " ".join(files)), shell=True)
+
+ @property
+ def toolchain(self):
+ if self.name.startswith("toolchain"):
+ return True
+ return False
+
+ @property
+ def toolchain_file(self):
+ return os.path.join(TOOLCHAINSDIR, "tools_i686", "built", self.id)
@echo "#####################################################################"
endef
+define DO_TEST
+ @echo "#####################################################################"
+ @echo "# $(PKG_NAME) - Test started"
+ @echo "#####################################################################"
+
+ $(STAGE_TEST)
+
+ @echo "#####################################################################"
+ @echo "# $(PKG_NAME) - Test finished"
+ @echo "#####################################################################"
+endef
+
define DO_INSTALL
@echo "#####################################################################"
@echo "# $(PKG_NAME) - Install started"
$(if $(PKG_PATCHES),$(DO_PATCHES))
$(STAGE_PREPARE_CMDS)
+ $(STAGE_PREPARE_CMDS2)
endef
define STAGE_BUILD
@echo "PKG_REL=\"$(PKG_REL)\""
@echo "PKG_SUMMARY=\"$(strip $(PKG_SUMMARY))\""
@echo "PKG_URL=\"$(PKG_URL)\""
-ifeq "$(TOOLCHAIN)" "1"
@echo "PKG_TOOLCHAIN_DEPENDENCIES=\"$(PKG_TOOLCHAIN_DEPS)\""
-endif
$(OBJECTS):
@echo "Object file \"$@\" is required." >&2
$(STAGE_DONE): $(OBJECTS)
$(if $(STAGE_PREPARE),$(DO_PREPARE))
$(if $(STAGE_BUILD),$(DO_BUILD))
+ $(if $(STAGE_TEST),$(DO_TEST))
$(if $(STAGE_INSTALL),$(DO_INSTALL))
@touch $@
define STAGE_PREPARE_CMDS
cd $(DIR_APP) && sed -i 's@\(ln -s -f \)\$$(PREFIX)/bin/@\1@' Makefile
- cd $(DIR_APP) && sed -e "s/$$(CC) -shared/& $(CFLAGS)/" -i Makefile-libbz2_so
+ cd $(DIR_APP) && sed -e "s/\$$(CC) -shared/& $(CFLAGS)/" -i Makefile-libbz2_so
endef
define STAGE_BUILD
CFLAGS= \
CXXFLAGS= \
../$(THISAPP)/configure \
- $(CONFIGURE_ARCH) \
--prefix=/usr \
--libexecdir=/usr/lib/glibc \
--disable-profile \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
endef
+define STAGE_TEST
+ cd $(DIR_SRC)/glibc-build && cp -vf ../$(THISAPP)/iconvdata/gconv-modules iconvdata
+ cd $(DIR_SRC)/glibc-build && make -k check 2>&1 | tee glibc-check-log
+ cd $(DIR_SRC)/glibc-build && grep Error glibc-check-log
+endef
+
define STAGE_INSTALL
cd $(DIR_SRC)/glibc-build && make install install_root=$(BUILDROOT)
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make LIBTOOL="libtool --tag=CC" #$(PARALLELISMFLAGS)
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--enable-shared
+++ /dev/null
-
-PKG_TOOLCHAIN_DEPS += gcc perl
-
-include ../../core/autoconf/autoconf.nm
-
-define STAGE_BUILD
- cd $(DIR_APP) && \
- ./configure \
- $(CONFIGURE_ARCH) \
- --prefix=$(TOOLS_DIR)
-
- cd $(DIR_APP) && make $(PARALLELISMFLAGS)
-endef
+++ /dev/null
-
-PKG_TOOLCHAIN_DEPS += autoconf gcc glibc perl
-
-include ../../core/automake/automake.nm
-
-define STAGE_BUILD
- cd $(DIR_APP) && \
- ./configure \
- $(CONFIGURE_ARCH) \
- --prefix=$(TOOLS_DIR)
-
- cd $(DIR_APP) && make $(PARALLELISMFLAGS)
-endef
cd $(DIR_APP) && \
ac_cv_func_working_mktime=yes \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--without-bash-malloc
cd $(DIR_APP) && make #$(PARALLELISMFLAGS)
endef
+# Test hangs forever
+#define STAGE_TEST
+# cd $(DIR_APP) && make tests
+#endef
+
define STAGE_INSTALL
cd $(DIR_APP) && make install
-PKG_TOOLCHAIN_DEPS += kernel-headers
+PKG_TOOLCHAIN_DEPS = # No deps
include ../../core/binutils/binutils.nm
define STAGE_BUILD
cd $(DIR_SRC)/binutils-build && \
- CC="gcc -B/usr/bin/" \
../$(THISAPP)/configure \
- $(CONFIGURE_ARCH) \
--target=$(TARGET) \
--prefix=$(TOOLS_DIR) \
--disable-nls \
--disable-werror
- cd $(DIR_SRC)/binutils-build && make tooldir=$(TOOLS_DIR) $(PARALLELISMFLAGS)
+ cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
endef
define STAGE_INSTALL
- cd $(DIR_SRC)/binutils-build && make tooldir=$(TOOLS_DIR) install
+ cd $(DIR_SRC)/binutils-build && make install
endef
-PKG_TOOLCHAIN_DEPS += binutils-static glibc zlib
-
include ../binutils-static/binutils-static.nm
+PKG_TOOLCHAIN_DEPS = glibc
+
define STAGE_BUILD
cd $(DIR_SRC)/binutils-build && \
+ AR=$(TARGET)-ar \
+ CC="$(TARGET)-gcc -B$(TOOLS_DIR)/lib/" \
+ RANLIB=$(TARGET)-ranlib \
../$(THISAPP)/configure \
$(CONFIGURE_ARCH) \
--target=$(TARGET) \
--prefix=$(TOOLS_DIR) \
--with-lib-path=$(TOOLS_DIR)/lib \
--disable-nls \
- --enable-shared \
--disable-werror
- cd $(DIR_SRC)/binutils-build && make tooldir=$(TOOLS_DIR) $(PARALLELISMFLAGS)
+ cd $(DIR_SRC)/binutils-build && make $(PARALLELISMFLAGS)
endef
define STAGE_INSTALL
- cd $(DIR_SRC)/binutils-build && make tooldir=$(TOOLS_DIR) install
+ cd $(DIR_SRC)/binutils-build && make install
cd $(DIR_SRC)/binutils-build && make -C ld clean
cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/lib:/usr/lib
- cd $(DIR_SRC)/binutils-build && cp -v ld/.libs/ld-new $(TOOLS_DIR)/bin
+ cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin
endef
include ../../core/bzip2/bzip2.nm
+STAGE_PREPARE_CMDS =
+
define STAGE_BUILD
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
cd $(DIR_APP) && \
gl_cv_func_printf_directive_n=no \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--enable-install-program=hostname
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+# fails
+#define STAGE_TEST
+# cd $(DIR_APP) && make RUN_EXPENSIVE_TESTS=yes check
+#endef
+
define STAGE_INSTALL
cd $(DIR_APP) && make install
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--disable-static
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
+
define STAGE_INSTALL
cd $(DIR_APP) && make install
endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--libexecdir=$(TOOLS_DIR)/lib/findutils
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
-define STAGE_INSTALL
- cd $(DIR_APP) && make install
-endef
+# fails
+#define STAGE_TEST
+# cd $(DIR_APP) && make check
+#endef
cd $(DIR_APP) && \
ac_cv_func_working_mktime=yes \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--libexecdir=$(TOOLS_DIR)/lib
- cd $(DIR_APP) && echo "#define HAVE_LANGINFO_CODESET 1" >> config.h
- cd $(DIR_APP) && echo "#define HAVE_LC_MESSAGES 1" >> config.h
-
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
-PKG_TOOLCHAIN_DEPS += binutils-static kernel-headers
+PKG_TOOLCHAIN_DEPS += binutils-static
include ../../core/gcc/gcc.nm
+GMP = gmp-4.3.1
+MPFR = mpfr-2.4.1
+
+PKG_OBJECTS += $(GMP).tar.bz2 $(MPFR).tar.bz2
+
+define STAGE_PREPARE_CMDS
+ -mkdir -pv $(DIR_SRC)/gcc-build
+
+ cd $(DIR_APP) && $(DO_EXTRACT) $(DIR_DL)/$(GMP).tar.bz2
+ cd $(DIR_APP) && $(DO_EXTRACT) $(DIR_DL)/$(MPFR).tar.bz2
+ cd $(DIR_APP) && ln -svf $(GMP) gmp
+ cd $(DIR_APP) && ln -svf $(MPFR) mpfr
+endef
+
define STAGE_BUILD
## Enable -fPIC by default
cd $(DIR_APP) && sed 's/^\(#define CC1_SPEC.*\)\("\)$$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \
# libssp has no use with new versions of Glibc. Glibc completely replaces all
# functions in libssp, linking to libssp will cause conflicts with libc, so
- # libssp is a waste of space... so --disable-libssp.
+ # libssp is a waste of space... so --disable-libssp.
cd $(DIR_SRC)/gcc-build && \
- CC="gcc -B/usr/bin/" \
../$(THISAPP)/configure \
- $(CONFIGURE_ARCH) \
--target=$(TARGET) \
$(CONFIG_CPU) \
--prefix=$(TOOLS_DIR) \
- --with-local-prefix=$(TOOLS_DIR) \
- --libexecdir=$(TOOLS_DIR)/lib \
+ --disable-decimal-float \
+ --disable-libgomp \
+ --disable-libmudflap \
+ --disable-libssp \
--enable-languages=c \
- --enable-shared \
+ --disable-threads \
+ --disable-multilib \
+ --disable-shared \
--disable-nls \
- --disable-libssp \
- --disable-werror \
- --disable-static \
$(CONFIGURE_ARGS)
cd $(DIR_SRC)/gcc-build && make $(PARALLELISMFLAGS)
define STAGE_INSTALL
cd $(DIR_SRC)/gcc-build && make install
- ln -fvs gcc $(TOOLS_DIR)/bin/cc
-
- $(TARGET)-gcc -dumpspecs | sed \
- -e 's@$(LINKER)@$(TOOLS_DIR)&@g' \
- > $$(dirname $$($(TARGET)-gcc -print-libgcc-file-name))/specs
+ ln -svf libgcc.a $$($(TARGET)-gcc -print-libgcc-file-name | sed -e "s/libgcc/&_eh/")
endef
+include ../gcc-static/gcc-static.nm
+
PKG_TOOLCHAIN_DEPS += binutils glibc
-include ../gcc-static/gcc-static.nm
+PKG_PATCHES = $(THISAPP)-branch-startfiles-1.patch
+
+define STAGE_PREPARE_CMDS2
+ cd $(DIR_APP) && sed \
+ -e "s@\./fixinc\.sh@-c true@" \
+ -e "s/^T_CFLAGS =$$/& -fomit-frame-pointer/" \
+ -i gcc/Makefile.in
+
+ for file in $$(find $(DIR_APP)/gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h); do \
+ sed -i $$file \
+ -e "s@/lib\(64\)\?\(32\)\?/ld@$(TOOLS_DIR)&@g" \
+ -e "s@/usr@$(TOOLS_DIR)@g"; \
+ cat include-append >> $$file; \
+ done
+endef
define STAGE_BUILD
- cd $(DIR_APP) && sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
- cd $(DIR_APP) && sed 's/^XCFLAGS =$$/& -fomit-frame-pointer/' -i gcc/Makefile.in
- cd $(DIR_APP) && \
- for file in $$(find gcc/config -name linux64.h -o -name linux.h); do \
- cp -uv $$file{,.orig}; \
- sed -e 's@/lib\(64\)\?\(32\)\?/ld@$(TOOLS_DIR)&@g' \
- -e 's@/usr@$(TOOLS_DIR)@g' $$file.orig > $$file; \
- echo -e "\n#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR 0" >> $$file; \
- touch $$file.orig; \
- done
-
-#ifeq "$(MACHINE)" "x86_64"
-# # Remove multilib options and searchpath (/lib... /usr/lib...)
-# cd $(DIR_APP) && echo "" > gcc/config/i386/t-linux64
-# ## Enable -fPIC by default (why i have to do this again ???)
-# cd $(DIR_APP) && sed 's/^\(#define CC1_SPEC.*\)\("\)$$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \
-# -i gcc/config/i386/x86-64.h
-#endif
-
- # We need to do another bootstrap, so that everything in $(TOOLS_DIR) is hardened.
cd $(DIR_SRC)/gcc-build && \
+ AR=$(TARGET)-ar \
+ CC="$(TARGET)-gcc -B$(TOOLS_DIR)/lib/" \
+ RANLIB=$(TARGET)-ranlib \
../$(THISAPP)/configure \
- $(CONFIGURE_ARCH) \
- --target=$(TARGET) \
- $(CONFIG_CPU) \
--prefix=$(TOOLS_DIR) \
--with-local-prefix=$(TOOLS_DIR) \
- --libexecdir=$(TOOLS_DIR)/lib \
- --enable-espf \
--enable-clocale=gnu \
--enable-shared \
--enable-threads=posix \
--enable-__cxa_atexit \
--enable-languages=c,c++ \
--disable-libstdcxx-pch \
- --disable-bootstrap \
- --disable-werror \
- --disable-libssp \
- --disable-nls \
- --disable-static \
- $(CONFIGURE_ARGS)
+ --disable-multilib \
+ --disable-bootstrap
cd $(DIR_SRC)/gcc-build && make $(PARALLELISMFLAGS)
endef
define STAGE_INSTALL
cd $(DIR_SRC)/gcc-build && make install
+ ln -svf gcc $(TOOLS_DIR)/bin/cc
endef
--- /dev/null
+
+#undef STANDARD_INCLUDE_DIR
+#define STANDARD_INCLUDE_DIR 0
+#define STANDARD_STARTFILE_PREFIX_1 ""
+#define STANDARD_STARTFILE_PREFIX_2 ""
define STAGE_BUILD
cd $(DIR_APP)/gettext-tools && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--disable-shared
include ../../core/glibc/glibc.nm
define STAGE_BUILD
- # Glibc uses a hard coded path for /etc/ld.so.preload. To keep Glibc from
- # preloading libraries from the host machine perform the following command:
- cd $(DIR_APP) && sed -e "s@/etc/ld.so.preload@$(TOOLS_DIR)@" -i elf/rtld.c
-
cd $(DIR_SRC)/glibc-build && \
CFLAGS= \
CXXFLAGS= \
+ libc_cv_c_cleanup=yes \
+ libc_cv_forced_unwind=yes \
../$(THISAPP)/configure \
- $(CONFIGURE_ARCH) \
+ --host=$(TARGET) \
+ --build=$$(../$(THISAPP)/scripts/config.guess) \
--prefix=$(TOOLS_DIR) \
--libexecdir=$(TOOLS_DIR)/lib/$(PKG_NAME) \
--with-headers=$(TOOLS_DIR)/include \
- --with-binutils=$(TOOLS_DIR)/bin \
--disable-profile \
--enable-add-ons \
- --enable-kernel=$(OPTIMIZED_KERNEL) \
- --without-selinux \
- --without-gd \
- --enable-bind-now \
- --enable-stackguard-randomization
-
- # Our GCC is already passing -fPIC, and that's all we want for the libraries.
- # LDFLAGS.so is appended to so we don't build shared libraries with
- # DT_TEXTREL (and to tell us if something goes wrong). For now we only build
- # the libraries, not the programs:
- echo "build-programs=no" \
- >> $(DIR_SRC)/glibc-build/configparms
+ --enable-kernel=$(OPTIMIZED_KERNEL)
- cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(PARALLELISMFLAGS) \
- CFLAGS="-O2 -DPIC -fno-stack-protector -U_FORTIFY_SOURCE" \
- CXXFLAGS="-O2 -DPIC -fno-stack-protector -U_FORTIFY_SOURCE"
-
- # Then build the programs with hardening, so everything possible in
- # $(TOOLS_DIR) is hardened:
- echo "CFLAGS = $(CFLAGS)" > $(DIR_SRC)/glibc-build/configparms
- echo "CXXFLAGS = $(CXXFLAGS)" >> $(DIR_SRC)/glibc-build/configparms
- cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(PARALLELISMFLAGS) \
- CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)"
+ cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=$(PARALLELISMFLAGS)
endef
define STAGE_INSTALL
touch $(TOOLS_DIR)/etc/ld.so.conf
cd $(DIR_SRC)/glibc-build && make install
+
+ $(TARGET)-gcc -dumpspecs | \
+ sed -e "s@/lib\(64\)\?/ld@$(TOOLS_DIR)&@g" \
+ -e "/^\*cpp:$$/{n;s,$$, -isystem $(TOOLS_DIR)/include,}" > \
+ $$(dirname $$($(TARGET)-gcc -print-libgcc-file-name))/specs
endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--disable-perl-regexp \
--without-included-regex
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
DEFS=NO_ASM \
CPPFLAGS="-DHAVE_LSTAT" \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
+
define STAGE_INSTALL
cd $(DIR_APP) && make install
endef
-PKG_TOOLCHAIN_DEPS = # Depends on nothing
+PKG_TOOLCHAIN_DEPS = gcc-static
include ../../core/kernel-headers/kernel-headers.nm
CPPFLAGS="-D_GNU_SOURCE" \
gl_cv_func_printf_directive_n=no \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+# fails
+#define STAGE_TEST
+# cd $(DIR_APP) && make check
+#endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--with-shared \
--without-debug \
--without-ada \
--enable-overwrite \
--enable-widec \
- --without-cxx-binding \
- --enable-symlinks \
- --disable-root-environ \
- --disable-static
+ --enable-symlinks
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
+
define STAGE_INSTALL
cd $(DIR_APP) && make install
endef
include ../../core/perl/perl.nm
+PKG_PATCHES = $(THISAPP)-libc-1.patch
+
+STAGE_PREPARE_CMDS =
+
define STAGE_BUILD
-mkdir -pv $(DIR_SRC)/perl-build
# be interactive.
cd $(DIR_SRC)/perl-build && \
$(DIR_APP)/Configure \
- -Dcc=$(TARGET)-gcc \
-Dprefix=$(TOOLS_DIR) \
- -Dlibc=$(shell ls $(TOOLS_DIR)/lib/libc-*.so) \
- -Ulocincpth \
- -Uloclibpth \
- -Dglibpth="$(TOOLS_DIR)/lib" \
- -Dusrinc="$(TOOLS_DIR)/include" \
+ -Dstatic_ext="Data/Dumper Fcntl IO POSIX" \
-Dmksymlinks \
- -d -e
+ -d -e -s
- cd $(DIR_SRC)/perl-build && make #$(PARALLELISMFLAGS)
+ cd $(DIR_SRC)/perl-build && make perl utilities ext/Errno/pm_to_blib #$(PARALLELISMFLAGS)
endef
define STAGE_INSTALL
- cd $(DIR_SRC)/perl-build && make LNS="cp" install
+ cd $(DIR_SRC)/perl-build && cp -vf perl pod/pod2man $(TOOLS_DIR)/bin/
+ -mkdir -pv $(TOOLS_DIR)/lib/perl5/$(PKG_VER)
+ cd $(DIR_APP) && cp -Rvf lib/* $(TOOLS_DIR)/lib/perl5/$(PKG_VER)
endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--without-included-regex
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
-PKG_TOOLCHAIN_DEPS += gcc glibc
+PKG_TOOLCHAIN_DEPS += acl attr gcc glibc
include ../../core/tar/tar.nm
define STAGE_BUILD
- # Normally the 'rmt' programs goes in sbin/.
- cd $(DIR_APP) && LDFLAGS="-z muldefs" \
+ cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
- --prefix=$(TOOLS_DIR) \
- --libexecdir=$(TOOLS_DIR)/bin
+ --prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+# fails
+#define STAGE_TEST
+# cd $(DIR_APP) && make check
+#endef
define STAGE_BUILD
cd $(DIR_APP) && \
- LDFLAGS="-lncursesw" \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR)
cd $(DIR_APP) && make $(PARALLELISMFLAGS)
endef
+
+define STAGE_TEST
+ cd $(DIR_APP) && make check
+endef
define STAGE_BUILD
cd $(DIR_APP) && \
./configure \
- $(CONFIGURE_ARCH) \
--prefix=$(TOOLS_DIR) \
--disable-static
+++ /dev/null
-
-PKG_TOOLCHAIN_DEPS += glibc
-
-include ../../core/zlib/zlib.nm
-
-define STAGE_BUILD
- cd $(DIR_APP) && sed -e "s/^AC_PROG_CXX$$//g" -i configure.ac
- cd $(DIR_APP) && autoreconf --install --force
- cd $(DIR_APP) && \
- ac_cv_func_working_mktime=yes \
- ./configure \
- $(CONFIGURE_ARCH) \
- --prefix=$(TOOLS_DIR) \
- --disable-static
-
- cd $(DIR_APP) && make $(PARALLELISMFLAGS)
-endef
-
-define STAGE_INSTALL
- cd $(DIR_APP) && make install
-endef