Skip to content

Commit

Permalink
Merge pull request #166 from Wolf3s/cmake
Browse files Browse the repository at this point in the history
Migrate libtiff, libexpat and libconfig to cmake
  • Loading branch information
fjtrujy authored Sep 3, 2024
2 parents 8a1f688 + e509b2a commit 6935e3b
Show file tree
Hide file tree
Showing 187 changed files with 41 additions and 89,104 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,3 @@
#
*_irx.c
build/
libconfuse/
libtap/
lua/
ps2_drivers/
SIOCookie/
ps2stuff/
ps2gl/
libconfuse/
48 changes: 17 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
LIBS := \
aalib\
cmakelibs\
expat\
libconfig\
libconfuse\
libid3tag\
libjpeg_ps2_addons\
Expand Down Expand Up @@ -60,20 +58,12 @@ cmakelibs: ps2_drivers libtiff
clean-cmakelibs:
rm -rf ./build

expat:
$(MAKE) -C $@
$(MAKE) -C $@ install

libconfig:
$(MAKE) -C $@
$(MAKE) -C $@ install

libconfuse:
./fetch.sh v3.3 https://github.com/libconfuse/libconfuse
cd $@ && ./autogen.sh
cd $@ && CFLAGS_FOR_TARGET="-G0 -O2 -gdwarf-2 -gz" ./configure --host=mips64r5900el-ps2-elf --prefix=${PS2SDK}/ports --disable-shared --disable-examples
$(MAKE) -C $@ all
$(MAKE) -C $@ install
cd build/$@ && ./autogen.sh
cd build/$@ && CFLAGS_FOR_TARGET="-G0 -O2 -gdwarf-2 -gz" ./configure --host=mips64r5900el-ps2-elf --prefix=${PS2SDK}/ports --disable-shared --disable-examples
$(MAKE) -C build/$@ all
$(MAKE) -C build/$@ install

libid3tag: cmakelibs
$(MAKE) -C $@ all
Expand All @@ -89,20 +79,16 @@ libmad: cmakelibs

libtap:
./fetch.sh master https://github.com/ps2dev/libtap
$(MAKE) -C $@ -f Makefile.PS2 all
$(MAKE) -C $@ -f Makefile.PS2 install
$(MAKE) -C build/$@ -f Makefile.PS2 all
$(MAKE) -C build/$@ -f Makefile.PS2 install

clean-libtap:
$(MAKE) -C libtap -f Makefile.PS2 clean

libtiff:
$(MAKE) -C $@ all
$(MAKE) -C $@ install

lua:
./fetch.sh ee-v5.4.6 https://github.com/ps2dev/lua
$(MAKE) -C $@ all platform=PS2
$(MAKE) -C $@ install platform=PS2
$(MAKE) -C build/$@ all platform=PS2
$(MAKE) -C build/$@ install platform=PS2

clean-lua:
$(MAKE) -C lua clean platform=PS2
Expand All @@ -123,21 +109,21 @@ ode:

ps2_drivers:
./fetch.sh 1.6.2 https://github.com/fjtrujy/ps2_drivers
$(MAKE) -C $@ all
$(MAKE) -C $@ install
$(MAKE) -C build/$@ all
$(MAKE) -C build/$@ install

ps2stuff:
./fetch.sh master https://github.com/ps2dev/ps2stuff
$(MAKE) -C $@ install
$(MAKE) -C build/$@ install

ps2gl: ps2stuff
./fetch.sh master https://github.com/ps2dev/ps2gl
$(MAKE) -C $@ install
$(MAKE) -C $@/glut install
$(MAKE) -C build/$@ install
$(MAKE) -C build/$@/glut install

clean-ps2gl:
$(MAKE) -C ps2gl clean
$(MAKE) -C ps2gl/glut clean
$(MAKE) -C build/ps2gl clean
$(MAKE) -C build/ps2gl/glut clean

romfs:
$(MAKE) -C $@
Expand Down Expand Up @@ -165,8 +151,8 @@ sdlttf: sdl cmakelibs

SIOCookie:
./fetch.sh v1.0.4 https://github.com/israpps/SIOCookie
$(MAKE) -C $@ all
$(MAKE) -C $@ install
$(MAKE) -C build/$@ all
$(MAKE) -C build/$@ install

