Skip to content

Commit

Permalink
games-action/supermariowar: EAPI-7 bump, switch to cmake.eclass
Browse files Browse the repository at this point in the history
Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <[email protected]>
  • Loading branch information
a17r committed Mar 7, 2021
1 parent f2884a9 commit 2847495
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Fix linking with BUILD_SHARED_LIBS=ON default in EAPI-7

--- a/src/common_netplay/CMakeLists.txt
+++ b/src/common_netplay/CMakeLists.txt
@@ -1,4 +1,4 @@

if(NOT NO_NETWORK)
- add_library(NetplayFiles platform_enet/NetPeerENet.cpp)
+ add_library(NetplayFiles STATIC platform_enet/NetPeerENet.cpp)
endif()
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -39,4 +39,4 @@
list(APPEND COMMON_SRCS src/savepng.cpp)
endif()

-add_library(CommonFiles ${COMMON_SRCS})
+add_library(CommonFiles STATIC ${COMMON_SRCS})
88 changes: 42 additions & 46 deletions games-action/supermariowar/supermariowar-2.0_beta1-r1.ebuild
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright 1999-2020 Gentoo Authors
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6
EAPI=7

inherit eutils cmake-utils versionator
inherit cmake

MY_PV=$(replace_version_separator 2 '-')
MY_PV=$(ver_rs 2 '-')
MY_PV="${MY_PV/beta1/beta.1}"
MY_PN="smw"

Expand All @@ -19,91 +19,87 @@ KEYWORDS="amd64 x86"
IUSE="server"

RDEPEND="
sys-libs/zlib:=
dev-cpp/yaml-cpp
net-libs/enet:1.3=
media-libs/sdl-mixer[vorbis]
media-libs/sdl-image[png,jpeg]"

DEPEND="
${RDEPEND}
media-libs/sdl-image[png,jpeg]
net-libs/enet:1.3=
sys-libs/zlib:=
"
DEPEND="${RDEPEND}"
BDEPEND="
app-arch/unzip
virtual/pkgconfig"
virtual/pkgconfig
"

S="${WORKDIR}/${PN}-${MY_PV}"

PATCHES=( "${FILESDIR}"/${P}-cmake-add_library-static.patch )

src_unpack() {
unpack ${A}
cd "${S}" || die
default
pushd "${S}" || die
unpack ./data.zip
}

src_prepare() {
cmake-utils_src_prepare

einfo "Copying Findyaml-cpp.cmake"
cp "${FILESDIR}/${P}-yaml-cpp-config.cmake" cmake/Findyaml-cpp.cmake || die
eend $?
cp "${FILESDIR}"/${P}-yaml-cpp-config.cmake cmake/Findyaml-cpp.cmake || die
popd || die
}

src_configure() {
local mycmakeargs=(
-DBUILD_STATIC_LIBS=OFF
-DSMW_BINDIR="${EPREFIX}/usr/bin"
-DSMW_DATADIR="${EPREFIX}/usr/share/${PF}"
-DSMW_BINDIR="${EPREFIX}"/usr/bin
-DSMW_DATADIR="${EPREFIX}"/usr/share/${PF}
)

cmake-utils_src_configure
cmake_src_configure
}

src_install() {
cmake-utils_src_install
cmake_src_install

local bin
for bin in "${ED}/usr/bin"/*; do
chmod 0755 "${bin}" || die
for bin in "${ED}"/usr/bin/*; do
chmod 0755 ${bin} || die
done

local smw_datadir="usr/share/${PF}"
local smw_bindir="${smw_datadir}/bin"
mkdir -p "${ED}/${smw_bindir}" || die
mkdir -p "${ED}"/${smw_bindir} || die

einfo "Moving ${PN} binary files to /${smw_bindir}"
mv "${ED}/usr/bin"/* "${ED}/${smw_bindir}" || die
ebegin "Moving ${PN} binary files to /${smw_bindir}"
mv "${ED}"/usr/bin/* "${ED}"/${smw_bindir} || die
eend $?

local base_bin
for bin in "${ED}/${smw_bindir}"/*; do
base_bin=$(basename "${bin}")
einfo "Creating ${base_bin} launcher in /usr/bin"
cat << EOF > "${base_bin}" || die
for bin in "${ED}"/${smw_bindir}/*; do
base_bin=$(basename ${bin})
ebegin "Creating ${base_bin} launcher in /usr/bin"
cat << EOF > ${base_bin} || die
#!/usr/bin/env bash
# Copyright 1999-2020 Gentoo Authors
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# ${PF} launcher: ${base_bin}
exec /${smw_bindir}/${base_bin} /${smw_datadir}
EOF
dobin "${base_bin}"
dobin ${base_bin}
eend $?
done

if use server; then
local smw_server="${BUILD_DIR}/Binaries/Release/${MY_PN}-server"
local smw_server="${BUILD_DIR}"/Binaries/Release/${MY_PN}-server
local smw_serverdir="/${smw_datadir}/server"

einfo "Installing ${MY_PN}-server files"
ebegin "Installing ${MY_PN}-server files"
dosbin "${smw_server}"

dodir "${smw_serverdir}"
insinto "${smw_serverdir}"
doins "${S}/src/server/serverconfig"
dodir ${smw_serverdir}
insinto ${smw_serverdir}
doins "${S}"/src/server/serverconfig

dosym "${smw_serverdir}/serverconfig" "/etc/${MY_PN}d.conf"
dosym ${smw_serverdir}/serverconfig /etc/${MY_PN}d.conf

newinitd "${FILESDIR}/smwd.initd" "${MY_PN}d"
sed -i -e \
"s#@SMW_SERVERDIR@#${smw_serverdir}#g;" \
"${ED}/etc/init.d/${MY_PN}d" || die
newinitd "${FILESDIR}"/smwd.initd ${MY_PN}d
sed -e "s#@SMW_SERVERDIR@#${smw_serverdir}#g;" \
-i "${ED}"/etc/init.d/${MY_PN}d || die
eend $?
fi
}

0 comments on commit 2847495

Please sign in to comment.