From: notaz Date: Mon, 30 Apr 2012 21:39:05 +0000 (+0300) Subject: automatically build plugins X-Git-Tag: r15~45 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd4d5a35678c8ff7f9a7c0ac42be354671534f96;p=pcsx_rearmed.git automatically build plugins --- diff --git a/Makefile b/Makefile index aa97b12c..527ddd92 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ endif #DRC_DBG = 1 #PCNT = 1 -all: config.mak $(TARGET) +all: config.mak $(TARGET) plugins_ ifneq ($(wildcard config.mak),) config.mak: ./configure @@ -118,14 +118,14 @@ OBJS += maemo/hildon.o maemo/main.o maemo/%.o: maemo/%.c else OBJS += frontend/menu.o frontend/linux/in_evdev.o -OBJS += frontend/common/input.o frontend/linux/xenv.o +OBJS += frontend/common/input.o ifeq "$(PLATFORM)" "generic" OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o endif ifeq "$(PLATFORM)" "pandora" OBJS += frontend/linux/fbdev.o -OBJS += frontend/plat_omap.o +OBJS += frontend/plat_omap.o frontend/linux/xenv.o OBJS += frontend/plat_pandora.o endif ifeq "$(PLATFORM)" "caanoo" @@ -163,30 +163,44 @@ frontend/revision.h: FORCE $(TARGET): $(OBJS) $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map -clean: $(PLAT_CLEAN) +clean: $(PLAT_CLEAN) clean_plugins $(RM) $(TARGET) $(OBJS) $(TARGET).map ifneq ($(PLUGINS),) +plugins_: $(PLUGINS) + $(PLUGINS): - make -C plugins/gpulib/ clean make -C $(dir $@) clean_plugins: make -C plugins/gpulib/ clean for dir in $(PLUGINS) ; do \ $(MAKE) -C $$(dirname $$dir) clean; done +else +plugins_: +clean_plugins: endif # ----------- release ----------- VER ?= $(shell git describe master) +ifeq "$(PLATFORM)" "generic" +OUT = pcsx_rearmed_$(VER) + +rel: pcsx $(PLUGINS) \ + frontend/pandora/skin readme.txt COPYING + rm -rf $(OUT) + mkdir -p $(OUT)/plugins + mkdir -p $(OUT)/bios + cp -r $^ $(OUT)/ + mv $(OUT)/*.so* $(OUT)/plugins/ + zip -9 -r $(OUT).zip $(OUT) +endif + ifeq "$(PLATFORM)" "pandora" PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh -PLUGINS ?= plugins/spunull/spunull.so plugins/gpu-gles/gpu_gles.so \ - plugins/gpu_unai/gpu_unai.so plugins/dfxvideo/gpu_peops.so - rel: pcsx $(PLUGINS) \ frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \ frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING @@ -208,9 +222,6 @@ PLAT_CLEAN = caanoo_clean caanoo_clean: $(RM) frontend/320240/pollux_set -PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpu_unai.so \ - plugins/gpu-gles/gpu_gles.so - rel: pcsx $(PLUGINS) \ frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \ frontend/320240/pcsxb.png frontend/320240/skin \ diff --git a/configure b/configure index 7cfd626a..4aed26ae 100755 --- a/configure +++ b/configure @@ -28,6 +28,8 @@ platform_list="generic pandora maemo caanoo" platform="generic" sound_driver_list="oss alsa none" sound_driver="alsa" +plugins="plugins/spunull/spunull.so \ +plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so" ram_fixed="no" drc_cache_base="no" have_armv6="" @@ -219,6 +221,25 @@ EOF fi fi +# check for GLES headers +cat > $TMPC < +#include +#include +void *test(void) { + return eglGetDisplay( (EGLNativeDisplayType)0 ); +} +EOF +if compile_object; then + plugins="$plugins plugins/gpu-gles/gpu_gles.so" +fi + +# short plugin list for display +for p in $plugins; do + p1=`basename $p` + plugins_short="$p1 $plugins_short" +done + # set things that failed to autodetect to "no" test "x$have_armv6" != "x" || have_armv6="no" test "x$have_armv7" != "x" || have_armv7="no" @@ -227,6 +248,7 @@ test "x$have_arm_neon" != "x" || have_arm_neon="no" echo "architecture $ARCH" echo "platform $platform" echo "sound driver $sound_driver" +echo "plugins $plugins_short" echo "C compiler $CC" echo "C compiler flags $CFLAGS" echo "linker flags $LDFLAGS" @@ -263,6 +285,15 @@ none) echo "USE_NO_SOUND = 1" >> $config_mak ;; esac +if [ "$ARCH" = "arm" ]; then + echo "PLUGINS = $plugins" >> $config_mak +else + echo -n "PLUGINS =" >> $config_mak + for p in $plugins; do + echo -n " ${p}.${ARCH}" >> $config_mak + done + echo >> $config_mak +fi if [ "$have_armv6" = "yes" ]; then echo "HAVE_ARMV6 = 1" >> $config_mak fi diff --git a/frontend/main.c b/frontend/main.c index 4ebcf345..8df90365 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -131,7 +131,7 @@ static void set_default_paths(void) strcpy(Config.Pad2, "builtin_pad"); strcpy(Config.Net, "Disabled"); #if defined(__arm__) && !defined(__ARM_ARCH_7A__) /* XXX */ - strcpy(Config.Gpu, "gpuPCSX4ALL.so"); + strcpy(Config.Gpu, "gpu_unai.so"); #endif snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR); @@ -732,7 +732,7 @@ void *SysLoadLibrary(const char *lib) { // convenience hack if (strstr(lib, ".x86") == NULL) { char name[MAXPATHLEN]; - snprintf(name, sizeof(name), "%s.x86", lib); + snprintf(name, sizeof(name), "%s.x86_64", lib); lib = name; } #endif diff --git a/frontend/menu.c b/frontend/menu.c index b3b71773..57156d57 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -489,6 +489,10 @@ fail: menu_sync_config(); + // caanoo old config compat hack + if (strcmp(Config.Gpu, "gpuPCSX4ALL.so") == 0) + strcpy(Config.Gpu, "gpu_unai.so"); + // sync plugins for (i = bios_sel = 0; bioses[i] != NULL; i++) if (strcmp(Config.Bios, bioses[i]) == 0) diff --git a/plugins/gpulib/Makefile b/plugins/gpulib/Makefile index 2739e5cb..4a45aa21 100644 --- a/plugins/gpulib/Makefile +++ b/plugins/gpulib/Makefile @@ -23,15 +23,28 @@ OBJS += cspace.o endif CFLAGS += $(PLUGIN_CFLAGS) +# need to compile to another dir, same files are compiled +# into main binary without PIC +OBJS2 = $(patsubst %.o,obj/%.o,$(OBJS)) + TARGET = gpulib.$(EXT) -all: ../../config.mak $(TARGET) +all: ../../config.mak obj $(TARGET) -$(TARGET): $(OBJS) +$(TARGET): $(OBJS2) $(AR) crs $@ $^ +obj/%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $^ + +obj/%.o: %.s + $(AS) $(ASFLAGS) -o $@ $^ + clean: - $(RM) $(TARGET) $(OBJS) + $(RM) $(TARGET) $(OBJS2) + +obj: + mkdir -p $@ ../../config.mak: @echo "Please run ./configure before running make!" diff --git a/plugins/gpulib/gpulib.mak b/plugins/gpulib/gpulib.mak index 48e73cb6..349a0c81 100644 --- a/plugins/gpulib/gpulib.mak +++ b/plugins/gpulib/gpulib.mak @@ -25,6 +25,9 @@ endif CC_STANDLALONE = $(CC) CC_GPULIB = $(CC) +WD = $(shell pwd) +PLUGINDIR = $(shell basename $(WD)) + all: ../../config.mak $(TARGETS) ifdef BIN_STANDLALONE @@ -33,6 +36,7 @@ CC_STANDLALONE = $(CXX) endif $(BIN_STANDLALONE)$(EXT): $(SRC) $(SRC_STANDALONE) $(GPULIB_A) $(CC_STANDLALONE) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_STANDALONE) + ln -fs $(PLUGINDIR)/$@ ../ endif ifdef BIN_GPULIB @@ -41,6 +45,7 @@ CC_GPULIB = $(CXX) endif $(BIN_GPULIB)$(EXT): $(SRC) $(SRC_GPULIB) $(GPULIB_A) $(CC_GPULIB) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_GPULIB) + ln -fs $(PLUGINDIR)/$@ ../ endif $(GPULIB_A): diff --git a/plugins/spunull/Makefile b/plugins/spunull/Makefile index eb81cab3..dcd25eac 100644 --- a/plugins/spunull/Makefile +++ b/plugins/spunull/Makefile @@ -1,12 +1,20 @@ -all: ../../config.mak spunull.so - include ../../config.mak -spunull.so: spunull.c +ifneq "$(ARCH)" "arm" + EXT = .$(ARCH) +endif +TARGET = spunull.so$(EXT) +WD = $(shell pwd) +PLUGINDIR = $(shell basename $(WD)) + +all: ../../config.mak $(TARGET) + +$(TARGET): spunull.c $(CC) $(CFLAGS) -shared -fPIC -ggdb -O2 -o $@ $^ + ln -fs $(PLUGINDIR)/$(TARGET) ../ clean: - $(RM) spunull.so + $(RM) $(TARGET) ../../config.mak: @echo "Please run ./configure before running make!"