| 1 |
########################################################### |
|---|
| 2 |
# |
|---|
| 3 |
# 9base |
|---|
| 4 |
# |
|---|
| 5 |
########################################################### |
|---|
| 6 |
# |
|---|
| 7 |
# 9BASE_VERSION, 9BASE_SITE and 9BASE_SOURCE define |
|---|
| 8 |
# the upstream location of the source code for the package. |
|---|
| 9 |
# 9BASE_DIR is the directory which is created when the source |
|---|
| 10 |
# archive is unpacked. |
|---|
| 11 |
# 9BASE_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 |
9BASE_SITE=http://dl.suckless.org/tools |
|---|
| 24 |
9BASE_UPSTREAM_VERSION=4 |
|---|
| 25 |
9BASE_VERSION=4+20090827 |
|---|
| 26 |
9BASE_UPSTREAM_SOURCE=9base-$(9BASE_UPSTREAM_VERSION).tar.gz |
|---|
| 27 |
9BASE_SOURCE=9base-$(9BASE_VERSION).tar.gz |
|---|
| 28 |
9BASE_SOURCE_MD5=af10410542ea6b6875a71e06fdc12c66 |
|---|
| 29 |
9BASE_DIR=9base-$(9BASE_UPSTREAM_VERSION) |
|---|
| 30 |
9BASE_UNZIP=zcat |
|---|
| 31 |
9BASE_MAINTAINER=NSLU2 Linux <nslu2-linux@yahoogroups.com> |
|---|
| 32 |
9BASE_DESCRIPTION=9base is a port of a few original Plan 9 userland tools to Unix. |
|---|
| 33 |
9BASE_SECTION=utils |
|---|
| 34 |
9BASE_PRIORITY=optional |
|---|
| 35 |
9BASE_DEPENDS= |
|---|
| 36 |
9BASE_SUGGESTS= |
|---|
| 37 |
9BASE_CONFLICTS= |
|---|
| 38 |
|
|---|
| 39 |
9BASE_IPK_VERSION=1 |
|---|
| 40 |
|
|---|
| 41 |
#9BASE_CONFFILES=/opt/etc/9base.conf /opt/etc/init.d/SXX9base |
|---|
| 42 |
|
|---|
| 43 |
#9BASE_PATCHES=$(9BASE_SOURCE_DIR)/configure.patch |
|---|
| 44 |
|
|---|
| 45 |
9BASE_CPPFLAGS= |
|---|
| 46 |
ifeq (uclibc,$(LIBC_STYLE)) |
|---|
| 47 |
9BASE_LDFLAGS=-lm |
|---|
| 48 |
endif |
|---|
| 49 |
|
|---|
| 50 |
9BASE_SOURCE_DIR=$(SOURCE_DIR)/9base |
|---|
| 51 |
9BASE_BUILD_DIR=$(BUILD_DIR)/9base |
|---|
| 52 |
9BASE_HOST_BUILD_DIR=$(HOST_BUILD_DIR)/9base |
|---|
| 53 |
9BASE_IPK_DIR=$(BUILD_DIR)/9base-$(9BASE_VERSION)-ipk |
|---|
| 54 |
9BASE_IPK=$(BUILD_DIR)/9base_$(9BASE_VERSION)-$(9BASE_IPK_VERSION)_$(TARGET_ARCH).ipk |
|---|
| 55 |
|
|---|
| 56 |
.PHONY: 9base-source 9base-unpack 9base 9base-stage 9base-ipk 9base-clean 9base-dirclean \ |
|---|
| 57 |
9base-check 9base-host 9base-host-stage |
|---|
| 58 |
|
|---|
| 59 |
$(DL_DIR)/$(9BASE_SOURCE): |
|---|
| 60 |
rm -f $@ $(@D)/$(9BASE_UPSTREAM_SOURCE) |
|---|
| 61 |
$(WGET) -P $(@D) $(9BASE_SITE)/$(9BASE_UPSTREAM_SOURCE) && \ |
|---|
| 62 |
test `md5sum $(@D)/$(9BASE_UPSTREAM_SOURCE) | cut -f1 -d" "` = $(9BASE_SOURCE_MD5) && \ |
|---|
| 63 |
mv $(@D)/$(9BASE_UPSTREAM_SOURCE) $@ || \ |
|---|
| 64 |
$(WGET) -P $(@D) $(SOURCES_NLO_SITE)/$(@F) |
|---|
| 65 |
|
|---|
| 66 |
9base-source: $(DL_DIR)/$(9BASE_SOURCE) $(9BASE_PATCHES) |
|---|
| 67 |
|
|---|
| 68 |
$(9BASE_HOST_BUILD_DIR)/.built: host/.configured $(DL_DIR)/$(9BASE_SOURCE) make/9base.mk |
|---|
| 69 |
rm -rf $(HOST_BUILD_DIR)/$(9BASE_DIR) $(@D) |
|---|
| 70 |
$(9BASE_UNZIP) $(DL_DIR)/$(9BASE_SOURCE) | tar -C $(HOST_BUILD_DIR) -xvf - |
|---|
| 71 |
if test "$(HOST_BUILD_DIR)/$(9BASE_DIR)" != "$(@D)" ; \ |
|---|
| 72 |
then mv $(HOST_BUILD_DIR)/$(9BASE_DIR) $(@D) ; \ |
|---|
| 73 |
fi |
|---|
| 74 |
sed -i -e 's|/usr/local/plan9|/opt/lib/9base|' \ |
|---|
| 75 |
$(@D)/lib9/get9root.c $(@D)/lib9/_p9translate.c |
|---|
| 76 |
$(MAKE) -C $(@D) \ |
|---|
| 77 |
PREFIX=/opt/lib/9base \ |
|---|
| 78 |
SUBDIRS="lib9 yacc" \ |
|---|
| 79 |
; |
|---|
| 80 |
touch $@ |
|---|
| 81 |
|
|---|
| 82 |
$(9BASE_HOST_BUILD_DIR)/.staged: $(9BASE_HOST_BUILD_DIR)/.built |
|---|
| 83 |
rm -f $@ |
|---|
| 84 |
$(MAKE) -C $(@D) install \ |
|---|
| 85 |
DESTDIR=$(HOST_STAGING_DIR) \ |
|---|
| 86 |
PREFIX=/opt/lib/9base \ |
|---|
| 87 |
SUBDIRS="yacc" \ |
|---|
| 88 |
; |
|---|
| 89 |
touch $@ |
|---|
| 90 |
|
|---|
| 91 |
9base-host: $(9BASE_HOST_BUILD_DIR)/.built |
|---|
| 92 |
9base-host-stage: $(9BASE_HOST_BUILD_DIR)/.staged |
|---|
| 93 |
|
|---|
| 94 |
$(9BASE_BUILD_DIR)/.configured: $(9BASE_HOST_BUILD_DIR)/.staged $(9BASE_PATCHES) |
|---|
| 95 |
rm -rf $(BUILD_DIR)/$(9BASE_DIR) $(@D) |
|---|
| 96 |
$(9BASE_UNZIP) $(DL_DIR)/$(9BASE_SOURCE) | tar -C $(BUILD_DIR) -xvf - |
|---|
| 97 |
if test -n "$(9BASE_PATCHES)" ; \ |
|---|
| 98 |
then cat $(9BASE_PATCHES) | \ |
|---|
| 99 |
patch -d $(BUILD_DIR)/$(9BASE_DIR) -p0 ; \ |
|---|
| 100 |
fi |
|---|
| 101 |
if test "$(BUILD_DIR)/$(9BASE_DIR)" != "$(@D)" ; \ |
|---|
| 102 |
then mv $(BUILD_DIR)/$(9BASE_DIR) $(@D) ; \ |
|---|
| 103 |
fi |
|---|
| 104 |
ifneq (, $(filter fsg3 nslu2, $(OPTWARE_TARGET))) |
|---|
| 105 |
sed -i -e 's/ || defined(__linux__)//' $(@D)/lib9/dirfwstat.c |
|---|
| 106 |
endif |
|---|
| 107 |
sed -i -e '/yacc $$\*/s|^.*yacc |$(HOST_STAGING_LIB_DIR)/9base/bin/yacc |' $(@D)/yacc/9yacc |
|---|
| 108 |
sed -i -e 's|strip|$${STRIP}|' $(@D)/std.mk |
|---|
| 109 |
touch $@ |
|---|
| 110 |
|
|---|
| 111 |
9base-unpack: $(9BASE_BUILD_DIR)/.configured |
|---|
| 112 |
|
|---|
| 113 |
# |
|---|
| 114 |
# This builds the actual binary. |
|---|
| 115 |
# |
|---|
| 116 |
$(9BASE_BUILD_DIR)/.built: $(9BASE_BUILD_DIR)/.configured |
|---|
| 117 |
rm -f $@ |
|---|
| 118 |
$(MAKE) -C $(@D) \ |
|---|
| 119 |
$(TARGET_CONFIGURE_OPTS) \ |
|---|
| 120 |
CPPFLAGS="$(STAGING_CPPFLAGS) $(9BASE_CPPFLAGS)" \ |
|---|
| 121 |
LDFLAGS="$(STAGING_LDFLAGS) $(9BASE_LDFLAGS)" \ |
|---|
| 122 |
AR="$(TARGET_AR) rc" \ |
|---|
| 123 |
STRIP="$(STRIP_COMMAND)" \ |
|---|
| 124 |
PREFIX=/opt/lib/9base \ |
|---|
| 125 |
; |
|---|
| 126 |
touch $@ |
|---|
| 127 |
|
|---|
| 128 |
# |
|---|
| 129 |
# This is the build convenience target. |
|---|
| 130 |
# |
|---|
| 131 |
9base: $(9BASE_BUILD_DIR)/.built |
|---|
| 132 |
|
|---|
| 133 |
# |
|---|
| 134 |
# If you are building a library, then you need to stage it too. |
|---|
| 135 |
# |
|---|
| 136 |
#$(9BASE_BUILD_DIR)/.staged: $(9BASE_BUILD_DIR)/.built |
|---|
| 137 |
# rm -f $@ |
|---|
| 138 |
# $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) install |
|---|
| 139 |
# touch $@ |
|---|
| 140 |
# |
|---|
| 141 |
#9base-stage: $(9BASE_BUILD_DIR)/.staged |
|---|
| 142 |
|
|---|
| 143 |
# |
|---|
| 144 |
# This rule creates a control file for ipkg. It is no longer |
|---|
| 145 |
# necessary to create a seperate control file under sources/9base |
|---|
| 146 |
# |
|---|
| 147 |
$(9BASE_IPK_DIR)/CONTROL/control: |
|---|
| 148 |
@install -d $(@D) |
|---|
| 149 |
@rm -f $@ |
|---|
| 150 |
@echo "Package: 9base" >>$@ |
|---|
| 151 |
@echo "Architecture: $(TARGET_ARCH)" >>$@ |
|---|
| 152 |
@echo "Priority: $(9BASE_PRIORITY)" >>$@ |
|---|
| 153 |
@echo "Section: $(9BASE_SECTION)" >>$@ |
|---|
| 154 |
@echo "Version: $(9BASE_VERSION)-$(9BASE_IPK_VERSION)" >>$@ |
|---|
| 155 |
@echo "Maintainer: $(9BASE_MAINTAINER)" >>$@ |
|---|
| 156 |
@echo "Source: $(9BASE_SITE)/$(9BASE_SOURCE)" >>$@ |
|---|
| 157 |
@echo "Description: $(9BASE_DESCRIPTION)" >>$@ |
|---|
| 158 |
@echo "Depends: $(9BASE_DEPENDS)" >>$@ |
|---|
| 159 |
@echo "Suggests: $(9BASE_SUGGESTS)" >>$@ |
|---|
| 160 |
@echo "Conflicts: $(9BASE_CONFLICTS)" >>$@ |
|---|
| 161 |
|
|---|
| 162 |
# |
|---|
| 163 |
# This builds the IPK file. |
|---|
| 164 |
# |
|---|
| 165 |
# Binaries should be installed into $(9BASE_IPK_DIR)/opt/sbin or $(9BASE_IPK_DIR)/opt/bin |
|---|
| 166 |
# (use the location in a well-known Linux distro as a guide for choosing sbin or bin). |
|---|
| 167 |
# Libraries and include files should be installed into $(9BASE_IPK_DIR)/opt/{lib,include} |
|---|
| 168 |
# Configuration files should be installed in $(9BASE_IPK_DIR)/opt/etc/9base/... |
|---|
| 169 |
# Documentation files should be installed in $(9BASE_IPK_DIR)/opt/doc/9base/... |
|---|
| 170 |
# Daemon startup scripts should be installed in $(9BASE_IPK_DIR)/opt/etc/init.d/S??9base |
|---|
| 171 |
# |
|---|
| 172 |
# You may need to patch your application to make it use these locations. |
|---|
| 173 |
# |
|---|
| 174 |
$(9BASE_IPK): $(9BASE_BUILD_DIR)/.built |
|---|
| 175 |
rm -rf $(9BASE_IPK_DIR) $(BUILD_DIR)/9base_*_$(TARGET_ARCH).ipk |
|---|
| 176 |
$(MAKE) -C $(9BASE_BUILD_DIR) install \ |
|---|
| 177 |
DESTDIR=$(9BASE_IPK_DIR) \ |
|---|
| 178 |
PREFIX=/opt/lib/9base \ |
|---|
| 179 |
STRIP="true" \ |
|---|
| 180 |
; |
|---|
| 181 |
$(STRIP_COMMAND) $(9BASE_IPK_DIR)/opt/lib/9base/bin/* |
|---|
| 182 |
install -d $(9BASE_IPK_DIR)/opt/share |
|---|
| 183 |
mv $(9BASE_IPK_DIR)/opt/lib/9base/share/man $(9BASE_IPK_DIR)/opt/share/ |
|---|
| 184 |
rmdir $(9BASE_IPK_DIR)/opt/lib/9base/share |
|---|
| 185 |
for d in man1; do \ |
|---|
| 186 |
cd $(9BASE_IPK_DIR)/opt/share/man/$$d; \ |
|---|
| 187 |
for f in *; do mv $$f 9base-$$f; done; \ |
|---|
| 188 |
done |
|---|
| 189 |
$(MAKE) $(9BASE_IPK_DIR)/CONTROL/control |
|---|
| 190 |
echo $(9BASE_CONFFILES) | sed -e 's/ /\n/g' > $(9BASE_IPK_DIR)/CONTROL/conffiles |
|---|
| 191 |
cd $(BUILD_DIR); $(IPKG_BUILD) $(9BASE_IPK_DIR) |
|---|
| 192 |
|
|---|
| 193 |
# |
|---|
| 194 |
# This is called from the top level makefile to create the IPK file. |
|---|
| 195 |
# |
|---|
| 196 |
9base-ipk: $(9BASE_IPK) |
|---|
| 197 |
|
|---|
| 198 |
# |
|---|
| 199 |
# This is called from the top level makefile to clean all of the built files. |
|---|
| 200 |
# |
|---|
| 201 |
9base-clean: |
|---|
| 202 |
rm -f $(9BASE_BUILD_DIR)/.built |
|---|
| 203 |
-$(MAKE) -C $(9BASE_BUILD_DIR) clean |
|---|
| 204 |
|
|---|
| 205 |
# |
|---|
| 206 |
# This is called from the top level makefile to clean all dynamically created |
|---|
| 207 |
# directories. |
|---|
| 208 |
# |
|---|
| 209 |
9base-dirclean: |
|---|
| 210 |
rm -rf $(BUILD_DIR)/$(9BASE_DIR) $(9BASE_BUILD_DIR) $(9BASE_IPK_DIR) $(9BASE_IPK) |
|---|
| 211 |
rm -rf $(9BASE_HOST_BUILD_DIR) |
|---|
| 212 |
# |
|---|
| 213 |
# |
|---|
| 214 |
# Some sanity check for the package. |
|---|
| 215 |
# |
|---|
| 216 |
9base-check: $(9BASE_IPK) |
|---|
| 217 |
perl scripts/optware-check-package.pl --target=$(OPTWARE_TARGET) $^ |
|---|