Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

OPL: Add initial Travis Integration #2

Merged
merged 4 commits into from Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .hgignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
syntax: glob

*.o
*.s
*.elf
Expand All @@ -8,6 +6,9 @@ syntax: glob
*.irx
*.exe
*.map
*.patch
*.diff
*.zip
libfreetype.a

pc/iso2usbld/bin/iso2usbld
161 changes: 161 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
sudo: required
language: c
script:
#
# Travis CI Script by Caio Oliveira aka Caio99BR <caiooliveirafarias0@gmail.com>
# For Open-PS2-Loader

#
# Thanks to:
# - izdubar@psx-scene and jimmikaelkael@psx-scene
# <http://psx-scene.com/forums/f150/%5Blinux%5D-opl-compile-guides-63749/>
# - doctorxyz@ps2home
# <http://ps2home.freeforums.net/thread/272/linux-creation-compiling-guide-ps2sdk>
# - and a lot of people around internet :)

#
# Save current dir, go to previous dir and save it too
- export opl_build_dir=$(pwd)
- cd ../
- export travis_build_dir=$(pwd)

#
# OPL Building Dependencies
- sudo apt-get install -yqq gcc-4.4 patch wget make git mercurial libc6-dev zlib1g zlib1g-dev libucl1 libucl-dev

#
# Set up the environment.
- export PS2DEV=${travis_build_dir}/ps2dev
- export PS2SDK=${PS2DEV}/ps2sdk
- export PATH=${PATH}:${PS2DEV}/bin:${PS2DEV}/ee/bin:${PS2DEV}/iop/bin:${PS2DEV}/dvp/bin:${PS2SDK}/bin
- export PS2ETH=${PS2DEV}/ps2eth
- export GSKIT=${PS2DEV}/gsKit
- export LANG=C
- export LC_ALL=C

#
# ps2dev/PS2Toolchain
- cd ${travis_build_dir}/
- rm -rf ${travis_build_dir}/ps2toolchain/
- git clone --quiet https://github.com/ps2dev/ps2toolchain.git ${travis_build_dir}/ps2toolchain/
- cd ${travis_build_dir}/ps2toolchain/
- ./toolchain.sh

#
# ps2dev/PS2SDKPorts
- cd ${travis_build_dir}/
- rm -rf ${travis_build_dir}/ps2sdk-ports/
- git clone --quiet https://github.com/ps2dev/ps2sdk-ports.git ${travis_build_dir}/ps2sdk-ports/

#
# ps2dev/PS2SDKPorts/zlib
- cd ${travis_build_dir}/ps2sdk-ports/zlib/
- make
- make install

#
# ps2dev/PS2SDKPorts/libpng
- cd ${travis_build_dir}/ps2sdk-ports/libpng/
- make
- make install

#
# ps2dev/PS2SDKPorts/libjpeg
- cd ${travis_build_dir}/ps2sdk-ports/libjpeg/
- make
- make install

#
# ps2dev/PS2SDKPorts/freetype
- cd ${travis_build_dir}/ps2sdk-ports/freetype-2.4.12/
- source SetupPS2.sh

#
# ps2dev/PS2ETH
- cd ${travis_build_dir}/
- rm -rf ${travis_build_dir}/ps2eth/
- git clone --quiet https://github.com/ps2dev/ps2eth ${travis_build_dir}/ps2eth/
- cd ${travis_build_dir}/ps2eth/
- make
- sudo mkdir -p /usr/lib/ps2dev/ps2eth
- sudo tar c $(find . -name \*irx) | sudo tar x -C /usr/lib/ps2dev/ps2eth

#
# ps2dev/gsKit
- cd ${travis_build_dir}/
- rm -rf ${travis_build_dir}/gsKit/
- git clone --quiet https://github.com/ps2dev/gsKit.git ${travis_build_dir}/gsKit/
- cd ${travis_build_dir}/gsKit/
- make
- make install

