Special method for correctly installing headers needed by userspace(libc, etc.) into /usr/include

This commit is contained in:
Ozan Çağlayan
2009-04-09 13:08:19 +00:00
parent b2ee41167d
commit ee0140e66e
+45 -8
View File
@@ -105,11 +105,7 @@ def install():
pisitools.remove("/lib/modules/%s/source" % suffix) pisitools.remove("/lib/modules/%s/source" % suffix)
pisitools.remove("/lib/modules/%s/build" % suffix) pisitools.remove("/lib/modules/%s/build" % suffix)
# Install kernel image # Install kernel image
# TODO: For supporting more architectures in the future, we'll need a more
# flexible method here instead of hardcoding x86.
pisitools.insinto("/boot/", "arch/x86/boot/bzImage", "kernel-%s" % suffix) pisitools.insinto("/boot/", "arch/x86/boot/bzImage", "kernel-%s" % suffix)
@@ -131,7 +127,7 @@ def installHeaders(extra=[]):
( (
" -prune -o -path ".join(["'./%s/*'" % l for l in pruned]), " -prune -o -path ".join(["'./%s/*'" % l for l in pruned]),
" -o -name ".join(["'%s'" % k for k in wanted]) " -o -name ".join(["'%s'" % k for k in wanted])
) + " | cpio -pd --preserve-modification-time %s" % destination ) + " | cpio -pVd --preserve-modification-time %s" % destination
shelltools.system(find_cmd) shelltools.system(find_cmd)
@@ -145,14 +141,53 @@ def installHeaders(extra=[]):
# Finally copy the include directories found in arch/ # Finally copy the include directories found in arch/
shelltools.system("(find arch -name include -type d -print | \ shelltools.system("(find arch -name include -type d -print | \
xargs -n1 -i: find : -type f) | \ xargs -n1 -i: find : -type f) | \
cpio -pd --preserve-modification-time %s" % destination) cpio -pVd --preserve-modification-time %s" % destination)
# Settle the correct build symlink to this headers # Settle the correct build symlink to this headers
pisitools.dosym("/%s" % headersDirectoryName, "/lib/modules/%s/build" % suffix) pisitools.dosym("/%s" % headersDirectoryName, "/lib/modules/%s/build" % suffix)
def installLibcHeaders():
headers_tmp = os.path.join(get.installDIR(), 'tmp-headers')
headers_dir = os.path.join(get.installDIR(), 'usr/include')
make_cmd = "O=%s INSTALL_HDR_PATH=%s/install" % (headers_tmp, headers_tmp)
# Cleanup temporary header directory
shelltools.system("rm -rf %s" % headers_tmp)
# Create directories
shelltools.makedirs(headers_tmp)
shelltools.makedirs(headers_dir)
# make defconfig and install the headers
autotools.make("%s defconfig" % make_cmd)
autotools.rawInstall(make_cmd, "headers_install")
oldwd = os.getcwd()
shelltools.cd(os.path.join(headers_tmp, "install", "include"))
shelltools.system("find . -name '.' -o -name '.*' -prune -o -print | \
cpio -pVd --preserve-modification-time %s" % headers_dir)
shelltools.cd(oldwd)
# FIXME: Do we really need to delete those directories below?
"""
# remove all directories other than asm/asm-generic and linux
# FIXME: Check this.
for directory in shelltools.ls("%s/usr/include/" % get.installDIR()):
if directory not in ["asm", "asm-generic", "linux"]:
pisitools.removeDir("/usr/include/%s" % directory)
"""
# Remove tmp directory
shelltools.system("rm -rf %s" % headers_tmp)
def installSource(): def installSource():
destination = "usr/src/linux-source-%s" % __getSuffix() destination = "usr/src/linux-source-%s" % __getSuffix()
# Copy the whole source directory
pisitools.dodir("/usr/src") pisitools.dodir("/usr/src")
shelltools.copytree("../%s/" % os.path.basename(get.curDIR()), os.path.join(get.installDIR(), destination)) shelltools.copytree("../%s/" % os.path.basename(get.curDIR()), os.path.join(get.installDIR(), destination))
@@ -160,12 +195,14 @@ def installSource():
shelltools.cd(os.path.join(get.installDIR(), destination)) shelltools.cd(os.path.join(get.installDIR(), destination))
autotools.make("clean") autotools.make("clean")
autotools.make("modules_prepare") autotools.make("modules_prepare")
shelltools.system("rm -rf ./.*")
def cleanModuleFiles(): def cleanModuleFiles():
""" Cleans module.* files generated by depmod """ """ Cleans module.* files generated by depmod """
# Remove modules.* files, they will be autogenerated during pakhandler. # Remove modules.* files, they will be autogenerated during pakhandler.
# TODO: Ubuntu doesn't remove modules.order, reinvestigate. # Don't remove modules.order generated by kbuild for ordering the modules
pisitools.remove("/lib/modules/%s/modules.*" % __getSuffix()) # according to the link order.
shelltools.system("find . -name 'modules.*' -not -name 'modules.order' -exec rm -f '{}' \;")
def mkinitramfs(): def mkinitramfs():
""" Create and install the initramfs image into the package. This will hopefully be done on user's system. """ """ Create and install the initramfs image into the package. This will hopefully be done on user's system. """