root/trunk/make/alsa-lib.mk

Revision 1327, 6.0 kB (checked in by rwhitby, 5 years ago)

Patched to use TARGET_ARCH - @FOO@ variables put in some control files, and modified on the fly using sed

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 ###########################################################
2 #
3 # alsa-lib
4 #
5 ###########################################################
6
7 # You must replace "alsa-lib" and "ALSA-LIB" with the lower case name and
8 # upper case name of your new package.  Some places below will say
9 # "Do not change this" - that does not include this global change,
10 # which must always be done to ensure we have unique names.
11
12 #
13 # ALSA-LIB_VERSION, ALSA-LIB_SITE and ALSA-LIB_SOURCE define
14 # the upstream location of the source code for the package.
15 # ALSA-LIB_DIR is the directory which is created when the source
16 # archive is unpacked.
17 # ALSA-LIB_UNZIP is the command used to unzip the source.
18 # It is usually "zcat" (for .gz) or "bzcat" (for .bz2)
19 #
20 # You should change all these variables to suit your package.
21 #
22 ALSA-LIB_SITE=ftp://ftp.alsa-project.org/pub/lib
23 ALSA-LIB_VERSION=1.0.8
24 ALSA-LIB_SOURCE=alsa-lib-$(ALSA-LIB_VERSION).tar.bz2
25 ALSA-LIB_DIR=alsa-lib-$(ALSA-LIB_VERSION)
26 ALSA-LIB_UNZIP=bzcat
27
28 #
29 # ALSA-LIB_IPK_VERSION should be incremented when the ipk changes.
30 #
31 ALSA-LIB_IPK_VERSION=1
32
33 #
34 # ALSA-LIB_CONFFILES should be a list of user-editable files
35 ALSA-LIB_CONFFILES=
36
37 #
38 # ALSA-LIB_PATCHES should list any patches, in the the order in
39 # which they should be applied to the source code.
40 #
41 ALSA-LIB_PATCHES=/dev/null
42
43 #
44 # If the compilation of the package requires additional
45 # compilation or linking flags, then list them here.
46 #
47 ALSA-LIB_CPPFLAGS=
48 ALSA-LIB_LDFLAGS=
49
50 #
51 # ALSA-LIB_BUILD_DIR is the directory in which the build is done.
52 # ALSA-LIB_SOURCE_DIR is the directory which holds all the
53 # patches and ipkg control files.
54 # ALSA-LIB_IPK_DIR is the directory in which the ipk is built.
55 # ALSA-LIB_IPK is the name of the resulting ipk files.
56 #
57 # You should not change any of these variables.
58 #
59 ALSA-LIB_BUILD_DIR=$(BUILD_DIR)/alsa-lib
60 ALSA-LIB_SOURCE_DIR=$(SOURCE_DIR)/alsa-lib
61 ALSA-LIB_IPK_DIR=$(BUILD_DIR)/alsa-lib-$(ALSA-LIB_VERSION)-ipk
62 ALSA-LIB_IPK=$(BUILD_DIR)/alsa-lib_$(ALSA-LIB_VERSION)-$(ALSA-LIB_IPK_VERSION)_$(TARGET_ARCH).ipk
63
64 #
65 # This is the dependency on the source code.  If the source is missing,
66 # then it will be fetched from the site using wget.
67 #
68 $(DL_DIR)/$(ALSA-LIB_SOURCE):
69         $(WGET) -P $(DL_DIR) $(ALSA-LIB_SITE)/$(ALSA-LIB_SOURCE)
70
71 #
72 # The source code depends on it existing within the download directory.
73 # This target will be called by the top level Makefile to download the
74 # source code's archive (.tar.gz, .bz2, etc.)
75 #
76 alsa-lib-source: $(DL_DIR)/$(ALSA-LIB_SOURCE) $(ALSA-LIB_PATCHES)
77
78 #
79 # This target unpacks the source code in the build directory.
80 # If the source archive is not .tar.gz or .tar.bz2, then you will need
81 # to change the commands here.  Patches to the source code are also
82 # applied in this target as required.
83 #
84 # This target also configures the build within the build directory.
85 # Flags such as LDFLAGS and CPPFLAGS should be passed into configure
86 # and NOT $(MAKE) below.  Passing it to configure causes configure to
87 # correctly BUILD the Makefile with the right paths, where passing it
88 # to Make causes it to override the default search paths of the compiler.
89 #
90 # If the compilation of the package requires other packages to be staged
91 # first, then do that first (e.g. "$(MAKE) <bar>-stage <baz>-stage").
92 #
93 $(ALSA-LIB_BUILD_DIR)/.configured: $(DL_DIR)/$(ALSA-LIB_SOURCE) $(ALSA-LIB_PATCHES)
94         rm -rf $(BUILD_DIR)/$(ALSA-LIB_DIR) $(ALSA-LIB_BUILD_DIR)
95         $(ALSA-LIB_UNZIP) $(DL_DIR)/$(ALSA-LIB_SOURCE) | tar -C $(BUILD_DIR) -xvf -
96         cat $(ALSA-LIB_PATCHES) | patch -d $(BUILD_DIR)/$(ALSA-LIB_DIR) -p1
97         mv $(BUILD_DIR)/$(ALSA-LIB_DIR) $(ALSA-LIB_BUILD_DIR)
98         (cd $(ALSA-LIB_BUILD_DIR); \
99                 $(TARGET_CONFIGURE_OPTS) \
100                 CPPFLAGS="$(STAGING_CPPFLAGS) $(ALSA-LIB_CPPFLAGS)" \
101                 LDFLAGS="$(STAGING_LDFLAGS) $(ALSA-LIB_LDFLAGS)" \
102                 ./configure \
103                 --build=$(GNU_HOST_NAME) \
104                 --host=$(GNU_TARGET_NAME) \
105                 --target=$(GNU_TARGET_NAME) \
106                 --prefix=/opt \
107                 --disable-nls \
108         )
109         touch $(ALSA-LIB_BUILD_DIR)/.configured
110
111 alsa-lib-unpack: $(ALSA-LIB_BUILD_DIR)/.configured
112
113 #
114 # This builds the actual binary.
115 #
116 $(ALSA-LIB_BUILD_DIR)/.built: $(ALSA-LIB_BUILD_DIR)/.configured
117         rm -f $(ALSA-LIB_BUILD_DIR)/.built
118         $(MAKE) -C $(ALSA-LIB_BUILD_DIR)
119         touch $(ALSA-LIB_BUILD_DIR)/.built
120
121 #
122 # This is the build convenience target.
123 #
124 alsa-lib: $(ALSA-LIB_BUILD_DIR)/.built
125
126 #
127 # If you are building a library, then you need to stage it too.
128 #
129 $(ALSA-LIB_BUILD_DIR)/.staged: $(ALSA-LIB_BUILD_DIR)/.built
130         rm -f $(ALSA-LIB_BUILD_DIR)/.staged
131         $(MAKE) -C $(ALSA-LIB_BUILD_DIR) DESTDIR=$(STAGING_DIR) install
132         touch $(ALSA-LIB_BUILD_DIR)/.staged
133
134 alsa-lib-stage: $(ALSA-LIB_BUILD_DIR)/.staged
135
136 #
137 # This builds the IPK file.
138 #
139 # Binaries should be installed into $(ALSA-LIB_IPK_DIR)/opt/sbin or $(ALSA-LIB_IPK_DIR)/opt/bin
140 # (use the location in a well-known Linux distro as a guide for choosing sbin or bin).
141 # Libraries and include files should be installed into $(ALSA-LIB_IPK_DIR)/opt/{lib,include}
142 # Configuration files should be installed in $(ALSA-LIB_IPK_DIR)/opt/etc/alsa-lib/...
143 # Documentation files should be installed in $(ALSA-LIB_IPK_DIR)/opt/doc/alsa-lib/...
144 # Daemon startup scripts should be installed in $(ALSA-LIB_IPK_DIR)/opt/etc/init.d/S??alsa-lib
145 #
146 # You may need to patch your application to make it use these locations.
147 #
148 $(ALSA-LIB_IPK): $(ALSA-LIB_BUILD_DIR)/.built
149         rm -rf $(ALSA-LIB_IPK_DIR) $(BUILD_DIR)/alsa-lib_*_$(TARGET_ARCH).ipk
150         $(MAKE) -C $(ALSA-LIB_BUILD_DIR) DESTDIR=$(ALSA-LIB_IPK_DIR) install
151         install -d $(ALSA-LIB_IPK_DIR)/CONTROL
152         install -m 644 $(ALSA-LIB_SOURCE_DIR)/control $(ALSA-LIB_IPK_DIR)/CONTROL/control
153         echo $(ALSA-LIB_CONFFILES) | sed -e 's/ /\n/g' > $(ALSA-LIB_IPK_DIR)/CONTROL/conffiles
154         cd $(BUILD_DIR); $(IPKG_BUILD) $(ALSA-LIB_IPK_DIR)
155
156 #
157 # This is called from the top level makefile to create the IPK file.
158 #
159 alsa-lib-ipk: $(ALSA-LIB_IPK)
160
161 #
162 # This is called from the top level makefile to clean all of the built files.
163 #
164 alsa-lib-clean:
165         -$(MAKE) -C $(ALSA-LIB_BUILD_DIR) clean
166
167 #
168 # This is called from the top level makefile to clean all dynamically created
169 # directories.
170 #
171 alsa-lib-dirclean:
172         rm -rf $(BUILD_DIR)/$(ALSA-LIB_DIR) $(ALSA-LIB_BUILD_DIR) $(ALSA-LIB_IPK_DIR) $(ALSA-LIB_IPK)
Note: See TracBrowser for help on using the browser.