Convert bsd.sdl.mk to Uses/sdl.mk

Frow now on, USES=sdl should be used to specify dependency on SDL
libraries.
USE_SDL is still required to specify components, specifying it
without USES=sdl is still supported, but deprecated, and leads to
a warning. USE_SDL=yes support was removed, and now leads to error,
USE_SDL=sdl should be used instead (all ports which still used
USE_SDL=yes were fixed). sdl.mk was simplified and modernized along
the way.

PR:		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235561
Approved by:	portmgr (mat)
Exp-run by:	antoine
Differential Revision:	https://reviews.freebsd.org/D19075
This commit is contained in:
Dmitry Marakasov 2019-02-11 15:21:25 +00:00
parent 16b9cef21a
commit 14223135a0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=492696
4 changed files with 121 additions and 195 deletions

112
Mk/Uses/sdl.mk Normal file
View File

@ -0,0 +1,112 @@
# $FreeBSD$
#
# Support for SDL-based ports
#
# Feature: sdl
# Usage: USES=sdl
# USE_SDL=sdl console gfx image mixer mm net pango sound ttf
# sdl2 gfx2 image2 mixer2 net2 ttf2
#
# USE_SDL specifies which SDL components to add as dependencies.
# Not specifying USE_SDL with USES=sdl is an error.
# USE_SDL=yes implies USE_SDL=sdl. This is deprecated
#
# MAINTAINER: amdmi3@FreeBSD.org
.if !defined(_INCLUDE_USES_SDL_MK)
_INCLUDE_USES_SDL_MK= yes
# These are the current supported SDL1.2 modules
_SDL_USE_ALL= sdl console gfx image mixer mm net pango sound ttf
_SDL_sdl_LIB_DEPENDS= libSDL.so:devel/sdl12
_SDL_console_LIB_DEPENDS= libSDL_console.so:devel/sdl_console
_SDL_console_REQUIRES= sdl
_SDL_gfx_LIB_DEPENDS= libSDL_gfx.so:graphics/sdl_gfx
_SDL_gfx_REQUIRES= sdl
_SDL_image_LIB_DEPENDS= libSDL_image.so:graphics/sdl_image
_SDL_image_REQUIRES= sdl
_SDL_mixer_LIB_DEPENDS= libSDL_mixer.so:audio/sdl_mixer
_SDL_mixer_REQUIRES= sdl
_SDL_mm_LIB_DEPENDS= libSDLmm.so:devel/sdlmm
_SDL_mm_REQUIRES= sdl
_SDL_net_LIB_DEPENDS= libSDL_net.so:net/sdl_net
_SDL_net_REQUIRES= sdl
_SDL_pango_LIB_DEPENDS= libSDL_Pango.so:x11-toolkits/sdl_pango
_SDL_pango_REQUIRES= sdl
_SDL_sound_LIB_DEPENDS= libSDL_sound.so:audio/sdl_sound
_SDL_sound_REQUIRES= sdl
_SDL_ttf_LIB_DEPENDS= libSDL_ttf.so:graphics/sdl_ttf
_SDL_ttf_REQUIRES= sdl
# These are the current supported SDL2 modules
_SDL_USE_ALL+= sdl2 gfx2 image2 mixer2 net2 ttf2
_SDL_sdl2_LIB_DEPENDS= libSDL2.so:devel/sdl20
_SDL_gfx2_LIB_DEPENDS= libSDL2_gfx.so:graphics/sdl2_gfx
_SDL_gfx2_REQUIRES= sdl2
_SDL_image2_LIB_DEPENDS= libSDL2_image.so:graphics/sdl2_image
_SDL_image2_REQUIRES= sdl2
_SDL_mixer2_LIB_DEPENDS= libSDL2_mixer.so:audio/sdl2_mixer
_SDL_mixer2_REQUIRES= sdl2
_SDL_net2_LIB_DEPENDS= libSDL2_net.so:net/sdl2_net
_SDL_net2_REQUIRES= sdl2
_SDL_ttf2_LIB_DEPENDS= libSDL2_ttf.so:graphics/sdl2_ttf
_SDL_ttf2_REQUIRES= sdl2
# Basic checks
.if !empty(sdl_ARGS)
IGNORE= USES=sdl takes no arguments
.endif
.if !defined(USE_SDL)
IGNORE= need to specify sdl component(s) with USE_SDL
.endif
# Expand implied dependencies on main SDL/SDL2 ports
_USE_SDL=
.for _component in ${USE_SDL}
. if !${_SDL_USE_ALL:M${_component}}
IGNORE= uses unknown SDL component ${_component}
. else
_USE_SDL+= ${_component} ${_SDL_${_component}_REQUIRES}
. endif
.endfor
# Provide LIB_DEPENDS
.for _component in ${_USE_SDL:O:u}
LIB_DEPENDS+= ${_SDL_${_component}_LIB_DEPENDS}
.endfor
# Provide dependency on main SDL ports
.if ${_USE_SDL:Msdl}
SDL_CONFIG?= ${LOCALBASE}/bin/sdl-config
BUILD_DEPENDS+= ${SDL_CONFIG}:devel/sdl12
CONFIGURE_ENV+= SDL_CONFIG=${SDL_CONFIG}
MAKE_ENV+= SDL_CONFIG=${SDL_CONFIG}
.endif
.if ${_USE_SDL:Msdl2}
SDL2_CONFIG?= ${LOCALBASE}/bin/sdl2-config
BUILD_DEPENDS+= ${SDL2_CONFIG}:devel/sdl20
CONFIGURE_ENV+= SDL2_CONFIG=${SDL2_CONFIG}
MAKE_ENV+= SDL2_CONFIG=${SDL2_CONFIG}
.endif
# _INCLUDE_USES_SDL_MK
.endif

