Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PPSSPP for Fedora 18/19/20 - Build from git
01-08-2014, 12:45 PM (This post was last modified: 01-09-2014 12:30 AM by fastrizwaan.)
Post: #1
PPSSPP for Fedora 18/19/20 - Build from git
here's a script, just run it to make rpm from git for fedora 18/19/20. Make sure rpm-build and rpm build environment is ready.


Download Script file:
https://www.dropbox.com/s/4vvs5yov9bm97g...rom-git.sh

PPSSPP fedora RPMS built using 'mock' - Download:
https://www.dropbox.com/sh/5ja516wkpzxd20u/Wt_x4edP2F

see:
Code:
#Script to generate git snapshot of ppsspp SRPM and RPM for fedora 18/19/20
#(C) GPLv2+ Asif Ali Rizvan <[email protected]>
# This script will generate a new checkout version RPM on every launch

#Required files to Build an rpm:

#Generated by this script:
#1. SOURCE.tar.xz
#2. ppsspp (bash script)
#3. ppsspp.desktop
#4. disable-buildtime-git-version-creation.patch
#5. ppsspp.spec
#6. ppsspp.png (icon) copied from git assets to $SOURCES
#7. include this script into src rpm and binary rpm


#Variables
NAME="ppsspp"
PPSSPP_DIR="ppsspp-git"
SOURCES=$HOME/rpmbuild/SOURCES
SPECS=$HOME/rpmbuild/SPECS
SRPMS=$HOME/rpmbuild/SRPMS
RPMS=$HOME/rpmbuild/RPMS

PPSSPP_GIT_DIR=$SOURCES/$PPSSPP_DIR

#Create directory for git download
mkdir -p $SOURCES $SPECS $RPMS $SRPMS


# include this script file for rpm and srpm inclusion
cp $0 $SOURCES/make-$NAME-from-git.sh

#clone the git repo
cd $SOURCES

#If git sources not there, then clone
if [ ! -d $PPSSPP_GIT_DIR ]; then
   git clone https://github.com/hrydgard/ppsspp.git "$PPSSPP_DIR"
   cd $PPSSPP_GIT_DIR
   git submodule update --init
else
   #else Update git version
   cd $PPSSPP_GIT_DIR
   git reset --hard
   git pull
   git submodule update
fi

#Get version numbers
FULL_VERSION=$(git describe --always)
VERSION=$(echo $FULL_VERSION |cut -f1-2 -d '-'|sed 's/-/_/g')
GITREV=$(echo $FULL_VERSION |cut -f3 -d '-')

#Variables needed after git describe
PPSSPP_NAME_VERSION=$NAME-$VERSION
PPSSPP_GIT_COPY_DIR=$SOURCES/$PPSSPP_NAME_VERSION/

