Date: Mon, 10 Apr 2006 22:53:10 +0200 (CEST) From: Jean-Yves Lefort <jylefort@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/95603: bsd.port.mk: DESKTOP_ENTRIES-related improvements Message-ID: <20060410205310.93FF2C148@jsite.lefort.net> Resent-Message-ID: <200604102100.k3AL0SKG070910@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 95603 >Category: ports >Synopsis: bsd.port.mk: DESKTOP_ENTRIES-related improvements >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Apr 10 21:00:27 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Jean-Yves Lefort >Release: FreeBSD 6.0-RELEASE i386 >Organization: >Environment: System: FreeBSD jsite.lefort.net 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Wed Mar 22 19:35:20 CET 2006 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386 >Description: - Enforce sanity of DESKTOP_ENTRIES - If the Categories field is omitted, try to map ports categories to their freedesktop.org counterpart >How-To-Repeat: >Fix: --- /usr/ports/Mk/bsd.port.mk Thu Feb 23 16:37:20 2006 +++ bsd.port.mk Mon Apr 10 22:40:07 2006 @@ -865,8 +865,14 @@ # variable permits, write it yourself and install it # in ${DESKTOPDIR}. # Notes: -# * Comment and Icon may be empty strings (""). The other -# fields are mandatory. +# * Comment and Icon may be empty strings (""). Categories +# may be an empty string in some cases (see below). The +# other fields are mandatory. +# * If Categories is an empty string, bsd.port.mk will try +# to deduce a default value using the CATEGORIES variable. +# If the deduction fails, you will have to set Categories +# manually. You should check the generated value using +# "make desktop-categories", and override it if necessary. # * Exec will also be used to name the .desktop file. # * The files will be automatically added to ${PLIST}. # Example: @@ -3753,8 +3759,9 @@ # should not be modified. _SANITY_SEQ= pre-everything check-makefile check-categories \ - check-makevars check-depends check-deprecated \ - check-vulnerable buildanyway-message options-message + check-makevars check-desktop-entries check-depends \ + check-deprecated check-vulnerable buildanyway-message \ + options-message _FETCH_DEP= check-sanity _FETCH_SEQ= fetch-depends pre-fetch pre-fetch-script \ do-fetch post-fetch post-fetch-script @@ -5358,6 +5365,150 @@ done .endif +desktop-categories: + @categories=""; \ + for native_category in ${CATEGORIES}; do \ + c=""; \ + case $$native_category in \ + accessibility) c="Accessibility Utility" ;; \ + archivers) c="Archiving" ;; \ + astro) c="Astronomy Science Education" ;; \ + audio) c="Audio AudioVideo" ;; \ + benchmarks) c="System" ;; \ + biology) c="Biology Science Education" ;; \ + cad) c="Engineering" ;; \ + databases) c="Database" ;; \ + deskutils) c="Utility" ;; \ + devel) c="Development" ;; \ + dns) c="Network" ;; \ + elisp) c="Development" ;; \ + emulators) c="Emulator" ;; \ + finance) c="Finance Office" ;; \ + ftp) c="FileTransfer Network" ;; \ + games) c="Game" ;; \ + gnome) c="GNOME GTK" ;; \ + graphics) c="Graphics" ;; \ + hamradio) c="HamRadio" ;; \ + haskell) c="Development" ;; \ + ipv6) c="Network" ;; \ + irc) c="IRCClient Network" ;; \ + java) c="Java Development" ;; \ + kde) c="KDE QT" ;; \ + lang) c="Development" ;; \ + lisp) c="Development" ;; \ + mail) c="Email Office Network" ;; \ + mbone) c="Network AudioVideo" ;; \ + multimedia) c="AudioVideo" ;; \ + net) c="Network" ;; \ + net-im) c="InstantMessaging Network" ;; \ + net-mgmt) c="Network" ;; \ + net-p2p) c="P2P Network" ;; \ + news) c="News" ;; \ + pear) c="WebDevelopment Development" ;; \ + perl5) c="Development" ;; \ + python) c="Development" ;; \ + ruby) c="Development" ;; \ + rubygems) c="Development" ;; \ + scheme) c="Development" ;; \ + science) c="Science Education" ;; \ + security) c="Security System" ;; \ + shells) c="Shell" ;; \ + sysutils) c="System Utility" ;; \ + tcl*|tk*) c="Development" ;; \ + www) c="Network" ;; \ + x11-clocks) c="Clock Utility" ;; \ + x11-fm) c="FileManager" ;; \ + xfce) c="GTK" ;; \ + zope) c="WebDevelopment Development" ;; \ + esac; \ + if [ -n "$$c" ]; then \ + categories="$$categories $$c"; \ + fi; \ + done; \ + if [ -n "$$categories" ]; then \ + for c in Application $$categories; do ${ECHO_MSG} "$$c"; done \ + | ${SORT} -u | ${TR} '\n' ';'; \ + ${ECHO_MSG}; \ + fi + +VALID_DESKTOP_CATEGORIES+= Application Core Development Building Debugger IDE \ + GUIDesigner Profiling RevisionControl Translation Office Calendar \ + ContactManagement Database Dictionary Chart Email Finance FlowChart PDA \ + ProjectManagement Presentation Spreadsheet WordProcessor Graphics \ + 2DGraphics VectorGraphics RasterGraphics 3DGraphics Scanning OCR \ + Photography Viewer Settings DesktopSettings HardwareSettings \ + PackageManager Network Dialup InstantMessaging IRCClient FileTransfer \ + HamRadio News P2P RemoteAccess Telephony WebBrowser WebDevelopment \ + AudioVideo Audio Midi Mixer Sequencer Tuner Video TV AudioVideoEditing \ + Player Recorder DiscBurning Game ActionGame AdventureGame ArcadeGame \ + BoardGame BlocksGame CardGame KidsGame LogicGame RolePlaying Simulation \ + SportsGame StrategyGame Education Art Construction Music Languages \ + Science Astronomy Biology Chemistry Geology Math MedicalSoftware Physics \ + Teaching Amusement Applet Archiving Electronics Emulator Engineering \ + FileManager Shell Screensaver TerminalEmulator TrayIcon System Filesystem \ + Monitor Security Utility Accessibility Calculator Clock TextEditor KDE \ + GNOME GTK Qt Motif Java ConsoleOnly + +check-desktop-entries: +.if defined(DESKTOP_ENTRIES) + @set ${DESKTOP_ENTRIES} XXX; \ + if [ $$((($$# - 1) % 6)) -ne 0 ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: the DESKTOP_ENTRIES list must contain one or more groups of 6 elements"; \ + exit 1; \ + fi; \ + num=1; \ + while [ $$# -gt 6 ]; do \ + entry="#$$num"; \ + if [ -n "$$4" ]; then \ + entry="$$entry ($$4)"; \ + elif [ -n "$$1" ]; then \ + entry="$$entry ($$1)"; \ + fi; \ + if [ -z "$$1" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 1 (Name) is empty"; \ + exit 1; \ + fi; \ + iconext=`${EXPR} "$$3" : '.*\.\(.*\)$$'` || ${TRUE}; \ + if [ -n "$$iconext" ] && [ "x$$iconext" != "xpng" ] && [ "x$$iconext" != "xxpm" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: the specified icon ($$3) is not a .png or .xpm file"; \ + exit 1; \ + fi; \ + if [ -z "$$4" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 4 (Exec) is empty"; \ + exit 1; \ + fi; \ + if [ -n "$$5" ]; then \ + for c in `${ECHO_CMD} "$$5" | ${TR} ';' ' '`; do \ + if ! ${ECHO_CMD} ${VALID_DESKTOP_CATEGORIES} | ${GREP} -wq $$c; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: category $$c is not a valid desktop category"; \ + exit 1; \ + fi; \ + done; \ + if ! ${ECHO_CMD} "$$5" | ${GREP} -q ';$$'; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 5 (Categories) does not end with a semicolon"; \ + exit 1; \ + fi; \ + else \ + if [ -z "`cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} desktop-categories`" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 5 (Categories) is empty and could not be deduced from the CATEGORIES variable"; \ + exit 1; \ + fi; \ + fi; \ + if [ -z "$$6" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 6 (StartupNotify) is empty"; \ + exit 1; \ + fi; \ + if [ "x$$6" != "xtrue" ] && [ "x$$6" != "xfalse" ]; then \ + ${ECHO_CMD} "${PKGNAME}: Makefile error: in desktop entry $$entry: field 6 (StartupNotify) is not \"true\" or \"false\""; \ + exit 1; \ + fi; \ + shift 6; \ + num=$$((num + 1)); \ + done +.else + @${DO_NADA} +.endif + .if !target(install-desktop-entries) install-desktop-entries: .if defined(DESKTOP_ENTRIES) @@ -5370,6 +5521,10 @@ while [ $$# -gt 6 ]; do \ filename="$$4.desktop"; \ pathname="${DESKTOPDIR}/$$filename"; \ + categories="$$5"; \ + if [ -z "$$categories" ]; then \ + categories="`cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} desktop-categories`"; \ + fi; \ ${ECHO_CMD} "${_DESKTOPDIR_REL}$$filename" >> ${TMPPLIST}; \ ${ECHO_CMD} "[Desktop Entry]" > $$pathname; \ ${ECHO_CMD} "Type=Application" >> $$pathname; \ @@ -5383,7 +5538,7 @@ ${ECHO_CMD} "Icon=$$3" >> $$pathname; \ fi; \ ${ECHO_CMD} "Exec=$$4" >> $$pathname; \ - ${ECHO_CMD} "Categories=$$5" >> $$pathname; \ + ${ECHO_CMD} "Categories=$$categories" >> $$pathname; \ ${ECHO_CMD} "StartupNotify=$$6" >> $$pathname; \ shift 6; \ done; \ >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060410205310.93FF2C148>