From 18f002f6fca63d729269be568f61876ec9839e1f Mon Sep 17 00:00:00 2001 From: freesource Date: Sat, 14 Dec 2002 17:54:41 +0000 Subject: [PATCH] On the way to a true automated src package. --- Makefile.pkg | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++- gbootroot_pkg | 14 ++++++++--- 2 files changed, 78 insertions(+), 5 deletions(-) diff --git a/Makefile.pkg b/Makefile.pkg index af6e2f6..1081d02 100644 --- a/Makefile.pkg +++ b/Makefile.pkg @@ -1,5 +1,72 @@ +# A Makefile going to a new dimension - a combination of stuff borrowed from +# buildroot by Erik Andersen , UML, and gbootroot. + +##all: install + +BASE_DIR=${shell pwd} + +TARGET_DIR=$(BASE_DIR)/root +BUILD_DIR=$(BASE_DIR)/staging_dir +SOURCE_DIR=$(BASE_DIR)/sources +##TARGET_CC=$(BUILD_DIR)/bin/gcc +##TARGET_CC1=$(BUILD_DIR)/usr/bin/$(ARCH)-uclibc-gcc +##TARGET_CROSS=$(BUILD_DIR)/usr/bin/$(ARCH)-uclibc- +##TARGET_PATH=$(BUILD_DIR)/usr/bin:$(BUILD_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin +KERNEL=$(BASE_DIR)/user-mode-linux/usr/bin/linuxbr +IMAGE=$(BASE_DIR)/root_filesystem/root_fs_helper +KERNEL_DIR=$(BASE_DIR)/linux +KERNEL_SOURCE=linux-2.4.19.tar.bz2 +KERNEL_SITE=http://www.uk.kernel.org/pub/linux/kernel/v2.4 + +PATCH_1=uml-patch-2.4.19-37.bz2 +PATCH_1_SITE=http://jdike.stearns.org/mirror +PATCH_2=$(BASE_DIR)/user-mode-linux/usr/lib/uml/cramfs-vfs-order.patch +KCONFIG=$(BASE_DIR)/user-mode-linux/usr/lib/uml/config +##UCLIBC_DIR=$(BASE_DIR)/uClibc +##UCLIBC_SOURCE=uClibc-snapshot.tar.gz +##UCLIBC_PATCH=$(SOURCE_DIR)/uClibc.patch +##UCLIBC_SITE=ftp://oss.lineo.com +##BUSYBOX_DIR=$(BASE_DIR)/busybox +##BUSYBOX_SOURCE=busybox.tar.gz +##BUSYBOX_PATCH=$(SOURCE_DIR)/busybox.patch +##BUSYBOX_SITE=http://busybox.lineo.com +GENEXT2_DIR=$(BASE_DIR)/genext2fs + + +all: world +world: kernel target + + +kernel: $(BASE_DIR) + @if [ ! -d $(KERNEL_DIR) ] ; then \ + while [ ! -f $(SOURCE_DIR)/$(KERNEL_SOURCE) ] ; do \ + wget -P $(SOURCE_DIR) --passive $(KERNEL_SITE)/$(KERNEL_SOURCE); \ + done; \ + while [ ! -f $(SOURCE_DIR)/$(PATCH_1) ] ; do \ + wget -P $(SOURCE_DIR) --passive $(PATCH_1_SITE)/$(PATCH_1); \ + done; \ + bunzip2 -c $(SOURCE_DIR)/$(KERNEL_SOURCE) | tar -xv; \ + bzcat $(SOURCE_DIR)/$(PATCH_1) | patch -d $(KERNEL_DIR) -p1; \ + perl -i -p -e "s/^ARCH :=.*/ARCH=um/g" $(KERNEL_DIR)/Makefile; \ + fi; +# @if [ ! -f $(KERNEL_DIR)/.config ] ; then \ +# cp $(KCONFIG) $(KERNEL_DIR)/.config; \ +# (cd $(KERNEL_DIR); make oldconfig; make dep); \ +# fi; +# @if [ ! -f $(KERNEL_DIR)/linux ] ; then \ +# (cd $(KERNEL_DIR); make linux); \ +# fi; +# @cmp -s $(KERNEL) $(KERNEL_DIR)/linux; \ +# if [ $$? != 0 ] ; then \ +# cp -fa $(KERNEL_DIR)/linux $(KERNEL); \ +# fi; + + +mkfs: + @if [ ! -f $(GENEXT2_DIR)/genext2fs ] ; then \ + $(MAKE) -C $(GENEXT2_DIR); \ + fi; -all: install install: install -d $(DESTDIR)/usr/bin diff --git a/gbootroot_pkg b/gbootroot_pkg index 7c04e7d..e21de8e 100755 --- a/gbootroot_pkg +++ b/gbootroot_pkg @@ -92,13 +92,14 @@ $packaging_place = "$packaging_place/$prog-$version"; # Do we want a deb, rpm or both -if (!( $ARGV[0] eq "both" || $ARGV[0] eq "deb" || $ARGV[0] eq "rpm" ) ) { +if (!( $ARGV[0] eq "both" || $ARGV[0] eq "deb" || $ARGV[0] eq "rpm" || + $ARGV[0] eq "src" ) ) { - die "Specify: both, deb, or rpm\n"; + die "Specify: both, deb, or rpm or src\n"; } -if ( $ARGV[0] eq "both" || $ARGV[0] eq "deb" ) { +if ( $ARGV[0] eq "both" || $ARGV[0] eq "deb" || $ARGV[0] eq "src") { # Make sure the directory exists. @@ -149,11 +150,14 @@ foreach (@make_lines) { # Stuff not in the Makefile system "cp -fa $makefile $packaging_place/Makefile"; + # Basically this is stuff we want in the source package, but not the normal # package system "cp -fa README $packaging_place/README"; system "cp -fa user-mode-linux/usr/lib/uml/cramfs-vfs-order.patch $packaging_place/user-mode-linux/usr/lib/uml/cramfs-vfs-order.patch"; system "ln -sf $packaging_place/yard/replacements $packaging_place/yard/Replacements"; +mkdir("$packaging_place/linux"); +mkdir("$packaging_place/sources"); # Now we get to clean out any CVS directories and make sure that the # permissions are all for the user who will be creating the package. @@ -185,8 +189,10 @@ if (-d $packaging_place) { my $pristine_source_package = "$packaging_place_orig/$prog-$version" . ".tar.gz"; print "$pristine_source_package $packaging_place\n"; +exit if $ARGV[0] eq "src"; +unlink($pristine_source_package) if -e $prinstine_source_package; system "tar cvfz $pristine_source_package $packaging_place"; -exit; + # Now we to the dh_make thing, and setup the time, version, and defaults.