#if already existing version of tar.xz is present
#then skip copying and making a tar, use existing one
if [ ! -f $PPSSPP_NAME_VERSION.tar.xz ]; then
   #make a .git free copy
   cd       $SOURCES
   mkdir -p $PPSSPP_GIT_COPY_DIR/
   cp   -Rf $PPSSPP_GIT_DIR/* $PPSSPP_GIT_COPY_DIR/

   #delete all unneeded folders
   rm -rf $PPSSPP_GIT_COPY_DIR/Windows/           \
          $PPSSPP_GIT_COPY_DIR/redist/            \
          $PPSSPP_GIT_COPY_DIR/ios/               \
          $PPSSPP_GIT_COPY_DIR/Blackberry/        \
          $PPSSPP_GIT_COPY_DIR/dx9sdk/            \
          $PPSSPP_GIT_COPY_DIR/headless/          \

   rm -rf $PPSSPP_GIT_COPY_DIR/ffmpeg/ios*        \
          $PPSSPP_GIT_COPY_DIR/ffmpeg/mac*        \
          $PPSSPP_GIT_COPY_DIR/ffmpeg/symbian*    \
          $PPSSPP_GIT_COPY_DIR/ffmpeg/windows*    \
          $PPSSPP_GIT_COPY_DIR/ffmpeg/blackberry* \
          $PPSSPP_GIT_COPY_DIR/ffmpeg/Windows*

#create file: git-verion.cpp need for build
echo "// This is a generated file.

const char *PPSSPP_GIT_VERSION = \"$FULL_VERSION\";

// If you don't want this file to update/recompile, change to 1.
#define PPSSPP_GIT_VERSION_NO_UPDATE 1" > $PPSSPP_GIT_COPY_DIR/git-version.cpp

   #make source tar.xz file
   cd $SOURCES
   tar -Jcf  $PPSSPP_NAME_VERSION.tar.xz  $PPSSPP_NAME_VERSION/

fi #endif

#remove the copy directory after archiving
rm -rf $PPSSPP_GIT_COPY_DIR

#Copy the icon
cp $PPSSPP_GIT_DIR/assets/icon-114.png $SOURCES/$NAME.png


#create bash script to launch ppsspp from /usr/share/ppsspp directory
echo '
#/bin/bash

cd /usr/share/ppsspp/
/usr/share/ppsspp/PPSSPPSDL "$@" --fullscreen
' > $SOURCES/$NAME

#create desktop file
echo "[Desktop Entry]
Name=$NAME
Exec=$NAME
Icon=$NAME
Type=Application
Comment=PSP Emulator
StartupNotify=true
" > $SOURCES/$NAME.desktop


#make patch: will work as long as CMakeLists.txt is not changed upstream
echo '*** old/CMakeLists.txt    2014-01-08 14:10:40.035843263 +0530
--- new/CMakeLists.txt    2014-01-08 14:11:30.987970363 +0530
*************** setup_target_project(${CoreLibName} Core
*** 1169,1175 ****
  
  # Generate git-version.cpp at build time.
  add_custom_target(GitVersion ALL
!     DEPENDS something_that_never_exists)
  add_custom_command(OUTPUT something_that_never_exists
      COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
          -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
--- 1169,1175 ----
  
  # Generate git-version.cpp at build time.
  add_custom_target(GitVersion ALL
! ) #    DEPENDS something_that_never_exists)
  add_custom_command(OUTPUT something_that_never_exists
      COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
          -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)' > $SOURCES/disable-buildtime-git-version-creation.patch

# Create SPEC file for the latest git snapshot
echo "
%global gitrev $GITREV
%global chkoutversion $FULL_VERSION
Name:          ppsspp
License:       GPLv2
Summary:       Playstation Portable Emulator
Url:           ppsspp.org
Version:       $VERSION
Release:       1.git%{gitrev}%{?dist}
Group:         Applications/Games
AutoReqProv:   yes

Source0: %{name}-%{version}.tar.xz
# git clone git clone https://github.com/hrydgard/ppsspp.git  %{name}-%{version}
# cd  ppsspp-%{version}
# git submodule update --init
# git checkout %{chkoutversion}
# git submodule update
# cd  ..
# tar -Jcf ppsspp-%{version}.tar.xz ppsspp-%{version}/

Source1: ppsspp
Source2: ppsspp.desktop
Source3: ppsspp.png
Source4: make-%{name}-from-git.sh

Patch0:  disable-buildtime-git-version-creation.patch

Requires: SDL

BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: SDL-devel
BuildRequires: cmake
BuildRequires: zlib-devel
BuildRequires: glibc-devel
BuildRequires: libICE-devel
BuildRequires: libpng-devel
BuildRequires: libX11-devel
BuildRequires: libXext-devel
BuildRequires: libSM-devel
BuildRequires: alsa-lib-devel
BuildRequires: mesa-libEGL-devel
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel

Buildroot:     %{_builddir}

%description
PPSSPP is a Playstation PSP emulator.

%prep
rm -rf            %{_builddir}/%{name}-%{version}

%setup

%patch0 -p1

%build

#  build in the same src directory
   cd     %{_builddir}/%{name}-%{version}
   cmake .
   make   %{?_smp_mflags}

%install

   mkdir -p %{buildroot}/usr/bin
   mkdir -p %{buildroot}/usr/share/applications
   mkdir -p %{buildroot}/usr/share/pixmaps
   mkdir -p %{buildroot}/usr/share/ppsspp
   mkdir -p %{buildroot}/usr/share/ppsspp/assets

   install -m 755 -D %{SOURCE1}   %{buildroot}/usr/bin
   install -m 444 -D %{SOURCE2}   %{buildroot}/usr/share/applications
   install -m 444 -D %{SOURCE3}   %{buildroot}/usr/share/pixmaps
   install -m 755 -D %{SOURCE4}   %{buildroot}/usr/share/ppsspp/
   install -m 755 -D %{_builddir}/%{name}-%{version}/PPSSPPSDL \
                     %{buildroot}/usr/share/ppsspp/
  
   cp -r %{_builddir}/%{name}-%{version}/assets/* \
         %{buildroot}/usr/share/ppsspp/assets/

%clean
   %{?buildroot:%__rm -rf %{buildroot}}

%files
%attr(755,root,root)
    %{_bindir}/ppsspp
    %{_datadir}/pixmaps/ppsspp.png
%attr(644,root,root)
    %{_datadir}/applications/ppsspp.desktop
    %{_datadir}/ppsspp/



%changelog
* Wed Jan 8 2014 Asif Ali Rizvan <[email protected]>
- PPSSPPSDL only package, better sound and Qt free
- run in fullscreen
* Tue Dec 17 2013 Asif ali Rizvan <[email protected]>
- includes .git free sources only 28M instead of 218M :D

" > $SPECS/ppsspp.spec


#build rpm
cd $SPECS
#sudo yum-builddep ppsspp.spec ;#uncomment to install dependencies
rpmbuild -ba ppsspp.spec
sudo rpm -Uvh $RPMS/$(arch)/$PPSSPP_NAME_VERSION*.rpm --force
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: