| 1 | ########################################################### |
|---|
| 2 | # |
|---|
| 3 | # py-sqlobject |
|---|
| 4 | # |
|---|
| 5 | ########################################################### |
|---|
| 6 | |
|---|
| 7 | # |
|---|
| 8 | # PY-SQLOBJECT_VERSION, PY-SQLOBJECT_SITE and PY-SQLOBJECT_SOURCE define |
|---|
| 9 | # the upstream location of the source code for the package. |
|---|
| 10 | # PY-SQLOBJECT_DIR is the directory which is created when the source |
|---|
| 11 | # archive is unpacked. |
|---|
| 12 | # PY-SQLOBJECT_UNZIP is the command used to unzip the source. |
|---|
| 13 | # It is usually "zcat" (for .gz) or "bzcat" (for .bz2) |
|---|
| 14 | # |
|---|
| 15 | # You should change all these variables to suit your package. |
|---|
| 16 | # Please make sure that you add a description, and that you |
|---|
| 17 | # list all your packages' dependencies, seperated by commas. |
|---|
| 18 | # |
|---|
| 19 | # If you list yourself as MAINTAINER, please give a valid email |
|---|
| 20 | # address, and indicate your irc nick if it cannot be easily deduced |
|---|
| 21 | # from your name or email address. If you leave MAINTAINER set to |
|---|
| 22 | # "NSLU2 Linux" other developers will feel free to edit. |
|---|
| 23 | # |
|---|
| 24 | # PY-SQLOBJECT_IPK_VERSION should be incremented when the ipk changes. |
|---|
| 25 | # |
|---|
| 26 | PY-SQLOBJECT_SITE=http://pypi.python.org/packages/source/S/SQLObject |
|---|
| 27 | #PY-SQLOBJECT_SVN_REV=1675 |
|---|
| 28 | #ifneq ($(PY-SQLOBJECT_SVN_REV),) |
|---|
| 29 | #PY-SQLOBJECT_ ### VERSION=0.8dev_r1675 |
|---|
| 30 | #else |
|---|
| 31 | PY-SQLOBJECT_VERSION=0.12.2 |
|---|
| 32 | PY-SQLOBJECT_SOURCE=SQLObject-$(PY-SQLOBJECT_VERSION).tar.gz |
|---|
| 33 | #endif |
|---|
| 34 | PY-SQLOBJECT_DIR=SQLObject-$(PY-SQLOBJECT_VERSION) |
|---|
| 35 | PY-SQLOBJECT_UNZIP=zcat |
|---|
| 36 | PY-SQLOBJECT_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 37 | PY-SQLOBJECT_DESCRIPTION=An object-relational mapper for python. |
|---|
| 38 | PY-SQLOBJECT_SECTION=misc |
|---|
| 39 | PY-SQLOBJECT_PRIORITY=optional |
|---|
| 40 | PY25-SQLOBJECT_DEPENDS=python25, py25-formencode |
|---|
| 41 | PY26-SQLOBJECT_DEPENDS=python26, py26-formencode |
|---|
| 42 | PY25-SQLOBJECT_SUGGESTS=py25-psycopg2, py25-mysql |
|---|
| 43 | PY26-SQLOBJECT_SUGGESTS=py26-psycopg2, py26-mysql |
|---|
| 44 | PY-SQLOBJECT_CONFLICTS= |
|---|
| 45 | |
|---|
| 46 | PY-SQLOBJECT_IPK_VERSION=1 |
|---|
| 47 | |
|---|
| 48 | # |
|---|
| 49 | # PY-SQLOBJECT_CONFFILES should be a list of user-editable files |
|---|
| 50 | #PY-SQLOBJECT_CONFFILES=/opt/etc/py-sqlobject.conf /opt/etc/init.d/SXXpy-sqlobject |
|---|
| 51 | |
|---|
| 52 | # |
|---|
| 53 | # PY-SQLOBJECT_PATCHES should list any patches, in the the order in |
|---|
| 54 | # which they should be applied to the source code. |
|---|
| 55 | # |
|---|
| 56 | #PY-SQLOBJECT_PATCHES=$(PY-SQLOBJECT_SOURCE_DIR)/setup.py.patch |
|---|
| 57 | |
|---|
| 58 | # |
|---|
| 59 | # If the compilation of the package requires additional |
|---|
| 60 | # compilation or linking flags, then list them here. |
|---|
| 61 | # |
|---|
| 62 | PY-SQLOBJECT_CPPFLAGS= |
|---|
| 63 | PY-SQLOBJECT_LDFLAGS= |
|---|
| 64 | |
|---|
| 65 | # |
|---|
| 66 | # PY-SQLOBJECT_BUILD_DIR is the directory in which the build is done. |
|---|
| 67 | # PY-SQLOBJECT_SOURCE_DIR is the directory which holds all the |
|---|
| 68 | # patches and ipkg control files. |
|---|
| 69 | # PY-SQLOBJECT_IPK_DIR is the directory in which the ipk is built. |
|---|
| 70 | # PY-SQLOBJECT_IPK is the name of the resulting ipk files. |
|---|
| 71 | # |
|---|
| 72 | # You should not change any of these variables. |
|---|
| 73 | # |
|---|
| 74 | PY-SQLOBJECT_BUILD_DIR=$(BUILD_DIR)/py-sqlobject |
|---|
| 75 | PY-SQLOBJECT_SOURCE_DIR=$(SOURCE_DIR)/py-sqlobject |
|---|
| 76 | |
|---|
| 77 | PY25-SQLOBJECT_IPK_DIR=$(BUILD_DIR)/py25-sqlobject-$(PY-SQLOBJECT_VERSION)-ipk |
|---|
| 78 | PY25-SQLOBJECT_IPK=$(BUILD_DIR)/py25-sqlobject_$(PY-SQLOBJECT_VERSION)-$(PY-SQLOBJECT_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 79 | |
|---|
| 80 | PY26-SQLOBJECT_IPK_DIR=$(BUILD_DIR)/py26-sqlobject-$(PY-SQLOBJECT_VERSION)-ipk |
|---|
| 81 | PY26-SQLOBJECT_IPK=$(BUILD_DIR)/py26-sqlobject_$(PY-SQLOBJECT_VERSION)-$(PY-SQLOBJECT_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 82 | |
|---|
| 83 | .PHONY: py-sqlobject-source py-sqlobject-unpack py-sqlobject py-sqlobject-stage py-sqlobject-ipk py-sqlobject-clean py-sqlobject-dirclean py-sqlobject-check |
|---|
| 84 | |
|---|
| 85 | # |
|---|
| 86 | # This is the dependency on the source code. If the source is missing, |
|---|
| 87 | # then it will be fetched from the site using wget. |
|---|
| 88 | # |
|---|
| 89 | ifeq ($(PY-SQLOBJECT_SVN_REV),) |
|---|
| 90 | $(DL_DIR)/$(PY-SQLOBJECT_SOURCE): |
|---|
| 91 | $(WGET) -P $(@D) $(PY-SQLOBJECT_SITE)/$(@F) || \ |
|---|
| 92 | $(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F) |
|---|
| 93 | endif |
|---|
| 94 | |
|---|
| 95 | # |
|---|
| 96 | # The source code depends on it existing within the download directory. |
|---|
| 97 | # This target will be called by the top level Makefile to download the |
|---|
| 98 | # source code's archive (.tar.gz, .bz2, etc.) |
|---|
| 99 | # |
|---|
| 100 | py-sqlobject-source: $(DL_DIR)/$(PY-SQLOBJECT_SOURCE) $(PY-SQLOBJECT_PATCHES) |
|---|
| 101 | |
|---|
| 102 | # |
|---|
| 103 | # This target unpacks the source code in the build directory. |
|---|
| 104 | # If the source archive is not .tar.gz or .tar.bz2, then you will need |
|---|
| 105 | # to change the commands here. Patches to the source code are also |
|---|
| 106 | # applied in this target as required. |
|---|
| 107 | # |
|---|
| 108 | # This target also configures the build within the build directory. |
|---|
| 109 | # Flags such as LDFLAGS and CPPFLAGS should be passed into configure |
|---|
| 110 | # and NOT $(MAKE) below. Passing it to configure causes configure to |
|---|
| 111 | # correctly BUILD the Makefile with the right paths, where passing it |
|---|
| 112 | # to Make causes it to override the default search paths of the compiler. |
|---|
| 113 | # |
|---|
| 114 | # If the compilation of the package requires other packages to be staged |
|---|
| 115 | # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage"). |
|---|
| 116 | # |
|---|
| 117 | ifeq ($(PY-SQLOBJECT_SVN_REV),) |
|---|
| 118 | $(PY-SQLOBJECT_BUILD_DIR)/.configured: $(DL_DIR)/$(PY-SQLOBJECT_SOURCE) $(PY-SQLOBJECT_PATCHES) make/py-sqlobject.mk |
|---|
| 119 | else |
|---|
| 120 | $(PY-SQLOBJECT_BUILD_DIR)/.configured: $(PY-SQLOBJECT_PATCHES) make/py-sqlobject.mk |
|---|
| 121 | endif |
|---|
| 122 | $(MAKE) py-setuptools-stage |
|---|
| 123 | rm -rf $(PY-SQLOBJECT_BUILD_DIR) |
|---|
| 124 | mkdir -p $(PY-SQLOBJECT_BUILD_DIR) |
|---|
| 125 | # 2.5 |
|---|
| 126 | rm -rf $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) |
|---|
| 127 | ifeq ($(PY-SQLOBJECT_SVN_REV),) |
|---|
| 128 | $(PY-SQLOBJECT_UNZIP) $(DL_DIR)/$(PY-SQLOBJECT_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 129 | else |
|---|
| 130 | (cd $(BUILD_DIR); \ |
|---|
| 131 | svn co -q -r $(PY-SQLOBJECT_SVN_REV) http://svn.colorstudy.com/SQLObject/trunk $(PY-SQLOBJECT_DIR); \ |
|---|
| 132 | ) |
|---|
| 133 | endif |
|---|
| 134 | if test -n "$(PY-SQLOBJECT_PATCHES)" ; then \ |
|---|
| 135 | cat $(PY-SQLOBJECT_PATCHES) | patch -d $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) -p0 ; \ |
|---|
| 136 | fi |
|---|
| 137 | mv $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) $(PY-SQLOBJECT_BUILD_DIR)/2.5 |
|---|
| 138 | (cd $(PY-SQLOBJECT_BUILD_DIR); \ |
|---|
| 139 | sed -i -e '/use_setuptools/d' setup.py; \ |
|---|
| 140 | (echo "[build_scripts]"; echo "executable=/opt/bin/python2.5") >> setup.cfg \ |
|---|
| 141 | ) |
|---|
| 142 | # 2.6 |
|---|
| 143 | rm -rf $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) |
|---|
| 144 | ifeq ($(PY-SQLOBJECT_SVN_REV),) |
|---|
| 145 | $(PY-SQLOBJECT_UNZIP) $(DL_DIR)/$(PY-SQLOBJECT_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 146 | else |
|---|
| 147 | (cd $(BUILD_DIR); \ |
|---|
| 148 | svn co -q -r $(PY-SQLOBJECT_SVN_REV) http://svn.colorstudy.com/SQLObject/trunk $(PY-SQLOBJECT_DIR); \ |
|---|
| 149 | ) |
|---|
| 150 | endif |
|---|
| 151 | if test -n "$(PY-SQLOBJECT_PATCHES)" ; then \ |
|---|
| 152 | cat $(PY-SQLOBJECT_PATCHES) | patch -d $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) -p0 ; \ |
|---|
| 153 | fi |
|---|
| 154 | mv $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) $(PY-SQLOBJECT_BUILD_DIR)/2.6 |
|---|
| 155 | (cd $(PY-SQLOBJECT_BUILD_DIR); \ |
|---|
| 156 | sed -i -e '/use_setuptools/d' setup.py; \ |
|---|
| 157 | (echo "[build_scripts]"; echo "executable=/opt/bin/python2.6") >> setup.cfg \ |
|---|
| 158 | ) |
|---|
| 159 | touch $@ |
|---|
| 160 | |
|---|
| 161 | py-sqlobject-unpack: $(PY-SQLOBJECT_BUILD_DIR)/.configured |
|---|
| 162 | |
|---|
| 163 | # |
|---|
| 164 | # This builds the actual binary. |
|---|
| 165 | # |
|---|
| 166 | $(PY-SQLOBJECT_BUILD_DIR)/.built: $(PY-SQLOBJECT_BUILD_DIR)/.configured |
|---|
| 167 | rm -f $@ |
|---|
| 168 | (cd $(@D)/2.5; \ |
|---|
| 169 | PYTHONPATH=$(STAGING_LIB_DIR)/python2.5/site-packages \ |
|---|
| 170 | $(HOST_STAGING_PREFIX)/bin/python2.5 -c "import setuptools; execfile('setup.py')" build) |
|---|
| 171 | (cd $(@D)/2.6; \ |
|---|
| 172 | PYTHONPATH=$(STAGING_LIB_DIR)/python2.6/site-packages \ |
|---|
| 173 | $(HOST_STAGING_PREFIX)/bin/python2.6 -c "import setuptools; execfile('setup.py')" build) |
|---|
| 174 | touch $@ |
|---|
| 175 | |
|---|
| 176 | # |
|---|
| 177 | # This is the build convenience target. |
|---|
| 178 | # |
|---|
| 179 | py-sqlobject: $(PY-SQLOBJECT_BUILD_DIR)/.built |
|---|
| 180 | |
|---|
| 181 | # |
|---|
| 182 | # If you are building a library, then you need to stage it too. |
|---|
| 183 | # |
|---|
| 184 | $(PY-SQLOBJECT_BUILD_DIR)/.staged: $(PY-SQLOBJECT_BUILD_DIR)/.built |
|---|
| 185 | rm -f $@ |
|---|
| 186 | # $(MAKE) -C $(PY-SQLOBJECT_BUILD_DIR) DESTDIR=$(STAGING_DIR) install |
|---|
| 187 | touch $@ |
|---|
| 188 | |
|---|
| 189 | py-sqlobject-stage: $(PY-SQLOBJECT_BUILD_DIR)/.staged |
|---|
| 190 | |
|---|
| 191 | # |
|---|
| 192 | # This rule creates a control file for ipkg. It is no longer |
|---|
| 193 | # necessary to create a seperate control file under sources/py-sqlobject |
|---|
| 194 | # |
|---|
| 195 | $(PY25-SQLOBJECT_IPK_DIR)/CONTROL/control: |
|---|
| 196 | @install -d $(@D) |
|---|
| 197 | @rm -f $@ |
|---|
| 198 | @echo "Package: py25-sqlobject" >>$@ |
|---|
| 199 | @echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 200 | @echo "Priority: $(PY-SQLOBJECT_PRIORITY)" >>$@ |
|---|
| 201 | @echo "Section: $(PY-SQLOBJECT_SECTION)" >>$@ |
|---|
| 202 | @echo "Version: $(PY-SQLOBJECT_VERSION)-$(PY-SQLOBJECT_IPK_VERSION)" >>$@ |
|---|
| 203 | @echo "Maintainer: $(PY-SQLOBJECT_MAINTAINER)" >>$@ |
|---|
| 204 | @echo "Source: $(PY-SQLOBJECT_SITE)/$(PY-SQLOBJECT_SOURCE)" >>$@ |
|---|
| 205 | @echo "Description: $(PY-SQLOBJECT_DESCRIPTION)" >>$@ |
|---|
| 206 | @echo "Depends: $(PY25-SQLOBJECT_DEPENDS)" >>$@ |
|---|
| 207 | @echo "Suggests: $(PY25-SQLOBJECT_SUGGESTS)" >>$@ |
|---|
| 208 | @echo "Conflicts: $(PY-SQLOBJECT_CONFLICTS)" >>$@ |
|---|
| 209 | |
|---|
| 210 | $(PY26-SQLOBJECT_IPK_DIR)/CONTROL/control: |
|---|
| 211 | @install -d $(@D) |
|---|
| 212 | @rm -f $@ |
|---|
| 213 | @echo "Package: py26-sqlobject" >>$@ |
|---|
| 214 | @echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 215 | @echo "Priority: $(PY-SQLOBJECT_PRIORITY)" >>$@ |
|---|
| 216 | @echo "Section: $(PY-SQLOBJECT_SECTION)" >>$@ |
|---|
| 217 | @echo "Version: $(PY-SQLOBJECT_VERSION)-$(PY-SQLOBJECT_IPK_VERSION)" >>$@ |
|---|
| 218 | @echo "Maintainer: $(PY-SQLOBJECT_MAINTAINER)" >>$@ |
|---|
| 219 | @echo "Source: $(PY-SQLOBJECT_SITE)/$(PY-SQLOBJECT_SOURCE)" >>$@ |
|---|
| 220 | @echo "Description: $(PY-SQLOBJECT_DESCRIPTION)" >>$@ |
|---|
| 221 | @echo "Depends: $(PY26-SQLOBJECT_DEPENDS)" >>$@ |
|---|
| 222 | @echo "Suggests: $(PY26-SQLOBJECT_SUGGESTS)" >>$@ |
|---|
| 223 | @echo "Conflicts: $(PY-SQLOBJECT_CONFLICTS)" >>$@ |
|---|
| 224 | |
|---|
| 225 | # |
|---|
| 226 | # This builds the IPK file. |
|---|
| 227 | # |
|---|
| 228 | # Binaries should be installed into $(PY-SQLOBJECT_IPK_DIR)/opt/sbin or $(PY-SQLOBJECT_IPK_DIR)/opt/bin |
|---|
| 229 | # (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 230 | # Libraries and include files should be installed into $(PY-SQLOBJECT_IPK_DIR)/opt/{lib,include} |
|---|
| 231 | # Configuration files should be installed in $(PY-SQLOBJECT_IPK_DIR)/opt/etc/py-sqlobject/... |
|---|
| 232 | # Documentation files should be installed in $(PY-SQLOBJECT_IPK_DIR)/opt/doc/py-sqlobject/... |
|---|
| 233 | # Daemon startup scripts should be installed in $(PY-SQLOBJECT_IPK_DIR)/opt/etc/init.d/S??py-sqlobject |
|---|
| 234 | # |
|---|
| 235 | # You may need to patch your application to make it use these locations. |
|---|
| 236 | # |
|---|
| 237 | $(PY25-SQLOBJECT_IPK): $(PY-SQLOBJECT_BUILD_DIR)/.built |
|---|
| 238 | rm -rf $(BUILD_DIR)/py*-sqlobject_*_$(TARGET_ARCH).ipk |
|---|
| 239 | rm -rf $(PY25-SQLOBJECT_IPK_DIR) $(BUILD_DIR)/py25-sqlobject_*_$(TARGET_ARCH).ipk |
|---|
| 240 | (cd $(PY-SQLOBJECT_BUILD_DIR)/2.5; \ |
|---|
| 241 | PYTHONPATH=$(STAGING_LIB_DIR)/python2.5/site-packages \ |
|---|
| 242 | $(HOST_STAGING_PREFIX)/bin/python2.5 -c "import setuptools; execfile('setup.py')" install \ |
|---|
| 243 | --root=$(PY25-SQLOBJECT_IPK_DIR) --prefix=/opt) |
|---|
| 244 | $(MAKE) $(PY25-SQLOBJECT_IPK_DIR)/CONTROL/control |
|---|
| 245 | # echo $(PY-SQLOBJECT_CONFFILES) | sed -e 's/ /\n/g' > $(PY25-SQLOBJECT_IPK_DIR)/CONTROL/conffiles |
|---|
| 246 | cd $(BUILD_DIR); $(IPKG_BUILD) $(PY25-SQLOBJECT_IPK_DIR) |
|---|
| 247 | |
|---|
| 248 | $(PY26-SQLOBJECT_IPK): $(PY-SQLOBJECT_BUILD_DIR)/.built |
|---|
| 249 | rm -rf $(PY26-SQLOBJECT_IPK_DIR) $(BUILD_DIR)/py26-sqlobject_*_$(TARGET_ARCH).ipk |
|---|
| 250 | (cd $(PY-SQLOBJECT_BUILD_DIR)/2.6; \ |
|---|
| 251 | PYTHONPATH=$(STAGING_LIB_DIR)/python2.6/site-packages \ |
|---|
| 252 | $(HOST_STAGING_PREFIX)/bin/python2.6 -c "import setuptools; execfile('setup.py')" install \ |
|---|
| 253 | --root=$(PY26-SQLOBJECT_IPK_DIR) --prefix=/opt) |
|---|
| 254 | for f in $(PY26-SQLOBJECT_IPK_DIR)/opt/bin/*; \ |
|---|
| 255 | do mv $$f `echo $$f | sed 's|$$|-2.6|'`; done |
|---|
| 256 | $(MAKE) $(PY26-SQLOBJECT_IPK_DIR)/CONTROL/control |
|---|
| 257 | # echo $(PY-SQLOBJECT_CONFFILES) | sed -e 's/ /\n/g' > $(PY26-SQLOBJECT_IPK_DIR)/CONTROL/conffiles |
|---|
| 258 | cd $(BUILD_DIR); $(IPKG_BUILD) $(PY26-SQLOBJECT_IPK_DIR) |
|---|
| 259 | |
|---|
| 260 | # |
|---|
| 261 | # This is called from the top level makefile to create the IPK file. |
|---|
| 262 | # |
|---|
| 263 | py-sqlobject-ipk: $(PY25-SQLOBJECT_IPK) $(PY26-SQLOBJECT_IPK) |
|---|
| 264 | |
|---|
| 265 | # |
|---|
| 266 | # This is called from the top level makefile to clean all of the built files. |
|---|
| 267 | # |
|---|
| 268 | py-sqlobject-clean: |
|---|
| 269 | -$(MAKE) -C $(PY-SQLOBJECT_BUILD_DIR) clean |
|---|
| 270 | |
|---|
| 271 | # |
|---|
| 272 | # This is called from the top level makefile to clean all dynamically created |
|---|
| 273 | # directories. |
|---|
| 274 | # |
|---|
| 275 | py-sqlobject-dirclean: |
|---|
| 276 | rm -rf $(BUILD_DIR)/$(PY-SQLOBJECT_DIR) $(PY-SQLOBJECT_BUILD_DIR) |
|---|
| 277 | rm -rf $(PY25-SQLOBJECT_IPK_DIR) $(PY25-SQLOBJECT_IPK) |
|---|
| 278 | rm -rf $(PY26-SQLOBJECT_IPK_DIR) $(PY26-SQLOBJECT_IPK) |
|---|
| 279 | |
|---|
| 280 | # |
|---|
| 281 | # Some sanity check for the package. |
|---|
| 282 | # |
|---|
| 283 | py-sqlobject-check: $(PY25-SQLOBJECT_IPK) $(PY26-SQLOBJECT_IPK) |
|---|
| 284 | perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^ |
|---|