| 1 | ########################################################### |
|---|
| 2 | # |
|---|
| 3 | # cpio |
|---|
| 4 | # |
|---|
| 5 | ########################################################### |
|---|
| 6 | |
|---|
| 7 | CPIO_SITE=http://ftp.gnu.org/gnu/cpio |
|---|
| 8 | CPIO_VERSION=2.5 |
|---|
| 9 | CPIO_SOURCE=cpio-$(CPIO_VERSION).tar.gz |
|---|
| 10 | CPIO_DIR=cpio-$(CPIO_VERSION) |
|---|
| 11 | CPIO_UNZIP=zcat |
|---|
| 12 | |
|---|
| 13 | # |
|---|
| 14 | # CPIO_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 15 | # |
|---|
| 16 | CPIO_IPK_VERSION=1 |
|---|
| 17 | |
|---|
| 18 | # |
|---|
| 19 | # CPIO_PATCHES should list any patches, in the the order in |
|---|
| 20 | # which they should be applied to the source code. |
|---|
| 21 | # |
|---|
| 22 | |
|---|
| 23 | # |
|---|
| 24 | # If the compilation of the package requires additional |
|---|
| 25 | # compilation or linking flags, then list them here. |
|---|
| 26 | # |
|---|
| 27 | CPIO_CPPFLAGS= |
|---|
| 28 | CPIO_LDFLAGS= |
|---|
| 29 | |
|---|
| 30 | # |
|---|
| 31 | # CPIO_BUILD_DIR is the directory in which the build is done. |
|---|
| 32 | # CPIO_SOURCE_DIR is the directory which holds all the |
|---|
| 33 | # patches and ipkg control files. |
|---|
| 34 | # CPIO_IPK_DIR is the directory in which the ipk is built. |
|---|
| 35 | # CPIO_IPK is the name of the resulting ipk files. |
|---|
| 36 | # |
|---|
| 37 | # You should not change any of these variables. |
|---|
| 38 | # |
|---|
| 39 | CPIO_BUILD_DIR=$(BUILD_DIR)/cpio |
|---|
| 40 | CPIO_SOURCE_DIR=$(SOURCE_DIR)/cpio |
|---|
| 41 | CPIO_IPK_DIR=$(BUILD_DIR)/cpio-$(CPIO_VERSION)-ipk |
|---|
| 42 | CPIO_IPK=$(BUILD_DIR)/cpio_$(CPIO_VERSION)-$(CPIO_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 43 | |
|---|
| 44 | # |
|---|
| 45 | # This is the dependency on the source code. If the source is missing, |
|---|
| 46 | # then it will be fetched from the site using wget. |
|---|
| 47 | # |
|---|
| 48 | $(DL_DIR)/$(CPIO_SOURCE): |
|---|
| 49 | $(WGET) -P $(DL_DIR) $(CPIO_SITE)/$(CPIO_SOURCE) |
|---|
| 50 | |
|---|
| 51 | # |
|---|
| 52 | # The source code depends on it existing within the download directory. |
|---|
| 53 | # This target will be called by the top level Makefile to download the |
|---|
| 54 | # source code's archive (.tar.gz, .bz2, etc.) |
|---|
| 55 | # |
|---|
| 56 | cpio-source: $(DL_DIR)/$(CPIO_SOURCE) $(CPIO_PATCHES) |
|---|
| 57 | |
|---|
| 58 | # |
|---|
| 59 | # This target unpacks the source code in the build directory. |
|---|
| 60 | # If the source archive is not .tar.gz or .tar.bz2, then you will need |
|---|
| 61 | # to change the commands here. Patches to the source code are also |
|---|
| 62 | # applied in this target as required. |
|---|
| 63 | # |
|---|
| 64 | # This target also configures the build within the build directory. |
|---|
| 65 | # Flags such as LDFLAGS and CPPFLAGS should be passed into configure |
|---|
| 66 | # and NOT $(MAKE) below. Passing it to configure causes configure to |
|---|
| 67 | # correctly BUILD the Makefile with the right paths, where passing it |
|---|
| 68 | # to Make causes it to override the default search paths of the compiler. |
|---|
| 69 | # |
|---|
| 70 | # If the compilation of the package requires other packages to be staged |
|---|
| 71 | # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage"). |
|---|
| 72 | # |
|---|
| 73 | $(CPIO_BUILD_DIR)/.configured: $(DL_DIR)/$(CPIO_SOURCE) $(CPIO_PATCHES) |
|---|
| 74 | rm -rf $(BUILD_DIR)/$(CPIO_DIR) $(CPIO_BUILD_DIR) |
|---|
| 75 | $(CPIO_UNZIP) $(DL_DIR)/$(CPIO_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 76 | mv $(BUILD_DIR)/$(CPIO_DIR) $(CPIO_BUILD_DIR) |
|---|
| 77 | (cd $(CPIO_BUILD_DIR); \ |
|---|
| 78 | $(TARGET_CONFIGURE_OPTS) \ |
|---|
| 79 | CPPFLAGS="$(STAGING_CPPFLAGS) $(CPIO_CPPFLAGS)" \ |
|---|
| 80 | LDFLAGS="$(STAGING_LDFLAGS) $(CPIO_LDFLAGS)" \ |
|---|
| 81 | ./configure \ |
|---|
| 82 | --build=$(GNU_HOST_NAME) \ |
|---|
| 83 | --host=$(GNU_TARGET_NAME) \ |
|---|
| 84 | --target=$(GNU_TARGET_NAME) \ |
|---|
| 85 | --prefix=/opt \ |
|---|
| 86 | --disable-nls \ |
|---|
| 87 | ) |
|---|
| 88 | touch $(CPIO_BUILD_DIR)/.configured |
|---|
| 89 | |
|---|
| 90 | cpio-unpack: $(CPIO_BUILD_DIR)/.configured |
|---|
| 91 | |
|---|
| 92 | # |
|---|
| 93 | # This builds the actual binary. You should change the target to refer |
|---|
| 94 | # directly to the main binary which is built. |
|---|
| 95 | # |
|---|
| 96 | #$(CPIO_BUILD_DIR)/.built: $(CPIO_BUILD_DIR)/.configured |
|---|
| 97 | $(CPIO_BUILD_DIR)/cpio: $(CPIO_BUILD_DIR)/.configured |
|---|
| 98 | rm -f $(CPIO_BUILD_DIR)/cpio |
|---|
| 99 | $(MAKE) -C $(CPIO_BUILD_DIR) |
|---|
| 100 | |
|---|
| 101 | # |
|---|
| 102 | # You should change the dependency to refer directly to the main binary |
|---|
| 103 | # which is built. |
|---|
| 104 | # |
|---|
| 105 | cpio: $(CPIO_BUILD_DIR)/cpio |
|---|
| 106 | |
|---|
| 107 | # |
|---|
| 108 | # If you are building a library, then you need to stage it too. |
|---|
| 109 | # |
|---|
| 110 | |
|---|
| 111 | cpio-stage: $(STAGING_DIR)/opt/lib/libcpio.so.$(CPIO_VERSION) |
|---|
| 112 | |
|---|
| 113 | # |
|---|
| 114 | # This builds the IPK file. |
|---|
| 115 | # |
|---|
| 116 | # Binaries should be installed into $(CPIO_IPK_DIR)/opt/sbin or $(CPIO_IPK_DIR)/opt/bin |
|---|
| 117 | # (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 118 | # Libraries and include files should be installed into $(CPIO_IPK_DIR)/opt/{lib,include} |
|---|
| 119 | # Configuration files should be installed in $(CPIO_IPK_DIR)/opt/etc/cpio/... |
|---|
| 120 | # Documentation files should be installed in $(CPIO_IPK_DIR)/opt/doc/cpio/... |
|---|
| 121 | # Daemon startup scripts should be installed in $(CPIO_IPK_DIR)/opt/etc/init.d/S??cpio |
|---|
| 122 | # |
|---|
| 123 | # You may need to patch your application to make it use these locations. |
|---|
| 124 | # |
|---|
| 125 | $(CPIO_IPK): $(CPIO_BUILD_DIR)/cpio |
|---|
| 126 | rm -rf $(CPIO_IPK_DIR) $(CPIO_IPK) |
|---|
| 127 | install -d $(CPIO_IPK_DIR)/opt/bin |
|---|
| 128 | $(STRIP_COMMAND) $(CPIO_BUILD_DIR)/cpio -o $(CPIO_IPK_DIR)/opt/bin/cpio |
|---|
| 129 | install -d $(CPIO_IPK_DIR)/CONTROL |
|---|
| 130 | install -m 644 $(CPIO_SOURCE_DIR)/control $(CPIO_IPK_DIR)/CONTROL/control |
|---|
| 131 | cd $(BUILD_DIR); $(IPKG_BUILD) $(CPIO_IPK_DIR) |
|---|
| 132 | |
|---|
| 133 | # |
|---|
| 134 | # This is called from the top level makefile to create the IPK file. |
|---|
| 135 | # |
|---|
| 136 | cpio-ipk: $(CPIO_IPK) |
|---|
| 137 | |
|---|
| 138 | # |
|---|
| 139 | # This is called from the top level makefile to clean all of the built files. |
|---|
| 140 | # |
|---|
| 141 | cpio-clean: |
|---|
| 142 | -$(MAKE) -C $(CPIO_BUILD_DIR) clean |
|---|
| 143 | |
|---|
| 144 | # |
|---|
| 145 | # This is called from the top level makefile to clean all dynamically created |
|---|
| 146 | # directories. |
|---|
| 147 | # |
|---|
| 148 | cpio-dirclean: |
|---|
| 149 | rm -rf $(BUILD_DIR)/$(CPIO_DIR) $(CPIO_BUILD_DIR) $(CPIO_IPK_DIR) $(CPIO_IPK) |
|---|