View File

@ -364,8 +364,6 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org
# Append the cxxflags to CXXFLAGS only on the specified architecture
##
# LDFLAGS_${ARCH} Append the ldflags to LDFLAGS only on the specified architecture
# USE_SDL - If set, this port uses the sdl libraries.
# See bsd.sdl.mk for more information.
##
# USE_OPENLDAP - If set, this port uses the OpenLDAP libraries.
# Implies: WANT_OPENLDAP_VER?=24
@ -1425,6 +1423,11 @@ DEV_WARNING+= "Using USE_GL alone is deprecated, please add USES=gl."
USES+= gl
.endif
.if defined(USE_SDL) && (!defined(USES) || !${USES:Msdl})
DEV_WARNING+= "Using USE_SDL alone is deprecated, please add USES=sdl."
USES+= sdl
.endif
.if defined(USE_MYSQL)
USE_MYSQL:= ${USE_MYSQL:N[yY][eE][sS]:Nclient}
.if defined(WANT_MYSQL_VER)
@ -1445,10 +1448,6 @@ USES+=mysql:${USE_MYSQL}
.include "${PORTSDIR}/Mk/bsd.gstreamer.mk"
.endif
.if defined(USE_SDL)
.include "${PORTSDIR}/Mk/bsd.sdl.mk"
.endif
.if !defined(UID)
UID!= ${ID} -u
.endif
@ -1944,10 +1943,6 @@ _FORCE_POST_PATTERNS= rmdir kldxref mkfontscale mkfontdir fc-cache \
.include "${PORTSDIR}/Mk/bsd.ocaml.mk"
.endif
.if defined(USE_SDL)
.include "${PORTSDIR}/Mk/bsd.sdl.mk"
.endif
.if defined(USE_PHP) && (!defined(USES) || ( defined(USES) && !${USES:Mphp*} ))
DEV_WARNING+= "Using USE_PHP alone is deprecated, please use USES=php"
_USES_POST+= php

View File

@ -86,6 +86,10 @@ DEV_ERROR+= "USE_GNOME=pkgconfig is unsupported, please use USES=pkgconfig"
DEV_ERROR+= "USE_ZOPE=yes is unsupported, please use USES=zope instead"
.endif
.if defined(USE_SDL) && ${USE_SDL} == yes
DEV_ERROR+= "USE_SDL=yes is unsupported, please use USE_SDL=sdl instead"
.endif
.if defined(USE_GITHUB) && defined(GH_COMMIT)
DEV_ERROR+= "GH_COMMIT is unsupported, please convert GHL-\>GH in MASTER_SITES and set GH_TAGNAME to tag or commit hash and remove GH_COMMIT"
.endif

View File

