| 1 |
loki_val |
1.1 |
# Copyright 1999-2008 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
|
# $Header: $ |
| 4 |
|
|
|
| 5 |
|
|
# Author : Peter Johanson <latexer@gentoo.org>, butchered by ikelos, then loki_val. |
| 6 |
|
|
# Based off of original work in gst-plugins.eclass by <foser@gentoo.org> |
| 7 |
|
|
|
| 8 |
|
|
# Note that this breaks compatibility with the original gtk-sharp-component |
| 9 |
|
|
# eclass. |
| 10 |
|
|
|
| 11 |
|
|
inherit eutils mono multilib autotools |
| 12 |
|
|
|
| 13 |
|
|
# Get the name of the component to build and the build dir; by default, |
| 14 |
|
|
# extract it from the ebuild's name. |
| 15 |
|
|
GTK_SHARP_MODULE=${GTK_SHARP_MODULE:=${PN/-sharp/}} |
| 16 |
|
|
GTK_SHARP_MODULE_DIR=${GTK_SHARP_MODULE_DIR:=${PN/-sharp/}} |
| 17 |
|
|
|
| 18 |
|
|
# In some cases the desired module cannot be configured to be built on its own. |
| 19 |
|
|
# This variable allows for the setting of additional configure-deps. |
| 20 |
|
|
GTK_SHARP_MODULE_DEPS="${GTK_SHARP_MODULE_DEPS}" |
| 21 |
|
|
|
| 22 |
|
|
# Allow ebuilds to set a value for the required GtkSharp version; default to |
| 23 |
|
|
# ${PV}. |
| 24 |
|
|
GTK_SHARP_REQUIRED_VERSION=${GTK_SHARP_REQUIRED_VERSION:=${PV%.*}} |
| 25 |
|
|
|
| 26 |
|
|
# Version number used to differentiate between unversioned 1.0 series and the |
| 27 |
|
|
# versioned 2.0 series (2.0 series has 2 or 2.0 appended to various paths and |
| 28 |
|
|
# scripts). Default to ${SLOT}. |
| 29 |
|
|
GTK_SHARP_SLOT="${GTK_SHARP_SLOT:=${SLOT}}" |
| 30 |
|
|
GTK_SHARP_SLOT_DEC="${GTK_SHARP_SLOT_DEC:=-${GTK_SHARP_SLOT}.0}" |
| 31 |
|
|
|
| 32 |
|
|
# Set some defaults. |
| 33 |
|
|
DESCRIPTION="GtkSharp's ${GTK_SHARP_MODULE} module" |
| 34 |
|
|
HOMEPAGE="http://www.mono-project.com/GtkSharp" |
| 35 |
|
|
|
| 36 |
|
|
LICENSE="LGPL-2.1" |
| 37 |
|
|
|
| 38 |
|
|
DEPEND="=dev-dotnet/gtk-sharp-${GTK_SHARP_REQUIRED_VERSION}* |
| 39 |
|
|
>=sys-apps/sed-4" |
| 40 |
|
|
|
| 41 |
|
|
RESTRICT="test" |
| 42 |
|
|
|
| 43 |
|
|
# The GtkSharp modules are currently divided into three seperate tarball |
| 44 |
|
|
# distributions. Figure out which of these our component belongs to. This is |
| 45 |
|
|
# done to avoid passing bogus configure parameters, as well as to return the |
| 46 |
|
|
# correct tarball to download. Note that this makes ${GTK_SHARP_TARBALL_PREFIX} |
| 47 |
|
|
# obsolete. |
| 48 |
|
|
gtk_sharp_module_list="glade" |
| 49 |
|
|
gnome_sharp_module_list="art gnome gnomevfs" |
| 50 |
|
|
gnome_desktop_sharp_module_list="gnome-print gnome-panel gtkhtml gtksourceview nautilusburn rsvg vte wnck" |
| 51 |
|
|
|
| 52 |
|
|
if [[ " ${gtk_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then |
| 53 |
|
|
my_module_list="${gtk_sharp_module_list}" |
| 54 |
|
|
my_tarball="gtk-sharp" |
| 55 |
|
|
elif [[ " ${gnome_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* ]] ; then |
| 56 |
|
|
my_module_list="${gnome_sharp_module_list}" |
| 57 |
|
|
my_tarball="gnome-sharp" |
| 58 |
|
|
|
| 59 |
|
|
# While gnome-desktop-sharp is a part of gnome-desktop-sharp (0_o) it is not a |
| 60 |
|
|
# configurable component, so we don't want to put it into the module list. |
| 61 |
|
|
# Result is that we have to check for it manually here and in src_configure. |
| 62 |
|
|
elif [[ " ${gnome_desktop_sharp_module_list} " == *" ${GTK_SHARP_MODULE} "* || |
| 63 |
|
|
"${GTK_SHARP_MODULE}" == "gnome-desktop" ]] ; then |
| 64 |
|
|
my_module_list="${gnome_desktop_sharp_module_list}" |
| 65 |
|
|
my_tarball="gnome-desktop-sharp" |
| 66 |
|
|
else |
| 67 |
|
|
die "unknown GtkSharp module: ${GTK_SHARP_MODULE}" |
| 68 |
|
|
fi |
| 69 |
|
|
|
| 70 |
|
|
MY_P=${my_tarball}-${PV} |
| 71 |
|
|
S=${WORKDIR}/${MY_P} |
| 72 |
|
|
|
| 73 |
|
|
# Since all interesting versions are hosted on the GNOME server anyway it's the |
| 74 |
|
|
# only one we support, for now. |
| 75 |
|
|
SRC_URI="mirror://gnome/sources/${my_tarball}/${PV%.*}/${MY_P}.tar.bz2 |
| 76 |
|
|
mirror://gentoo/${MY_P}-configurable.diff.gz |
| 77 |
|
|
http://dev.gentoo.org/~ikelos/devoverlay-distfiles/${MY_P}-configurable.diff.gz" |
| 78 |
|
|
|
| 79 |
|
|
|
| 80 |
|
|
### Public functions. |
| 81 |
|
|
|
| 82 |
|
|
gtk-sharp-module_fix_files() { |
| 83 |
|
|
# Change references like "/r:../glib/glib-sharp.dll" -> |
| 84 |
|
|
# "/r:${GTK_SHARP_LIB_DIR}/glib-sharp.dll" and references like |
| 85 |
|
|
# "../glib/glib-sharp.xml" or "$(top_srcdir)/glib/glib-sharp.xml" -> |
| 86 |
|
|
# "${GAPI_DIR}/glib-sharp.xml". |
| 87 |
|
|
# |
| 88 |
|
|
# We also make sure to call the installed gapi-fixup and gapi-codegen and |
| 89 |
|
|
# not the ones that would be built locally. |
| 90 |
|
|
local gapi_dir="${ROOT}/usr/share/gapi${GTK_SHARP_SLOT_DEC}" |
| 91 |
|
|
local gapi_fixup="gapi${GTK_SHARP_SLOT}-fixup" |
| 92 |
|
|
local gapi_codegen="gapi${GTK_SHARP_SLOT}-codegen" |
| 93 |
|
|
|
| 94 |
|
|
# This is very likely to be of use outside of this function as well, so make |
| 95 |
|
|
# it public. |
| 96 |
|
|
GTK_SHARP_LIB_DIR="${ROOT}/usr/$(get_libdir)/mono/gtk-sharp${GTK_SHARP_SLOT_DEC}" |
| 97 |
|
|
|
| 98 |
|
|
local makefiles="$(find ${S} -name Makefile.in)" |
| 99 |
|
|
sed -i -e "s;\(\.\.\|\$(top_srcdir)\)/[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).xml;${gapi_dir}/\2.xml;g" \ |
| 100 |
|
|
-e "s;/r:\(\.\./\)*[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;/r:${GTK_SHARP_LIB_DIR}/\2.dll;g" \ |
| 101 |
|
|
-e "s;\.\./[[:alpha:]]*/\([[:alpha:]]*\(-[[:alpha:]]*\)*\).dll;${GTK_SHARP_LIB_DIR}/\1.dll;g" \ |
| 102 |
|
|
-e "s:\$(SYMBOLS) \$(top_builddir)/parser/gapi-fixup.exe:\$(SYMBOLS):" \ |
| 103 |
|
|
-e "s:\$(INCLUDE_API) \$(top_builddir)/generator/gapi_codegen.exe:\$(INCLUDE_API):" \ |
| 104 |
|
|
-e "s:\$(RUNTIME) \$(top_builddir)/parser/gapi-fixup.exe:${gapi_fixup}:" \ |
| 105 |
|
|
-e "s:\$(RUNTIME) \$(top_builddir)/generator/gapi_codegen.exe:${gapi_codegen}:" \ |
| 106 |
|
|
${makefiles} || die "failed to fix GtkSharp makefiles" |
| 107 |
|
|
|
| 108 |
|
|
# Oh GtkSharp, why do your pkgconfig entries suck donkey ass? Why do |
| 109 |
|
|
# gnome-desktop-sharp modules use ${assemblies_dir} for Libs: instead of |
| 110 |
|
|
# the convention you yourself introduced for gnome-sharp, which just uses |
| 111 |
|
|
# @PACKAGE_VERSION@? Are you just trying to annoy me? |
| 112 |
|
|
local pcins="$(find ${S} -name *.pc.in)" |
| 113 |
|
|
sed -i -e 's:^libdir.*:libdir=@libdir@:' \ |
| 114 |
|
|
-e "s:\${assemblies_dir}:\${libdir}/mono/gtk-sharp${GTK_SHARP_SLOT_DEC}:" \ |
| 115 |
|
|
${pcins} || die "failed to fix GtkSharp pkgconfig entries" |
| 116 |
|
|
} |
| 117 |
|
|
|
| 118 |
|
|
gtk-sharp-module_src_prepare() { |
| 119 |
|
|
# Make selecting components configurable. |
| 120 |
|
|
epatch ${WORKDIR}/${MY_P}-configurable.diff |
| 121 |
|
|
|
| 122 |
|
|
# Fixes support with pkgconfig-0.17, #92503. |
| 123 |
|
|
sed -i -e 's/\<PKG_PATH\>/GTK_SHARP_PKG_PATH/g' \ |
| 124 |
|
|
-e ':^CFLAGS=:d' \ |
| 125 |
|
|
${S}/configure.in |
| 126 |
|
|
|
| 127 |
|
|
# Fix install data hook, #161093. |
| 128 |
|
|
if [ -f "${S}/sample/gconf/Makefile.am" ] |
| 129 |
|
|
then |
| 130 |
|
|
sed -i -e 's/^install-hook/install-data-hook/' \ |
| 131 |
|
|
${S}/sample/gconf/Makefile.am || die |
| 132 |
|
|
fi |
| 133 |
|
|
|
| 134 |
|
|
# Disable building samples, #16015. |
| 135 |
|
|
sed -i -e "s:sample::" ${S}/Makefile.am || die |
| 136 |
|
|
|
| 137 |
|
|
eautoreconf |
| 138 |
|
|
|
| 139 |
|
|
cd ${S}/${GTK_SHARP_MODULE_DIR} |
| 140 |
|
|
|
| 141 |
|
|
gtk-sharp-module_fix_files |
| 142 |
|
|
} |
| 143 |
|
|
|
| 144 |
|
|
gtk-sharp-module_src_configure() { |
| 145 |
|
|
# Disable any module besides one(s) we want. |
| 146 |
|
|
local module gtk_sharp_conf |
| 147 |
|
|
|
| 148 |
|
|
einfo "Configuring to build ${PN} module ..." |
| 149 |
|
|
|
| 150 |
|
|
# No bogus configure parameters please. |
| 151 |
|
|
[[ ${GTK_SHARP_MODULE} == "gnome-desktop" ]] && GTK_SHARP_MODULE= |
| 152 |
|
|
|
| 153 |
|
|
for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do |
| 154 |
|
|
my_module_list=${my_module_list/${module}/} |
| 155 |
|
|
done |
| 156 |
|
|
for module in ${my_module_list} ; do |
| 157 |
|
|
gtk_sharp_conf="${gtk_sharp_conf} --disable-${module} " |
| 158 |
|
|
done |
| 159 |
|
|
for module in ${GTK_SHARP_MODULE} ${GTK_SHARP_MODULE_DEPS} ; do |
| 160 |
|
|
gtk_sharp_conf="${gtk_sharp_conf} --enable-${module} " |
| 161 |
|
|
done |
| 162 |
|
|
|
| 163 |
|
|
cd ${S} |
| 164 |
|
|
econf ${@} ${gtk_sharp_conf} || die "econf failed" |
| 165 |
|
|
} |
| 166 |
|
|
|
| 167 |
|
|
gtk-sharp-module_src_compile() { |
| 168 |
|
|
|
| 169 |
|
|
cd ${S}/${GTK_SHARP_MODULE_DIR} |
| 170 |
|
|
LANG=C emake -j1 || die "emake failed" |
| 171 |
|
|
} |
| 172 |
|
|
|
| 173 |
|
|
gtk-sharp-module_src_install() { |
| 174 |
|
|
cd ${GTK_SHARP_MODULE_DIR} |
| 175 |
|
|
LANG=C emake GACUTIL_FLAGS="/root ${D}/usr/$(get_libdir) /gacdir /usr/$(get_libdir) /package gtk-sharp${GTK_SHARP_SLOT_DEC}" \ |
| 176 |
|
|
DESTDIR=${D} install || die "emake install failed" |
| 177 |
|
|
} |
| 178 |
|
|
|
| 179 |
|
|
EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install |