#
# ps2dev/PS2Packer
- cd ${travis_build_dir}/
- rm -rf ${travis_build_dir}/ps2-packer/
- git clone --quiet https://github.com/ps2dev/ps2-packer.git ${travis_build_dir}/ps2-packer/
- cd ${travis_build_dir}/ps2-packer/
- make
- make install

#
# Let's build Open PS2 Loader!
- cd ${opl_build_dir}/

## Builg Lang Pack and Latest Changelog
- . make_changelog.sh
- . lng_pack.sh

## Export main variables
- export opl_version=$(cat include/opl.h | grep OPL_VERSION | cut -f 3 | tr -d '"' | cut -c -5)
- export opl_revision=$(cat DETAILED_CHANGELOG | head -11 | tail -n 1 | cut -d " " -f 1 | tr -d "rev" | tr -d "commit")
- export opl_extraversion=$(cat include/opl.h | grep OPL_VERSION | cut -f 3 | tr -d '"' | cut -c 7-)
- export opl_git=$(git rev-parse --short=7 HEAD | head -1)
- export opl_version=${opl_version}.${opl_revision}-${opl_extraversion}
- export opl_set="OPNPS2LD-${opl_version}-${opl_git}"

## Build OPL with ALL
- make VMC=1 GSM=1 IGS=1 CHEAT=1 rebuild

## Pack it on zip
- mkdir -p ${opl_build_dir}/out/
- cp ${opl_build_dir}/DETAILED_CHANGELOG ${opl_build_dir}/out/DETAILED_CHANGELOG
- cp ${opl_build_dir}/OPNPS2LD.ELF ${opl_build_dir}/out/${opl_set}.ELF
- cp ${opl_build_dir}/CREDITS ${opl_build_dir}/out/CREDITS
- cp ${opl_build_dir}/LICENSE ${opl_build_dir}/out/LICENSE
- cd ${opl_build_dir}/out/
- zip -r ${opl_set}.zip *
- cd ${opl_build_dir}/

## Prepare to deploy
- mkdir -p ${opl_build_dir}/out_zip/
- cp ${opl_build_dir}/out/${opl_set}.zip ${opl_build_dir}/out_zip/${opl_set}.zip
- cp ${opl_build_dir}/OPNPS2LD_LANGS-r${opl_revision}.zip ${opl_build_dir}/out_zip/OPNPS2LD_LANGS-r${opl_revision}.zip

#
# [TEMPLATE] Deploy OPL to Github Releases
# 1. Clone this repository
# 2. Copy '.travis.yml' to '.travis-original.yml' (you will need it after)
# 3. Install Travis Client <https://github.com/travis-ci/travis.rb#installation>
# 4. Run command: $(travis setup releases)
# 5a. After follow all previous steps,
# pickup ONLY the "secure" line
# and change it on '.travis-original.yml'
# 5b. Remove '#' in and after deploy section
# 6. Move '.travis-original.yml' to '.travis.yml'
# 7. Commit it
#
# NOTE: You need to configure TravisCI before anything <https://travis-ci.org/>

#
# Deploy OPL to Github Releases
#deploy:
# provider: releases
# skip_cleanup: true
# api_key:
# secure: [PUT YOUR NEW SECURE API KEY HERE]
# file:
# - "${opl_build_dir}/out_zip/${opl_set}.zip"
# - "${opl_build_dir}/out_zip/OPNPS2LD_LANGS-r${opl_revision}.zip"
# on:
# tags: true
62 changes: 62 additions & 0 deletions lng_pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
# Lang Packer for Open-PS2-Loader by Caio99BR <caiooliveirafarias0@gmail.com>

# Set variables
_dir=$(pwd)
_bdir="/tmp/opl_lng"
_rev=$(cat ${_dir}/DETAILED_CHANGELOG | head -11 | tail -n 1 | cut -d " " -f 1 | tr -d "rev" | tr -d "commit")

# Print a list
printf "$(ls ${_dir}/lng/ | cut -c 6- | rev | cut -c 5- | rev)" > /tmp/opl_lng_list