unzip: cmakelibs
$(MAKE) -C $@
Expand Down
33 changes: 23 additions & 10 deletions build-cmakelibs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ function build_irx {
(cd "${PS2SDK}" && ln -sf "../share/ps2dev.cmake" "ps2dev.cmake" && cd -)
(cd "${PS2SDK}" && ln -sf "../share/ps2dev_iop.cmake" "ps2dev_iop.cmake" && cd -)

##
## Create build folder
##
mkdir -p build
cd build

##
## Clone repos
##
Expand Down Expand Up @@ -103,8 +97,11 @@ $FETCH 096d0711ca3e294564a5c6ec18f5bbc3a2aac016 https://github.com/sezero/mikmod
# https://github.com/xiph/theora/pull/14
$FETCH feature/cmake https://github.com/mcmtroffaes/theora.git &

# gsKit requires libtiff
$FETCH v4.6.0 https://gitlab.com/libtiff/libtiff.git &

# SDL requires to have gsKit
$FETCH v1.3.7 https://github.com/ps2dev/gsKit &
$FETCH v1.3.8 https://github.com/ps2dev/gsKit &

# We need to clone the whole repo and point to the specific hash for now,
# till a new version is released after this commit
Expand All @@ -122,21 +119,30 @@ $FETCH fb5597bf3852aeb9aef5ca7305e049bfb4c0bb7f https://github.com/sahlberg/libs
$FETCH 7083138fd401faa391c4f829a86b50fdb9c5c727 https://github.com/lsalzman/enet.git &

# Use wget to download argtable2
wget -c http://prdownloads.sourceforge.net/argtable/argtable2-13.tar.gz &
wget -c --directory-prefix=build http://prdownloads.sourceforge.net/argtable/argtable2-13.tar.gz &
$FETCH v3.2.2.f25c624 https://github.com/argtable/argtable3.git &

$FETCH v1.7.3 https://github.com/hyperrealm/libconfig.git &

$FETCH R_2_6_2 https://github.com/libexpat/libexpat.git &

# wait for fetch jobs to finish
wait

# extract argtable2
tar -xzf argtable2-13.tar.gz
tar -xzf build/argtable2-13.tar.gz -C build

# NOTE: jsoncpp
# "snprintf" not found in "std" namespace error may occur, so patch that out here.
pushd jsoncpp
pushd build/jsoncpp
sed -i -e 's/std::snprintf/snprintf/' include/json/config.h
popd

###
### Change to the build folder
###
cd build

##
## Build cmake projects
##
Expand All @@ -161,6 +167,9 @@ build_ee mikmod/libmikmod -DENABLE_SHARED=0 -DENABLE_DOC=OFF
build_ee jsoncpp -DBUILD_OBJECT_LIBS=OFF -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF
build_ee theora

# libtiff and libtiff_ps2_addons is mandatory for gsKit
CFLAGS="-Dlfind=bsearch" build_ee libtiff -Dtiff-tools=OFF -Dtiff-tests=OFF

# gsKit is mandatory for SDL
build_ee gsKit
build_ee SDL -DCMAKE_POSITION_INDEPENDENT_CODE=OFF -DSDL_TESTS=OFF
Expand All @@ -182,5 +191,9 @@ build_ee libsmb2 -DPS2RPC=1
build_iop libsmb2
build_irx libsmb2 -DBUILD_IRX=1

CFLAGS="-DHAVE_NEWLOCALE -DHAVE_USELOCALE -DHAVE_FREELOCALE" build_ee libconfig -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF

CFLAGS="-Darc4random_buf=random -DHAVE_GETRANDOM" build_ee libexpat/expat -DEXPAT_BUILD_EXAMPLES=OFF -DEXPAT_BUILD_TESTS=OFF -DEXPAT_SHARED_LIBS=OFF -DEXPAT_BUILD_TOOLS=OFF

# Finish
cd ..
22 changes: 0 additions & 22 deletions expat/COPYING

This file was deleted.

134 changes: 0 additions & 134 deletions expat/Changes

This file was deleted.

Loading

0 comments on commit 6935e3b

Please sign in to comment.