@ -1,185 +0,0 @@
#-*- tab-width: 4; -*-
# ex:ts=4
#
# bsd.sdl.mk - Support for SDL-based ports.
#
# Created by: Edwin Groothuis <edwin@freebsd.org>
#
# For FreeBSD committers:
# - Changes in the version number of the shared libraries are encouraged.
# - For the rest, please try to run them via the maintainer but feel free
# to commit themselves if nothing breaks.
#
# For ports-developers:
# If your port needs SDL or one of the SDL modules, you can easily
# include them with the "USE_SDL=" statement. For example if you need
# the standard SDL and SDL_sound, use "USE_SDL=sdl sound" and the
# required libraries are included in your LIB_DEPENDS.
#
#
# $FreeBSD$
#
SDL_Include_MAINTAINER= ports@FreeBSD.org
#
# These are the current supported SDL1.2 modules
#
_USE_SDL_ALL= console gfx image mixer mm net pango sdl sound ttf
#
# These are the current supported SDL2 modules
#
_USE_SDL_ALL+= gfx2 image2 mixer2 net2 sdl2 ttf2
#
# Variables used to determine what is needed:
# _SUBDIR_xxx subdirectory below ${PORTSDIR} (required)
# _PORTDIR_xxx subdirectory below ${PORTSDIR}/${_SUBDIR_xxx}
# _LIB_xxx name of the shared lib
# _REQUIRES_xxx also needs these SDL libraries
#
_SUBDIR_console= devel
_PORTDIR_console= sdl_console
_LIB_console= libSDL_console.so
_REQUIRES_console= sdl
_SUBDIR_gfx= graphics
_PORTDIR_gfx= sdl_gfx
_LIB_gfx= libSDL_gfx.so
_REQUIRES_gfx= sdl
_SUBDIR_image= graphics
_PORTDIR_image= sdl_image
_LIB_image= libSDL_image.so
_REQUIRES_image=sdl
_SUBDIR_mixer= audio
_PORTDIR_mixer= sdl_mixer
_LIB_mixer= libSDL_mixer.so
_REQUIRES_mixer=sdl
_SUBDIR_mm= devel
_PORTDIR_mm= sdlmm
_LIB_mm= libSDLmm.so
_REQUIRES_mm= sdl
_SUBDIR_net= net
_PORTDIR_net= sdl_net
_LIB_net= libSDL_net.so
_REQUIRES_net= sdl
_SUBDIR_pango= x11-toolkits
_PORTDIR_pango= sdl_pango
_LIB_pango= libSDL_Pango.so
_REQUIRES_pango=sdl
_SUBDIR_sdl= devel
_PORTDIR_sdl= sdl12
_LIB_sdl= libSDL.so
_REQUIRES_sdl=
_SUBDIR_sound= audio
_PORTDIR_sound= sdl_sound
_LIB_sound= libSDL_sound.so
_REQUIRES_sound=sdl
_SUBDIR_ttf= graphics
_PORTDIR_ttf= sdl_ttf
_LIB_ttf= libSDL_ttf.so
_REQUIRES_ttf= sdl
_SUBDIR_gfx2= graphics
_PORTDIR_gfx2= sdl2_gfx
_LIB_gfx2= libSDL2_gfx.so
_REQUIRES_gfx2= sdl2
_SUBDIR_image2= graphics
_PORTDIR_image2= sdl2_image
_LIB_image2= libSDL2_image.so
_REQUIRES_image2= sdl2
_SUBDIR_mixer2= audio
_PORTDIR_mixer2= sdl2_mixer
_LIB_mixer2= libSDL2_mixer.so
_REQUIRES_mixer2= sdl2
_SUBDIR_net2= net
_PORTDIR_net2= sdl2_net
_LIB_net2= libSDL2_net.so
_REQUIRES_net2= sdl2
_SUBDIR_sdl2= devel
_PORTDIR_sdl2= sdl20
_LIB_sdl2= libSDL2.so
_REQUIRES_sdl2=
_SUBDIR_ttf2= graphics
_PORTDIR_ttf2= sdl2_ttf
_LIB_ttf2= libSDL2_ttf.so
_REQUIRES_ttf2= sdl2
#
# If USE_SDL is defined, make dependencies for the libraries
#
.if !defined(BEFOREPORTMK)
.if !defined(SDL_Include_post)
.if defined(USE_SDL)
SDL_Include_post= bsd.sdl.mk
#
# Keep some backward compatibility
#
.if ${USE_SDL}=="yes"
USE_SDL= sdl
.endif
#
# Check if all the values given in USE_SDL are valid.
#
_USE_SDL=
.for component in ${USE_SDL}
. if ${_USE_SDL_ALL:M${component}}==""
IGNORE= cannot install: unknown SDL component ${component}
. endif
_USE_SDL+= ${_REQUIRES_${component}} ${component}
.endfor
#
# Uniquefy[sp] the list of libs required
#
__USE_SDL=
.for component in ${_USE_SDL}
. if ${__USE_SDL:M${component}}==""
__USE_SDL+= ${component}
. endif
.endfor
#
# Finally make the list of libs required
#
.for component in ${__USE_SDL}
LIB_DEPENDS+= ${_LIB_${component}}:${_SUBDIR_${component}}/${_PORTDIR_${component}}
.endfor
#
# "Normal" dependencies and variables
#
.if ${__USE_SDL:Msdl} != ""
BUILD_DEPENDS+= ${SDL_CONFIG}:${_SUBDIR_sdl}/${_PORTDIR_sdl}
SDL_CONFIG?= ${LOCALBASE}/bin/sdl-config
CONFIGURE_ENV+= SDL_CONFIG=${SDL_CONFIG}
MAKE_ENV+= SDL_CONFIG=${SDL_CONFIG}
.endif
.if ${__USE_SDL:Msdl2} != ""
BUILD_DEPENDS+= ${SDL2_CONFIG}:${_SUBDIR_sdl2}/${_PORTDIR_sdl2}
SDL2_CONFIG?= ${LOCALBASE}/bin/sdl2-config
CONFIGURE_ENV+= SDL2_CONFIG=${SDL2_CONFIG}
MAKE_ENV+= SDL2_CONFIG=${SDL2_CONFIG}
.endif
.endif
.endif
.endif