# Copy like Jay-Jay format
while IFS= read -r file
do
mkdir -p ${_bdir}/${file}${_rev}/
cp ${_dir}/lng/lang_${file}.lng ${_bdir}/${file}${_rev}/lang_${file}${_rev}.lng
if [ -e thirdparty/font_${file}.ttf ]
then
cp ${_dir}/thirdparty/font_${file}.ttf ${_bdir}/${file}${_rev}/font_${file}.ttf
fi
done < /tmp/opl_lng_list

# Add CREDITS for Translators :)
if [ -e ${_dir}/CREDITS_LNG ]
then
cp ${_dir}/CREDITS_LNG ${_bdir}/CREDITS_LNG
fi

(cat << EOF) > ${_bdir}/README
-----------------------------------------------------------------------------

Copyright 2009-2010, Ifcaro & jimmikaelkael
Licenced under Academic Free License version 3.0
Review Open PS2 Loader README & LICENSE files for further details.

-----------------------------------------------------------------------------

Open PS2 Loader Official Translations (25 August 2016)

HOW TO INSTALL:
1. make sure you are running latest OPL
2. transfer both the the LANGUAGE FILE (.lng) and the FONT FILE (.ttf) into your OPL directory of your memory card
a. IMPORTANT: Do not rename the files
b. NOTE: Some languages don't require a FONT file, so it won't be included
3. run OPL
4. go to OPL Settings
5. open the Display settings page
6. select your new language file
7. press Ok at the bottom of the page
8. then save your settings so next time you run OPL, it will load it with your preferred language file
9. done!
EOF

# Lets pack it!
cd ${_bdir}/
zip -r OPNPS2LD_LANGS-r${_rev}.zip *
cp ${_bdir}/OPNPS2LD_LANGS-r${_rev}.zip ${_dir}/OPNPS2LD_LANGS-r${_rev}.zip

# Cleanup
cd ${_dir}
rm -rf ${_bdir}/ /tmp/opl_lng_list
unset _dir _bdir _rev
65 changes: 65 additions & 0 deletions make_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
# Make Changelog original made by izdubar for Mercurial
# Update for GIT by Caio99BR <caiooliveirafarias0@gmail.com>

(cat << EOF) > /tmp/DETAILED_CHANGELOG
-----------------------------------------------------------------------------

Copyright 2009-2010, Ifcaro & jimmikaelkael
Licenced under Academic Free License version 3.0
Review Open PS2 Loader README & LICENSE files for further details.

-----------------------------------------------------------------------------

Open PS2 Loader detailed ChangeLog:

EOF

while true
do
# Check if it have .git folder
if ! [ -d .git ]
then
echo "No .git folder found, exiting..."
break
fi

# Store author, commit and date on temp file
git log --pretty=format:"%cn - %s - %cd" > /tmp/commit_summary
if ! [ "${?}" == "0" ]
then
echo "Git command failed, exiting..."
break
fi

# Hack for fix first commit not showed
printf '\n' >> /tmp/commit_summary

# Store number of commits
number_commits=$(cat /tmp/commit_summary | wc -l)

# Store each commit in one variable[list]
number_summary=0
while read line_commit_summary
do
number_summary=$((${number_summary} + 1))
commit_summary[${number_summary}]="commit${number_commits} - ${line_commit_summary}"
number_commits=$((${number_commits} - 1))
done < /tmp/commit_summary

printf "Found ${number_summary} commits... "

for ((current=1; current <= ${number_summary}; current++))
do
echo "${commit_summary[${current}]}" >> /tmp/DETAILED_CHANGELOG
done

mv /tmp/DETAILED_CHANGELOG DETAILED_CHANGELOG

rm -fr /tmp/commit_summary

printf "DETAILED_CHANGELOG file created.\n"

# Exit
break
done
50 changes: 0 additions & 50 deletions scripts/make_changelog.sh

This file was deleted.