Tweak astro/celestia version 1.6.1_13
[dports.git] / astro / celestia / Makefile
1 # Created by: trevor
2
3 PORTNAME=       celestia
4 PORTVERSION=    1.6.1
5 PORTREVISION=   13
6 CATEGORIES=     astro
7 MASTER_SITES=   SF/${PORTNAME}/Celestia-source/${PORTVERSION}
8 PKGNAMESUFFIX=  -${CELESTIA_UI}
9
10 MAINTAINER=     danfe@FreeBSD.org
11 COMMENT=        Scriptable space flight simulator for X11
12
13 LICENSE=        GPLv2
14
15 LIB_DEPENDS=    libpng.so:graphics/png
16
17 USES=           compiler:c++11-lang gettext gl gmake jpeg libtool lua:52 pkgconfig
18 USE_GL=         gl
19 GNU_CONFIGURE=  yes
20 EXTRA_PATCHES=  ${FILESDIR}/celestia-1.6.1-lua-5.2.patch:-p1 \
21                 ${FILESDIR}/celestia-lua-52-fix.patch:-p1 \
22                 ${FILESDIR}/celestia-1.6.1-gcc47.patch:-p1 \
23                 ${FILESDIR}/celestia-1.6.1-gcc48.patch:-p1
24
25 CXXFLAGS+=      -fsigned-char   # fix text rendering (see Gentoo bug 316573)
26 CPPFLAGS+=      -I${LOCALBASE}/include
27 LDFLAGS+=       -L${LOCALBASE}/lib -pthread
28
29 UI_LIST=        glut gtk gnome
30 CELESTIA_UI?=   glut
31 CONFLICTS=      ${UI_LIST:S|${CELESTIA_UI}||:S|^|celestia-|:S|$|-[0-9]*|}
32
33 # Celestia provides different UI frontends; you should pick one that suits
34 # you best by setting CELESTIA_UI variable.  Possible values are:
35 #
36 # glut  Bare-boned minimal GLUT-based core with no toolbar or menu (this is
37 #       the default one);
38 # gtk   Full interface with minimal dependencies: adds menu, configuration
39 #       dialog, some other utilities;
40 #
41 .if ${CELESTIA_UI} == "glut"
42 CONFIGURE_ARGS+=        --with-glut
43 USE_GL+=        glut
44 LDFLAGS+=       -lGL
45 .elif ${CELESTIA_UI} == "gtk"
46 CONFIGURE_ARGS+=        --with-gtk
47 USES+=          gnome
48 USE_GNOME+=     gtk20
49 PLIST_FILES=    share/applications/celestia.desktop
50 .else
51 IGNORE=         requires one of the <${UI_LIST}> values for CELESTIA_UI
52 .endif
53
54 .if ${CELESTIA_UI} == "gtk"
55 USES+=          pathfix
56 LIB_DEPENDS+=   libgtkglext-x11-1.0.so:x11-toolkits/gtkglext \
57                 libtheora.so:multimedia/libtheora
58 STARTUP_NOTIFY= true
59 PLIST_FILES+=   share/celestia/celestia-logo.png share/celestia/celestiaui.xml
60 .else
61 STARTUP_NOTIFY= false
62 .endif
63
64 PORTDOCS=       AUTHORS ChangeLog README
65
66 OPTIONS_DEFINE= DOCS
67
68 post-patch:
69         @${REINPLACE_CMD} -E '/fav(->|\.)fov/s|NULL|0.0|' \
70                 ${WRKSRC}/src/celestia/celestiacore.cpp \
71                 ${WRKSRC}/src/celestia/favorites.cpp
72         @${REINPLACE_CMD} -e '280s,NULL,false,' \
73                 ${WRKSRC}/src/celengine/parseobject.cpp
74 # Fix Lua discovery pkg-config(1) calls
75         @${REINPLACE_CMD} -E 's|lua5\.?|lua-5.|' ${WRKSRC}/configure
76 # Remove controversial compiler options (respect our C[XX]FLAGS)
77 .for o in O2 ffast-math fexpensive-optimizations fomit-frame-pointer
78         @${REINPLACE_CMD} -e 's|-${o}||g' ${WRKSRC}/configure
79 .endfor
80 # Allow add-ons to be placed inside user's home directory
81         @${REINPLACE_CMD} -e '/^#/!s|"extras"|& "~/.celestia"|' \
82                 ${WRKSRC}/celestia.cfg
83 # Inhibit installation of copies of GPL (lots of them; use LICENSE framework
84 # instead) and remove bogus argument from mv(1)
85         @${REINPLACE_CMD} -e 's|COPYING||g ; s| -b|| ' ${WRKSRC}/Makefile.in
86         @${REINPLACE_CMD} -e 's|=.*COPYING_\*)|=| ; \
87                 /KDE_DIST/s|COPYING_[^ ]* ||g' ${WRKSRC}/locale/Makefile.in
88         @${REINPLACE_CMD} -e 's|kde_libs_htmldir|kde_htmldir|' \
89                 ${WRKSRC}/src/celestia/kde/doc/celestia/Makefile.in
90
91 post-install:
92 # Technically, we should only install icon explicitly for GLUT UI, since
93 # correct icons are properly installed for other cases, but doing it here
94 # does not hurt and simplifies PLIST handling
95         ${INSTALL_DATA} ${WRKSRC}/src/celestia/gtk/data/celestia.png \
96                 ${STAGEDIR}${PREFIX}/share/pixmaps
97         @${MKDIR} ${STAGEDIR}${DOCSDIR}
98         ${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
99
100 .include <bsd.port.mk>