CC xorg list in the announce template.
[xorg-util-modular.git] / modularizeapp.sh
blob258ffec600635137c187cb50ea862241b3d650fc
1 #!/bin/bash
3 # Variables
5 if [ -z $1 ] ; then
6 echo
7 echo Usage: $0 \<directory\>
8 echo
9 exit
12 # fixme: modular dir should
14 MODULAR_DIR=`( cd $1 ; cd ../.. ; pwd )`
15 MODULE_DIR=`( cd $1 ; pwd )`
16 MODULE_NAME=`( basename $MODULE_DIR )`
17 modulename=`echo $MODULE_NAME | tr "[:upper:]" "[:lower:]"`
19 if [ -z foo ] ; then
20 echo Modular dir: $MODULAR_DIR
21 echo Module dir : $MODULE_DIR
22 echo Name: $MODULE_NAME
23 echo lower: $modulename
24 echo Man dir: $HAS_MAN_DIR
25 echo Include dir: $HAS_INCLUDE_DIR
28 cd $MODULE_DIR
30 touch AUTHORS
31 touch ChangeLog
32 touch COPYING
33 touch INSTALL
34 touch NEWS
35 touch README
37 # touch
38 # Generate README
39 # touch
40 # Generate Makefile.am
42 rm -f Makefile.am
44 cat <<EOF >> Makefile.am
46 # Copyright 2005 Red Hat, Inc.
48 # Permission to use, copy, modify, distribute, and sell this software and its
49 # documentation for any purpose is hereby granted without fee, provided that
50 # the above copyright notice appear in all copies and that both that
51 # copyright notice and this permission notice appear in supporting
52 # documentation, and that the name of Red Hat not be used in
53 # advertising or publicity pertaining to distribution of the software without
54 # specific, written prior permission. Red Hat makes no
55 # representations about the suitability of this software for any purpose. It
56 # is provided "as is" without express or implied warranty.
58 # RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
59 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
60 # EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
61 # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
62 # DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
63 # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
64 # PERFORMANCE OF THIS SOFTWARE.
66 bin_PROGRAMS = $modulename
68 ${modulename}_CFLAGS = \$(DEP_CFLAGS)
69 ${modulename}_LDADD = \$(DEP_LIBS)
71 ${modulename}_SOURCES = \\
72 EOF
74 # Source files
76 for x in `ls *.[ch]` ; do
77 LAST=$x
78 done
80 for x in `ls *.[ch]`; do
81 if [ $x = $LAST ] ; then
82 echo \ \ \ \ \ \ \ \ $x >> Makefile.am
83 else
84 echo \ \ \ \ \ \ \ \ $x \\ >> Makefile.am
86 done
88 echo >> Makefile.am
90 # Man files
92 LAST=
93 for x in `ls *.man` ; do
94 LAST=$x
95 done
97 if [ ! -z $LAST ] ; then
98 echo dist_man_MANS = \\ >> Makefile.am
99 for x in `ls *.man` ; do
100 if [ $x = $LAST ] ; then
101 echo \ \ \ \ \ \ \ \ $x >> Makefile.am
102 else
103 echo \ \ \ \ \ \ \ \ $x \\ >> Makefile.am
105 done
107 echo >> Makefile.am
110 # .ad files
112 LAST=
113 for x in `ls *.ad` ; do
114 LAST=$x
115 done
117 if [ ! -z $LAST ] ; then
118 cat <<EOF >> Makefile.am
119 # App default files (*.ad)
121 appdefaultdir = \$(sysconfdir)/X11/app-defaults
125 cat <<EOF >> Makefile.am
127 APPDEFAULTFILES = \\
130 for x in `ls *.ad` ; do
131 FILE=`echo $x | sed 's/\.ad//'`
132 if [ $x = $LAST ] ; then
133 echo \ \ \ \ \ \ \ \ $FILE >> Makefile.am
134 else
135 echo \ \ \ \ \ \ \ \ $FILE \\ >> Makefile.am
137 done
139 cat <<EOF >> Makefile.am
141 SUFFIXES = .ad
143 .ad:
144 cp \$< \$@
146 appdefault_DATA = \$(APPDEFAULTFILES)
148 EXTRA_DIST = \$(APPDEFAULTFILES:%=%.ad)
150 CLEANFILES = \$(APPDEFAULTFILES)
155 # Generate configure.ac
156 rm -f configure.ac
158 cat <<EOF >> $MODULE_DIR/configure.ac
160 dnl Copyright 2005 Red Hat, Inc.
161 dnl
162 dnl Permission to use, copy, modify, distribute, and sell this software and its
163 dnl documentation for any purpose is hereby granted without fee, provided that
164 dnl the above copyright notice appear in all copies and that both that
165 dnl copyright notice and this permission notice appear in supporting
166 dnl documentation, and that the name of Red Hat not be used in
167 dnl advertising or publicity pertaining to distribution of the software without
168 dnl specific, written prior permission. Red Hat makes no
169 dnl representations about the suitability of this software for any purpose. It
170 dnl is provided "as is" without express or implied warranty.
171 dnl
172 dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
173 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
174 dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
175 dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
176 dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
177 dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
178 dnl PERFORMANCE OF THIS SOFTWARE.
180 dnl Process this file with autoconf to create configure.
182 AC_PREREQ([2.57])
183 AC_INIT($modulename,[7.0], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],$modulename)
184 AM_INIT_AUTOMAKE([dist-bzip2])
185 AM_MAINTAINER_MODE
187 AM_CONFIG_HEADER(config.h)
189 AC_PROG_CC
190 AC_PROG_INSTALL
192 # Checks for pkg-config packages
193 PKG_CHECK_MODULES(DEP, x11)
194 AC_SUBST(DEP_CFLAGS)
195 AC_SUBST(DEP_LIBS)
197 AC_OUTPUT([Makefile])
201 rm -f autogen.sh
202 cat <<EOF >> autogen.sh
203 #! /bin/sh
205 srcdir=\`dirname \$0\`
206 test -z "\$srcdir" && srcdir=.
208 ORIGDIR=\`pwd\`
209 cd \$srcdir
211 autoreconf -v --install || exit 1
212 cd \$ORIGDIR || exit \$?
214 \$srcdir/configure --enable-maintainer-mode "\$@"
217 chmod a+x autogen.sh