| 1 | ########################################################### |
|---|
| 2 | # |
|---|
| 3 | # libc-dev |
|---|
| 4 | # |
|---|
| 5 | ########################################################### |
|---|
| 6 | # |
|---|
| 7 | # LIBC-DEV_VERSION, LIBC-DEV_SITE and LIBC-DEV_SOURCE define |
|---|
| 8 | # the upstream location of the source code for the package. |
|---|
| 9 | # LIBC-DEV_DIR is the directory which is created when the source |
|---|
| 10 | # archive is unpacked. |
|---|
| 11 | # LIBC-DEV_UNZIP is the command used to unzip the source. |
|---|
| 12 | # It is usually "zcat" (for .gz) or "bzcat" (for .bz2) |
|---|
| 13 | # |
|---|
| 14 | # You should change all these variables to suit your package. |
|---|
| 15 | # Please make sure that you add a description, and that you |
|---|
| 16 | # list all your packages' dependencies, seperated by commas. |
|---|
| 17 | # |
|---|
| 18 | # If you list yourself as MAINTAINER, please give a valid email |
|---|
| 19 | # address, and indicate your irc nick if it cannot be easily deduced |
|---|
| 20 | # from your name or email address. If you leave MAINTAINER set to |
|---|
| 21 | # "NSLU2 Linux" other developers will feel free to edit. |
|---|
| 22 | # |
|---|
| 23 | #LIBC-DEV_SITE=http://$(SOURCEFORGE_MIRROR)/sourceforge/libc-dev |
|---|
| 24 | LIBC-DEV_VERSION=$(LIBNSL_VERSION) |
|---|
| 25 | #LIBC-DEV_SOURCE=libc-dev-$(LIBC-DEV_VERSION).tar.gz |
|---|
| 26 | LIBC-DEV_DIR=libc-dev-$(LIBC-DEV_VERSION) |
|---|
| 27 | #LIBC-DEV_UNZIP=zcat |
|---|
| 28 | LIBC-DEV_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 29 | LIBC-DEV_DESCRIPTION=libc development files. |
|---|
| 30 | LIBC-DEV_SECTION=devel |
|---|
| 31 | LIBC-DEV_PRIORITY=optional |
|---|
| 32 | LIBC-DEV_DEPENDS=libnsl |
|---|
| 33 | LIBC-DEV_SUGGESTS= |
|---|
| 34 | LIBC-DEV_CONFLICTS= |
|---|
| 35 | |
|---|
| 36 | LIBC-DEV_IPK_VERSION=5 |
|---|
| 37 | |
|---|
| 38 | ifdef LIBNSL_VERSION |
|---|
| 39 | LIBC-DEV_VERSION=$(LIBNSL_VERSION) |
|---|
| 40 | else |
|---|
| 41 | ifdef CROSS_CONFIGURATION_UCLIBC_VERSION |
|---|
| 42 | LIBC-DEV_VERSION = $(CROSS_CONFIGURATION_UCLIBC_VERSION) |
|---|
| 43 | else |
|---|
| 44 | LIBC-DEV_VERSION = 0.9.28 |
|---|
| 45 | endif |
|---|
| 46 | endif |
|---|
| 47 | |
|---|
| 48 | ifdef TARGET_USRLIBDIR |
|---|
| 49 | LIBC-DEV_USRLIBDIR=$(TARGET_USRLIBDIR) |
|---|
| 50 | else |
|---|
| 51 | LIBC-DEV_USRLIBDIR=$(TARGET_LIBDIR) |
|---|
| 52 | endif |
|---|
| 53 | |
|---|
| 54 | ifdef TARGET_LIBC_LIBDIR |
|---|
| 55 | LIBC-DEV_LIBDIR=$(TARGET_LIBC_LIBDIR) |
|---|
| 56 | else |
|---|
| 57 | LIBC-DEV_LIBDIR=$(TARGET_LIBDIR) |
|---|
| 58 | endif |
|---|
| 59 | |
|---|
| 60 | LIBC-DEV_CRT_DIR ?= /opt/`$(TARGET_CC) -dumpmachine`/lib |
|---|
| 61 | LIBC-DEV_LIBC_SO_DIR ?= $(LIBC-DEV_USRLIBDIR) |
|---|
| 62 | LIBC-DEV_NONSHARED_LIB_DIR ?= $(LIBC-DEV_LIBC_SO_DIR) |
|---|
| 63 | |
|---|
| 64 | # |
|---|
| 65 | # LIBC-DEV_CONFFILES should be a list of user-editable files |
|---|
| 66 | #LIBC-DEV_CONFFILES=/opt/etc/libc-dev.conf /opt/etc/init.d/SXXlibc-dev |
|---|
| 67 | |
|---|
| 68 | # |
|---|
| 69 | # LIBC-DEV_PATCHES should list any patches, in the the order in |
|---|
| 70 | # which they should be applied to the source code. |
|---|
| 71 | # |
|---|
| 72 | #LIBC-DEV_PATCHES=$(LIBC-DEV_SOURCE_DIR)/configure.patch |
|---|
| 73 | |
|---|
| 74 | # |
|---|
| 75 | # If the compilation of the package requires additional |
|---|
| 76 | # compilation or linking flags, then list them here. |
|---|
| 77 | # |
|---|
| 78 | LIBC-DEV_CPPFLAGS= |
|---|
| 79 | LIBC-DEV_LDFLAGS= |
|---|
| 80 | |
|---|
| 81 | # |
|---|
| 82 | # LIBC-DEV_BUILD_DIR is the directory in which the build is done. |
|---|
| 83 | # LIBC-DEV_SOURCE_DIR is the directory which holds all the |
|---|
| 84 | # patches and ipkg control files. |
|---|
| 85 | # LIBC-DEV_IPK_DIR is the directory in which the ipk is built. |
|---|
| 86 | # LIBC-DEV_IPK is the name of the resulting ipk files. |
|---|
| 87 | # |
|---|
| 88 | # You should not change any of these variables. |
|---|
| 89 | # |
|---|
| 90 | LIBC-DEV_BUILD_DIR=$(BUILD_DIR)/libc-dev |
|---|
| 91 | LIBC-DEV_SOURCE_DIR=$(SOURCE_DIR)/libc-dev |
|---|
| 92 | LIBC-DEV_IPK_DIR=$(BUILD_DIR)/libc-dev-$(LIBC-DEV_VERSION)-ipk |
|---|
| 93 | LIBC-DEV_IPK=$(BUILD_DIR)/libc-dev_$(LIBC-DEV_VERSION)-$(LIBC-DEV_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 94 | |
|---|
| 95 | .PHONY: libc-dev-source libc-dev-unpack libc-dev libc-dev-stage libc-dev-ipk libc-dev-clean libc-dev-dirclean libc-dev-check |
|---|
| 96 | |
|---|
| 97 | # |
|---|
| 98 | # This rule creates a control file for ipkg. It is no longer |
|---|
| 99 | # necessary to create a seperate control file under sources/libc-dev |
|---|
| 100 | # |
|---|
| 101 | $(BUILD_DIR)/libc-dev-$(LIBC-DEV_VERSION)-ipk/CONTROL/control: |
|---|
| 102 | @install -d $(@D) |
|---|
| 103 | @rm -f $@ |
|---|
| 104 | @echo "Package: libc-dev" >>$@ |
|---|
| 105 | @echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 106 | @echo "Priority: $(LIBC-DEV_PRIORITY)" >>$@ |
|---|
| 107 | @echo "Section: $(LIBC-DEV_SECTION)" >>$@ |
|---|
| 108 | @echo "Version: $(LIBC-DEV_VERSION)-$(LIBC-DEV_IPK_VERSION)" >>$@ |
|---|
| 109 | @echo "Maintainer: $(LIBC-DEV_MAINTAINER)" >>$@ |
|---|
| 110 | @echo "Source: $(LIBC-DEV_SITE)/$(LIBC-DEV_SOURCE)" >>$@ |
|---|
| 111 | @echo "Description: $(LIBC-DEV_DESCRIPTION)" >>$@ |
|---|
| 112 | @echo "Depends: $(LIBC-DEV_DEPENDS)" >>$@ |
|---|
| 113 | @echo "Suggests: $(LIBC-DEV_SUGGESTS)" >>$@ |
|---|
| 114 | @echo "Conflicts: $(LIBC-DEV_CONFLICTS)" >>$@ |
|---|
| 115 | |
|---|
| 116 | # |
|---|
| 117 | # This builds the IPK file. |
|---|
| 118 | # |
|---|
| 119 | # Binaries should be installed into $(LIBC-DEV_IPK_DIR)/opt/sbin or $(LIBC-DEV_IPK_DIR)/opt/bin |
|---|
| 120 | # (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 121 | # Libraries and include files should be installed into $(LIBC-DEV_IPK_DIR)/opt/{lib,include} |
|---|
| 122 | # Configuration files should be installed in $(LIBC-DEV_IPK_DIR)/opt/etc/libc-dev/... |
|---|
| 123 | # Documentation files should be installed in $(LIBC-DEV_IPK_DIR)/opt/doc/libc-dev/... |
|---|
| 124 | # Daemon startup scripts should be installed in $(LIBC-DEV_IPK_DIR)/opt/etc/init.d/S??libc-dev |
|---|
| 125 | # |
|---|
| 126 | # You may need to patch your application to make it use these locations. |
|---|
| 127 | # |
|---|
| 128 | $(LIBC-DEV_IPK): make/libc-dev.mk |
|---|
| 129 | rm -rf $(LIBC-DEV_IPK_DIR) $(BUILD_DIR)/libc-dev_*_$(TARGET_ARCH).ipk |
|---|
| 130 | install -d $(LIBC-DEV_IPK_DIR)/opt/ |
|---|
| 131 | -rsync -rlpgoD --copy-unsafe-links $(TARGET_INCDIR) $(LIBC-DEV_IPK_DIR)/opt/ |
|---|
| 132 | install -d $(LIBC-DEV_IPK_DIR)/$(LIBC-DEV_CRT_DIR) |
|---|
| 133 | rsync -l $(LIBC-DEV_USRLIBDIR)/*crt*.o $(LIBC-DEV_IPK_DIR)/$(LIBC-DEV_CRT_DIR) |
|---|
| 134 | install -d $(LIBC-DEV_IPK_DIR)/opt/lib/ |
|---|
| 135 | ifeq (wdtv, $(OPTWARE_TARGET)) |
|---|
| 136 | rm -f $(LIBC-DEV_IPK_DIR)/opt/include/z*.h |
|---|
| 137 | else |
|---|
| 138 | ifeq (uclibc, $(LIBC_STYLE)) |
|---|
| 139 | rsync -l \ |
|---|
| 140 | $(TARGET_LIBDIR)/libuClibc-$(LIBC-DEV_VERSION).so \ |
|---|
| 141 | $(LIBC-DEV_USRLIBDIR)/libc.so* \ |
|---|
| 142 | $(LIBC-DEV_IPK_DIR)/opt/lib/ |
|---|
| 143 | else |
|---|
| 144 | for f in libc_nonshared.a libpthread_nonshared.a; \ |
|---|
| 145 | do rsync -l $(LIBC-DEV_NONSHARED_LIB_DIR)/$${f} $(LIBC-DEV_IPK_DIR)/opt/lib/; done |
|---|
| 146 | rsync -l $(LIBC-DEV_LIBC_SO_DIR)/libc.so $(LIBC-DEV_IPK_DIR)/opt/lib/ |
|---|
| 147 | sed -i -e '/^GROUP/s|.*|GROUP ( /lib/libc.so.6 /opt/lib/libc_nonshared.a )|' \ |
|---|
| 148 | $(LIBC-DEV_IPK_DIR)/opt/lib/libc.so |
|---|
| 149 | endif |
|---|
| 150 | for f in libcrypt libdl libm libpthread libresolv librt libutil \ |
|---|
| 151 | $(if $(filter uclibc, $(LIBC_STYLE)), ld-uClibc, ) \ |
|---|
| 152 | ; \ |
|---|
| 153 | do \ |
|---|
| 154 | rsync -l \ |
|---|
| 155 | $(LIBC-DEV_LIBDIR)/$${f}-[\.0-9]*.so \ |
|---|
| 156 | $(LIBC-DEV_LIBDIR)/$${f}.so[\.0-9]* \ |
|---|
| 157 | $(LIBC-DEV_IPK_DIR)/$(LIBC-DEV_CRT_DIR); \ |
|---|
| 158 | cd $(LIBC-DEV_IPK_DIR)/$(LIBC-DEV_CRT_DIR); \ |
|---|
| 159 | if test $${f} != ld-uClibc -a ! -e $${f}.so; then \ |
|---|
| 160 | ln -sf $${f}.so.* $${f}.so; \ |
|---|
| 161 | fi; \ |
|---|
| 162 | done |
|---|
| 163 | endif |
|---|
| 164 | rm -rf $(LIBC-DEV_IPK_DIR)/opt/include/c++ |
|---|
| 165 | $(MAKE) $(LIBC-DEV_IPK_DIR)/CONTROL/control |
|---|
| 166 | echo $(LIBC-DEV_CONFFILES) | sed -e 's/ /\n/g' > $(LIBC-DEV_IPK_DIR)/CONTROL/conffiles |
|---|
| 167 | cd $(BUILD_DIR); $(IPKG_BUILD) $(LIBC-DEV_IPK_DIR) |
|---|
| 168 | |
|---|
| 169 | # |
|---|
| 170 | # This is called from the top level makefile to create the IPK file. |
|---|
| 171 | # |
|---|
| 172 | libc-dev-ipk: $(LIBC-DEV_IPK) |
|---|
| 173 | |
|---|
| 174 | # |
|---|
| 175 | # This is called from the top level makefile to clean all dynamically created |
|---|
| 176 | # directories. |
|---|
| 177 | # |
|---|
| 178 | libc-dev-dirclean: |
|---|
| 179 | rm -rf $(BUILD_DIR)/$(LIBC-DEV_DIR) $(LIBC-DEV_BUILD_DIR) $(LIBC-DEV_IPK_DIR) $(LIBC-DEV_IPK) |
|---|
| 180 | # |
|---|
| 181 | # |
|---|
| 182 | # Some sanity check for the package. |
|---|
| 183 | # |
|---|
| 184 | libc-dev-check: $(LIBC-DEV_IPK) |
|---|
| 185 | perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $(LIBC-DEV_IPK) |
|---|