gen-pkgconfig.in revision 262685
1228753Smm#!@SHELL@
2228753Smm# $Id: gen-pkgconfig.in,v 1.16 2014/01/18 20:21:45 tom Exp $
3228753Smm##############################################################################
4228753Smm# Copyright (c) 2009-2013,2014 Free Software Foundation, Inc.                #
5228753Smm#                                                                            #
6228753Smm# Permission is hereby granted, free of charge, to any person obtaining a    #
7228753Smm# copy of this software and associated documentation files (the "Software"), #
8228753Smm# to deal in the Software without restriction, including without limitation  #
9228753Smm# the rights to use, copy, modify, merge, publish, distribute, distribute    #
10228753Smm# with modifications, sublicense, and/or sell copies of the Software, and to #
11228753Smm# permit persons to whom the Software is furnished to do so, subject to the  #
12228753Smm# following conditions:                                                      #
13228753Smm#                                                                            #
14228753Smm# The above copyright notice and this permission notice shall be included in #
15228753Smm# all copies or substantial portions of the Software.                        #
16228753Smm#                                                                            #
17228753Smm# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
18228753Smm# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
19228753Smm# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
20228753Smm# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
21228753Smm# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
22228753Smm# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
23228753Smm# DEALINGS IN THE SOFTWARE.                                                  #
24228753Smm#                                                                            #
25228753Smm# Except as contained in this notice, the name(s) of the above copyright     #
26228753Smm# holders shall not be used in advertising or otherwise to promote the sale, #
27228753Smm# use or other dealings in this Software without prior written               #
28228753Smm# authorization.                                                             #
29228753Smm##############################################################################
30228753Smm#
31228753Smm# Author: Thomas E. Dickey
32228753Smm#
33228753Smm# The complete configure script for ncurses is the ncurses5-config (or similar
34228753Smm# name, depending on the flavor, e.g., ncursesw5-config, ncurses6-config, etc).
35228753Smm# That provides more information than pkg-config, and is the portable and
36228753Smm# recommended solution.
37228753Smm#
38228753Smm# For each library, generate a ".pc" file which depends on the base ncurses
39228753Smm# library, except that the tinfo library does not depend on ncurses.
40228753SmmLIB_NAME=@LIB_NAME@
41228753SmmTINFO_NAME=@TINFO_NAME@
42228753SmmPANEL_NAME=@PANEL_NAME@
43228753SmmMENU_NAME=@MENU_NAME@
44228753SmmFORM_NAME=@FORM_NAME@
45228753SmmCXX_NAME=@CXX_NAME@
46228753SmmDFT_DEP_SUFFIX=@DFT_DEP_SUFFIX@
47228753SmmTINFO_ARG_SUFFIX=@TINFO_ARG_SUFFIX@
48228753SmmCXX_LIB_SUFFIX=@CXX_LIB_SUFFIX@
49228753Smm
50228753Smmprefix="@prefix@"
51228753Smmexec_prefix="@exec_prefix@"
52228753Smmincludedir="@includedir@@includesubdir@"
53228753Smmlibdir="@libdir@"
54228753Smm
55228753Smmshow_prefix='@prefix@'
56228753Smmshow_exec_prefix='@exec_prefix@'
57228753Smmshow_includedir='@includedir@@includesubdir@'
58228753Smmshow_libdir='@libdir@'
59228753Smm
60228753SmmMAIN_LIBRARY="${LIB_NAME}@DFT_ARG_SUFFIX@"
61228753SmmSUB_LIBRARY="${TINFO_ARG_SUFFIX}"
62228753SmmPANEL_LIBRARY="${PANEL_NAME}@DFT_ARG_SUFFIX@"
63MENU_LIBRARY="${MENU_NAME}@DFT_ARG_SUFFIX@"
64FORM_LIBRARY="${FORM_NAME}@DFT_ARG_SUFFIX@"
65
66if test "$includedir" = "/usr/include" ; then
67	CFLAGS=
68else
69	CFLAGS="-I\${includedir}"
70fi
71
72if test "$libdir" = "/usr/lib" ; then
73	LDFLAGS=
74else
75	LDFLAGS="-L\${libdir}"
76fi
77
78for name in @PC_MODULES_TO_MAKE@
79do
80	name="${name}"
81
82	desc="ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@"
83	reqs=
84
85	if test $name = $MAIN_LIBRARY ; then
86		desc="$desc library"
87	elif test $name = $SUB_LIBRARY ; then
88		desc="$desc terminal interface library"
89	elif expr $name : ".*${CXX_NAME}.*" >/dev/null ; then
90		reqs="$PANEL_LIBRARY, $MENU_LIBRARY, $FORM_LIBRARY, $MAIN_LIBRARY"
91		desc="$desc add-on library"
92	else
93		reqs="$MAIN_LIBRARY"
94		desc="$desc add-on library"
95	fi
96
97	if test $name != $SUB_LIBRARY && test $SUB_LIBRARY != $MAIN_LIBRARY ; then
98		if test $name != $TINFO_NAME ; then
99			test -n "$reqs" && reqs="$reqs, "
100			reqs="${reqs}${SUB_LIBRARY}"
101		fi
102	fi
103
104	echo "** creating ${name}.pc"
105	cat >${name}.pc <<EOF
106prefix=$show_prefix
107exec_prefix=$show_exec_prefix
108libdir=$show_libdir
109includedir=$show_includedir
110major_version=@NCURSES_MAJOR@
111version=@NCURSES_MAJOR@.@NCURSES_MINOR@.@NCURSES_PATCH@
112
113Name: $name
114Description: $desc
115Version: \${version}
116URL: http://invisible-island.net/ncurses
117Requires.private: $reqs
118Libs: $LDFLAGS -l$name
119Libs.private: @LIBS@
120Cflags: $CFLAGS
121EOF
122
123	#pr -f ${name}.pc
124done
125# vile:shmode
126