2008-12-29 14:52 Gwenole Beauchesne * Makefile, configure, src/npw-config.c, src/npw-wrapper.c, src/sysdeps.h: Backport from trunk: Make it possible to use alternate viewer paths with --viewer-paths configure option. By default, pkglibdir/%ARCH%/%OS% is used. If no viewer path includes an ARCH/OS expansion, then nspluginwrapper files are installed in a "flat" hierarchy. NPW_PluginInfo format is now extended to include the viewer_path[] too. Index: configure =================================================================== --- configure (révision 872) +++ configure (copie de travail) @@ -92,6 +92,9 @@ --pkglibdir=*) pkglibdir=`echo "$opt" | cut -d '=' -f 2` ;; +--viewer-paths=*) + viewer_paths=`echo "$opt" | cut -d '=' -f 2` + ;; --target-os=*) target_os=`echo "$opt" | cut -d '=' -f 2 | tr '[A-Z]' '[a-z]'` ;; @@ -224,6 +227,12 @@ pkglibdir="$prefix/lib/$PACKAGE" fi +# check for viewer paths +default_viewer_paths="$pkglibdir/%ARCH%/%OS%" +if test -z "$viewer_paths"; then + viewer_paths="$default_viewer_paths" +fi + # check for __attribute__((visibility())) support cat > $TMPC << EOF int foo __attribute__((visibility("hidden"))) = 1; @@ -631,6 +640,7 @@ echo " --help print this message" echo " --prefix=PREFIX install in PREFIX [$prefix]" echo " --pkglibdir=ROOT install private files in ROOT [$pkglibdir]" +echo " --viewer-paths=PATH allowed viewer lookup PATH [$viewer_paths]" echo " --target-os=OS build plugin support for target OS [$target_os]" echo " --target-cpu=CPU build plugin support for target CPU [$target_cpu]" echo " --enable-viewer build viewer [$build_viewer]" @@ -656,6 +666,7 @@ echo "Install prefix $prefix" echo "nspluginwrapper root dir $pkglibdir" +echo "Viewer paths $viewer_paths" echo "Strip binaries $strip" echo "Bi-arch build $biarch" echo "Build viewer $build_viewer" @@ -803,6 +814,26 @@ echo "pkglibdir=$pkglibdir" >> $config_mak echo "#define NPW_LIBDIR \"$pkglibdir\"" >> $config_h +# check if we want to install files in ARCH/OS specific locations +if echo ":$viewer_paths" | $EGREP -q ":$pkglibdir/%(ARCH|OS)%"; then + npw_common_libdir="$pkglibdir/noarch" + npw_host_libdir="$pkglibdir/$host_cpu/$host_os" + npw_target_libdir="$pkglibdir/$target_cpu/$target_os" + npw_target_libdir_var="$pkglibdir/\\\$\$TARGET_ARCH/\\\$\$TARGET_OS" +else + npw_common_libdir="$pkglibdir" + npw_host_libdir="$npw_common_libdir" + npw_target_libdir="$npw_common_libdir" + npw_target_libdir_var="$npw_common_libdir" +fi +echo "npcommondir=$npw_common_libdir" >> $config_mak +echo "nphostdir=$npw_host_libdir" >> $config_mak +echo "nptargetdir=$npw_target_libdir" >> $config_mak +echo "nptargetdir_var=$npw_target_libdir_var" >> $config_mak +echo "#define NPW_HOST_LIBDIR \"$npw_host_libdir\"" >> $config_h +echo "#define NPW_TARGET_LIBDIR \"$npw_target_libdir\"" >> $config_h +echo "#define NPW_VIEWER_PATHS \"$viewer_paths\"" >> $config_h + echo "#define RPC_INIT_TIMEOUT $rpc_init_timeout" >> $config_h for mh in $malloc_hooks; do Index: src/sysdeps.h =================================================================== --- src/sysdeps.h (révision 872) +++ src/sysdeps.h (copie de travail) @@ -45,9 +45,9 @@ #define NPW_VIEWER NPW_VIEWER_BASE #define NPW_WRAPPER_BASE "npwrapper" #define NPW_WRAPPER NPW_WRAPPER_BASE ".so" -#define NPW_OLD_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER -#define NPW_DEFAULT_PLUGIN_PATH NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER -#define NPW_PLUGIN_IDENT "NPW:" NPW_VERSION +#define NPW_DEFAULT_PLUGIN_PATH NPW_HOST_LIBDIR "/" NPW_WRAPPER +#define NPW_PLUGIN_INFO_VERSION 2 +#define NPW_PLUGIN_IDENT "NPW:X:" NPW_VERSION #define NPW_PLUGIN_IDENT_SIZE 32 typedef struct __attribute__((packed)) { char ident[NPW_PLUGIN_IDENT_SIZE]; @@ -55,6 +55,8 @@ time_t mtime; char target_arch[65]; char target_os[65]; + char struct_version; /* extended format "NPW:X:VERSION" */ + char viewer_path[PATH_MAX]; } NPW_PluginInfo; #if defined(BUILD_XPCOM) Index: src/npw-config.c =================================================================== --- src/npw-config.c (révision 872) +++ src/npw-config.c (copie de travail) @@ -71,6 +71,71 @@ return 1; } +static const char *strnstr(const char *str, int len, const char *substr) +{ + const char *match = strstr(str, substr); + if (len > 0 && (match + strlen(substr) > str + len)) + match = NULL; + return match; +} + +typedef struct { + const char *name; + const char *value; +} Var; + +static int strexpand(char *dst, int dstlen, const char *src, int srclen, const Var *vars) +{ + if (dst == NULL || dstlen < 1 || src == NULL) + return -1; + + if (srclen <= 0) + srclen = strlen(src); + + int n = 0; + for (int i = 0; i < srclen; i++) { + char ch = src[i]; + if (ch != '%') { + dst[n++] = ch; + if (n >= dstlen - 1) + return -1; + } + else { + char var[16]; + const char *str = &src[i + 1]; + const char *end = strchr(str, '%'); + if (end == NULL) + error("unterminated var '%s'", str); + + int len = end - str; + if (len >= sizeof(var) - 1) { + len = sizeof(var) - 1; + memcpy(var, str, len); + var[len] = '\0'; + error("unsupported var '%s...'", var); + } + memcpy(var, str, len); + var[len] = '\0'; + + str = NULL; + for (int j = 0; vars[j].name != NULL; j++) { + if (strcmp(vars[j].name, var) == 0) { + str = vars[j].value; + break; + } + } + if (str == NULL) + error("could not expand var '%s'", var); + i += len + 1; + len = strlen(str); + memcpy(&dst[n], str, len); + n += len; + } + } + dst[n] = '\0'; + return 0; +} + /* Implement mkdir -p with default permissions (derived from busybox code) */ static int mkdir_p(const char *path) { @@ -489,6 +554,30 @@ EXIT_VIEWER_NATIVE = 20 }; +static bool is_plugin_viewer_ok(const char *viewer_path, const char *filename) +{ + int pid = fork(); + if (pid < 0) + return false; + if (pid == 0) { + if (!g_verbose) { + // don't spit out errors in non-verbose mode, we only need + // to know whether there is a valid viewer or not + freopen("/dev/null", "w", stderr); + } + execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL); + exit(1); + } + else { + int status; + while (waitpid(pid, &status, 0) != pid) + ; + if (WIFEXITED(status) && WEXITSTATUS(status) == 0) + return true; + } + return false; +} + static int detect_plugin_viewer(const char *filename, NPW_PluginInfo *out_plugin_info) { static const char *target_arch_table[] = { @@ -522,52 +611,60 @@ && out_plugin_info->target_os && strcmp(out_plugin_info->target_os, HOST_OS) == 0) return EXIT_VIEWER_NATIVE; - for (int i = 0; i < target_arch_table_size; i++) { - const char *target_arch = target_arch_table[i]; - if (target_arch == NULL) - continue; - char viewer_arch_path[PATH_MAX]; - sprintf(viewer_arch_path, "%s/%s", NPW_LIBDIR, target_arch); - if (access(viewer_arch_path, F_OK) != 0) { - target_arch_table[i] = NULL; // this target ARCH is not available, skip it for good - continue; - } - for (int j = 0; j < target_os_table_size; j++) { - const char *target_os = target_os_table[j]; - if (target_os == NULL) + enum { VAR_ARCH, VAR_OS, VAR_COUNT }; + Var vars[VAR_COUNT+1]; + vars[VAR_ARCH].name = "ARCH"; + vars[VAR_OS].name = "OS"; + vars[VAR_COUNT].name = NULL; + vars[VAR_COUNT].value = NULL; + + char viewer_path[sizeof(out_plugin_info->viewer_path)]; + const int viewer_path_len = sizeof(viewer_path) - strlen(NPW_VIEWER) - 1; + const char viewer_paths[] = NPW_VIEWER_PATHS; + const char *viewer_path_spec_end, *viewer_path_spec = viewer_paths; + do { + int len; + if ((viewer_path_spec_end = strchr(viewer_path_spec, ':')) != NULL) + len = viewer_path_spec_end - viewer_path_spec; + else + len = strchr(viewer_path_spec, '\0') - viewer_path_spec; + + for (int i = 0; i < target_arch_table_size; i++) { + const char *target_arch = target_arch_table[i]; + if (target_arch == NULL) continue; - char viewer_path[PATH_MAX]; - sprintf(viewer_path, "%s/%s/%s", viewer_arch_path, target_os, NPW_VIEWER); - if (access(viewer_path, F_OK) != 0) - continue; - int pid = fork(); - if (pid < 0) - continue; - else if (pid == 0) { - if (!g_verbose) { - // don't spit out errors in non-verbose mode, we only need - // to know whether there is a valid viewer or not - freopen("/dev/null", "w", stderr); + vars[VAR_ARCH].value = target_arch; + + for (int j = 0; j < target_os_table_size; j++) { + const char *target_os = target_os_table[j]; + if (target_os == NULL) + continue; + vars[VAR_OS].value = target_os; + + if (strexpand(viewer_path, viewer_path_len, viewer_path_spec, len, vars) < 0) + continue; + strcat(viewer_path, "/" NPW_VIEWER); + if (access(viewer_path, F_OK) != 0) + continue; + + if (is_plugin_viewer_ok(viewer_path, filename)) { + strcpy(out_plugin_info->target_arch, target_arch); + strcpy(out_plugin_info->target_os, target_os); + strcpy(out_plugin_info->viewer_path, viewer_path); + return EXIT_VIEWER_OK; } - execl(viewer_path, NPW_VIEWER, "--test", "--plugin", filename, NULL); - exit(1); + + if (strnstr(viewer_path_spec, len, "%OS%") == NULL) + break; // don't iterate over OS table if there is no "%OS%" pattern } - else { - int status; - while (waitpid(pid, &status, 0) != pid) - ; - if (WIFEXITED(status)) { - status = WEXITSTATUS(status); - if (status == EXIT_VIEWER_OK && out_plugin_info) { - strcpy(out_plugin_info->target_arch, target_arch); - strcpy(out_plugin_info->target_os, target_os); - } - return status; - } - return EXIT_VIEWER_ERROR; - } + + if (strnstr(viewer_path_spec, len, "%ARCH%") == NULL) + break; // don't iterate over ARCH table if there is no "%ARCH%" pattern } - } + + viewer_path_spec += len + 1; + } while (viewer_path_spec_end != NULL); + return EXIT_VIEWER_NOT_FOUND; } @@ -604,15 +701,27 @@ if ((pi = (NPW_PluginInfo *)dlsym(handle, "NPW_Plugin")) == NULL) return false; if (out_plugin_info) { + int plugin_info_version = 0; + if (strncmp(pi->ident, "NPW:0.9.90", 10) != 0) + plugin_info_version = 1; + if (strncmp(pi->ident, "NPW:X:", 6) == 0) + plugin_info_version = pi->struct_version; + out_plugin_info->struct_version = plugin_info_version; strcpy(out_plugin_info->ident, pi->ident); strcpy(out_plugin_info->path, pi->path); out_plugin_info->mtime = pi->mtime; - out_plugin_info->target_arch[0] = '\0'; - out_plugin_info->target_os[0] = '\0'; - if (strncmp(pi->ident, "NPW:0.9.90", 10) != 0) { // additional members in 0.9.91+ + if (plugin_info_version >= 1) { // additional members in 0.9.91+ strcpy(out_plugin_info->target_arch, pi->target_arch); strcpy(out_plugin_info->target_os, pi->target_os); } + else { + out_plugin_info->target_arch[0] = '\0'; + out_plugin_info->target_os[0] = '\0'; + } + if (plugin_info_version >= 2) // additional members in 1.3.0+ + strcpy(out_plugin_info->viewer_path, pi->viewer_path); + else + out_plugin_info->viewer_path[0] = '\0'; } return true; } @@ -628,12 +737,26 @@ return ret; } +static bool is_master_wrapper_plugin(const char *plugin_path) +{ + static const char *master_plugin_paths[] = { + NPW_LIBDIR "/" HOST_ARCH "/" NPW_WRAPPER, + NPW_LIBDIR "/" HOST_ARCH "/" HOST_OS "/" NPW_WRAPPER, + NPW_DEFAULT_PLUGIN_PATH, + NULL + }; + for (int i = 0; master_plugin_paths[i] != NULL; i++) { + if (strcmp(master_plugin_paths[i], plugin_path) == 0) + return true; + } + return false; +} + static bool is_wrapper_plugin_0(const char *plugin_path) { NPW_PluginInfo plugin_info; return is_wrapper_plugin(plugin_path, &plugin_info) - && strcmp(plugin_info.path, NPW_DEFAULT_PLUGIN_PATH) != 0 // exclude OS/ARCH npwrapper.so - && strcmp(plugin_info.path, NPW_OLD_DEFAULT_PLUGIN_PATH) != 0; // exclude ARCH npwrapper.so + && !is_master_wrapper_plugin(plugin_path); } static bool has_system_wide_wrapper_plugin(const char *plugin_path, bool check_ident) @@ -789,11 +912,17 @@ if (!is_plugin_viewer_available(plugin_path, plugin_info)) return 15; } + if (plugin_info->viewer_path[0] == '\0') { + if (!is_plugin_viewer_available(plugin_path, plugin_info)) + return 16; + } NPW_PluginInfo *pi = (NPW_PluginInfo *)(plugin_data + ofs - NPW_PLUGIN_IDENT_SIZE); pi->mtime = st.st_mtime; strcpy(pi->target_arch, plugin_info->target_arch); strcpy(pi->target_os, plugin_info->target_os); + pi->struct_version = w_plugin_info.struct_version; + strcpy(pi->viewer_path, plugin_info->viewer_path); int mode = 0700; if (!is_user_home_path(d_plugin_path) && @@ -902,6 +1031,7 @@ int ret = 0; NPW_PluginInfo plugin_info; + memset(&plugin_info, 0, sizeof(plugin_info)); is_wrapper_plugin(plugin_path, &plugin_info); struct stat st; @@ -968,13 +1098,21 @@ static int list_plugin(const char *plugin_path) { NPW_PluginInfo plugin_info; + memset(&plugin_info, 0, sizeof(plugin_info)); is_wrapper_plugin(plugin_path, &plugin_info); printf("%s\n", plugin_path); printf(" Original plugin: %s\n", plugin_info.path); + if (plugin_info.struct_version >= 2 && plugin_info.viewer_path[0] != '\0') + printf(" Plugin viewer: %s\n", plugin_info.viewer_path); char *str = strtok(plugin_info.ident, ":"); if (str && strcmp(str, "NPW") == 0) { str = strtok(NULL, ":"); + if (plugin_info.struct_version >= 2) { /* skip 'X' */ + if (str[0] != 'X') + error("invalid NPW_PluginInfo format"); + str = strtok(NULL, ":"); + } if (str) { printf(" Wrapper version string: %s", str); str = strtok(NULL, ":"); @@ -1083,15 +1221,19 @@ for (i = 0; i < argc; i++) { NPW_PluginInfo plugin_info; + memset(&plugin_info, 0, sizeof(plugin_info)); + const char *plugin_path = argv[i]; if (!is_plugin(plugin_path, &plugin_info)) error("%s is not a valid NPAPI plugin", plugin_path); + ret = detect_plugin_viewer(plugin_path, &plugin_info); if (ret != EXIT_VIEWER_OK) { if (ret == EXIT_VIEWER_NATIVE) return 0; /* silently ignore exit status */ error("no appropriate viewer found for %s", plugin_path); } + ret = install_plugin(plugin_path, &plugin_info); if (ret != 0) return ret; Index: src/npw-wrapper.c =================================================================== --- src/npw-wrapper.c (révision 872) +++ src/npw-wrapper.c (copie de travail) @@ -21,7 +21,6 @@ #define _GNU_SOURCE 1 /* RTLD_DEFAULT */ #include "sysdeps.h" -#include #include #include #include @@ -61,12 +60,17 @@ NPW_DEFAULT_PLUGIN_PATH, 0, HOST_OS, - HOST_ARCH + HOST_ARCH, + NPW_PLUGIN_INFO_VERSION, + "" }; // Path to plugin to use static const char *plugin_path = NPW_Plugin.path; +// Path to associated plugin viewer +static const char *plugin_viewer_path = NPW_Plugin.viewer_path; + // Netscape exported functions static NPNetscapeFuncs mozilla_funcs; @@ -3348,15 +3352,13 @@ static int init_count = 0; ++init_count; - char viewer_path[PATH_MAX]; - sprintf(viewer_path, "%s/%s/%s/%s", NPW_LIBDIR, NPW_Plugin.target_arch, NPW_Plugin.target_os, NPW_VIEWER); char connection_path[128]; sprintf(connection_path, "%s/%s/%d-%d", NPW_CONNECTION_PATH, plugin_file_name, getpid(), init_count); // Cache MIME info and plugin name/description if (g_plugin.name == NULL && g_plugin.description == NULL && g_plugin.formats == NULL) { char command[1024]; - if (snprintf(command, sizeof(command), "%s --info --plugin %s", viewer_path, plugin_path) >= sizeof(command)) + if (snprintf(command, sizeof(command), "%s --info --plugin %s", plugin_viewer_path, plugin_path) >= sizeof(command)) return; FILE *viewer_fp = popen(command, "r"); if (viewer_fp == NULL) @@ -3416,7 +3418,7 @@ npw_close_all_open_files(); - execv(viewer_path, argv); + execv(plugin_viewer_path, argv); npw_printf("ERROR: failed to execute NSPlugin viewer\n"); _Exit(255); } Index: src/npw-viewer.sh =================================================================== --- src/npw-viewer.sh (révision 872) +++ src/npw-viewer.sh (copie de travail) @@ -2,9 +2,8 @@ # # nsplugin viewer wrapper script (C) 2005-2006 Gwenole Beauchesne # -OS="`uname -s`" +OS="`uname -s | tr '[A-Z]' '[a-z]'`" ARCH="`uname -m`" -NPW_LIBDIR="%NPW_LIBDIR%" if test -z "$TARGET_OS"; then echo "*** NSPlugin Viewer *** error, TARGET_OS not initialized" @@ -16,8 +15,55 @@ exit 1 fi -NPW_VIEWER_DIR=$NPW_LIBDIR/$TARGET_ARCH/$TARGET_OS +normalize_cpu() { +local cpu="$1" +case "$cpu" in +arm*) + cpu="arm" + ;; +i[3456]86|k[678]|i86pc|BePC) + cpu="i386" + ;; +ia64) + cpu="ia64" + ;; +"Power Macintosh"|ppc) + cpu="ppc" + ;; +ppc64) + cpu="ppc64" + ;; +sparc) + cpu="sparc" + ;; +sparc64) + cpu="sparc64" + ;; +x86_64|amd64) + cpu="x86_64" + ;; +esac +echo "$cpu" +} +normalize_os() { +local os="$1" +case "$os" in +sunos*) + os="solaris" + ;; +esac +echo "$os" +} + +ARCH=`normalize_cpu "$ARCH"` +OS=`normalize_os "$OS"` +TARGET_ARCH=`normalize_cpu "$TARGET_ARCH"` +TARGET_OS=`normalize_os "$TARGET_OS"` + +# Define where npviewer.bin is located +NPW_VIEWER_DIR="%NPW_VIEWER_DIR%" + # Set a new LD_LIBRARY_PATH that is TARGET specific export LD_LIBRARY_PATH=$NPW_VIEWER_DIR @@ -31,24 +77,15 @@ NPW_USE_VALGRIND=${NPW_USE_VALGRIND:-no} can_use_valgrind="no" -case $ARCH in -i?86|i86pc) - ARCH=i386 - ;; -amd64) - ARCH=x86_64 - ;; -esac - if test "$ARCH" != "$TARGET_ARCH"; then case $TARGET_ARCH in i386) if test "$ARCH" = "x86_64"; then case "$OS" in - Linux) + linux) LOADER=`which linux32` ;; - FreeBSD | NetBSD) + freebsd | netbsd) # XXX check that COMPAT_LINUX is enabled or fail otherwise LOADER="none" ;; @@ -66,7 +103,7 @@ ppc) if test "$ARCH" = "ppc64"; then case "$OS" in - Linux) + linux) LOADER=`which linux32` ;; esac @@ -98,7 +135,7 @@ fi # Expand PATH for RealPlayer package on NetBSD (realplay) -if test "$OS" = "NetBSD"; then +if test "$OS" = "netbsd"; then REALPLAYER_HOME="/usr/pkg/lib/RealPlayer" if test -x "$REALPLAYER_HOME/realplay"; then export PATH=$PATH:$REALPLAYER_HOME @@ -114,7 +151,7 @@ # XXX: detect QEMU target soundwrapper differently case "$LOADER" in *linux32) - if test "$OS" = "Linux"; then + if test "$OS" = "linux"; then soundwrapper=`which soundwrapper 2>/dev/null` if test -x "$soundwrapper"; then LOADER="$LOADER $soundwrapper" Index: nspluginwrapper.spec =================================================================== --- nspluginwrapper.spec (révision 872) +++ nspluginwrapper.spec (copie de travail) @@ -159,7 +159,7 @@ %{plugindir}/npwrapper.so %dir %{pkglibdir} %dir %{pkglibdir}/noarch -%{pkglibdir}/noarch/npviewer +%{pkglibdir}/noarch/npviewer.sh %dir %{pkglibdir}/%{_arch} %dir %{pkglibdir}/%{_arch}/%{_os} %{pkglibdir}/%{_arch}/%{_os}/npconfig Index: Makefile =================================================================== --- Makefile (révision 872) +++ Makefile (copie de travail) @@ -182,7 +182,7 @@ npconfig_LDFLAGS += $(libpthread_LDFLAGS) endif -nploader_PROGRAM = npviewer +nploader_PROGRAM = npviewer.sh nploader_RAWSRCS = npw-viewer.sh nploader_SOURCES = $(nploader_RAWSRCS:%.sh=$(SRC_PATH)/src/%.sh) @@ -255,51 +255,43 @@ uninstall: uninstall.player uninstall.wrapper uninstall.viewer uninstall.libxpcom uninstall.libnoxshm uninstall.loader uninstall.config uninstall.dirs uninstall.dirs: - rmdir $(DESTDIR)$(pkglibdir)/noarch - rmdir $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS) - rmdir $(DESTDIR)$(pkglibdir)/$(ARCH) -ifneq ($(ARCH),$(ARCH_32)) - rmdir $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS) - rmdir $(DESTDIR)$(pkglibdir)/$(ARCH_32) -endif + rmdir -p $(DESTDIR)$(nptargetdir) || : + rmdir -p $(DESTDIR)$(nphostdir) || : + rmdir -p $(DESTDIR)$(npcommondir) || : uninstall.player: - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) + rm -f $(DESTDIR)$(nphostdir)/$(npplayer_PROGRAM) uninstall.wrapper: - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npwrapper_LIBRARY) + rm -f $(DESTDIR)$(nphostdir)/$(npwrapper_LIBRARY) uninstall.viewer: - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM) - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%) + rm -f $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM) + rm -f $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM:%.bin=%) uninstall.libxpcom: - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY) + rm -f $(DESTDIR)$(nptargetdir)/$(libxpcom_LIBRARY) uninstall.libnoxshm: - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY) + rm -f $(DESTDIR)$(nptargetdir)/$(libnoxshm_LIBRARY) uninstall.loader: - rm -f $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM) + rm -f $(DESTDIR)$(npcommondir)/$(nploader_PROGRAM) uninstall.config: rm -f $(DESTDIR)$(bindir)/nspluginwrapper - rm -f $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) + rm -f $(DESTDIR)$(nphostdir)/$(npconfig_PROGRAM) uninstall.mkruntime: - rm -f $(DESTDIR)$(pkglibdir)/noarch/mkruntime + rm -f $(DESTDIR)$(npcommondir)/mkruntime install: install.dirs install.player install.wrapper install.viewer install.libxpcom install.libnoxshm install.loader install.config install.dirs: - mkdir -p $(DESTDIR)$(pkglibdir)/noarch - mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH) - mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS) -ifneq ($(ARCH),$(ARCH_32)) - mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32) - mkdir -p $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS) -endif + mkdir -p $(DESTDIR)$(npcommondir) || : + mkdir -p $(DESTDIR)$(nphostdir) || : + mkdir -p $(DESTDIR)$(nptargetdir) || : ifeq ($(build_player),yes) install.player: $(npplayer_PROGRAM) - $(INSTALL) -m 755 $(STRIP_OPT) $(npplayer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) + $(INSTALL) -m 755 $(STRIP_OPT) $(npplayer_PROGRAM) $(DESTDIR)$(nphostdir)/$(npplayer_PROGRAM) mkdir -p $(DESTDIR)$(bindir) - $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer + $(LN_S) $(nphostdir)/$(npplayer_PROGRAM) $(DESTDIR)$(bindir)/nspluginplayer else install.player: endif install.wrapper: $(npwrapper_LIBRARY) - $(INSTALL) -m 755 $(STRIP_OPT) $(npwrapper_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npwrapper_LIBRARY) + $(INSTALL) -m 755 $(STRIP_OPT) $(npwrapper_LIBRARY) $(DESTDIR)$(nphostdir)/$(npwrapper_LIBRARY) ifeq ($(build_viewer),yes) install.viewer: install.viewer.bin install.viewer.glue install.libxpcom: do.install.libxpcom @@ -310,26 +302,26 @@ install.libnoxshm: endif install.viewer.bin: $(npviewer_PROGRAM) - $(INSTALL) -m 755 $(STRIP_OPT) $(npviewer_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM) + $(INSTALL) -m 755 $(STRIP_OPT) $(npviewer_PROGRAM) $(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM) install.viewer.glue:: - p=$(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(npviewer_PROGRAM:%.bin=%); \ + p=$(DESTDIR)$(nptargetdir)/$(npviewer_PROGRAM:%.bin=%); \ echo "#!/bin/sh" > $$p; \ echo "TARGET_OS=$(TARGET_OS)" >> $$p; \ echo "TARGET_ARCH=$(TARGET_ARCH)" >> $$p; \ - echo ". $(pkglibdir)/noarch/$(nploader_PROGRAM)" >> $$p; \ + echo ". $(npcommondir)/$(nploader_PROGRAM)" >> $$p; \ chmod 755 $$p do.install.libxpcom: $(libxpcom_LIBRARY) - $(INSTALL) -m 755 $(STRIP_OPT) $(libxpcom_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libxpcom_LIBRARY) + $(INSTALL) -m 755 $(STRIP_OPT) $(libxpcom_LIBRARY) $(DESTDIR)$(nptargetdir)/$(libxpcom_LIBRARY) do.install.libnoxshm: $(libnoxshm_LIBRARY) - $(INSTALL) -m 755 $(STRIP_OPT) $(libnoxshm_LIBRARY) $(DESTDIR)$(pkglibdir)/$(ARCH_32)/$(TARGET_OS)/$(libnoxshm_LIBRARY) + $(INSTALL) -m 755 $(STRIP_OPT) $(libnoxshm_LIBRARY) $(DESTDIR)$(nptargetdir)/$(libnoxshm_LIBRARY) install.config: $(npconfig_PROGRAM) - $(INSTALL) -m 755 $(STRIP_OPT) $(npconfig_PROGRAM) $(DESTDIR)$(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) + $(INSTALL) -m 755 $(STRIP_OPT) $(npconfig_PROGRAM) $(DESTDIR)$(nphostdir)/$(npconfig_PROGRAM) mkdir -p $(DESTDIR)$(bindir) - $(LN_S) $(pkglibdir)/$(ARCH)/$(OS)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper + $(LN_S) $(nphostdir)/$(npconfig_PROGRAM) $(DESTDIR)$(bindir)/nspluginwrapper install.loader: $(nploader_PROGRAM) - $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(pkglibdir)/noarch/$(nploader_PROGRAM) + $(INSTALL) -m 755 $(nploader_PROGRAM) $(DESTDIR)$(npcommondir)/$(nploader_PROGRAM) install.mkruntime: $(SRC_PATH)/utils/mkruntime.sh - $(INSTALL) -m 755 $< $(DESTDIR)$(pkglibdir)/noarch/mkruntime + $(INSTALL) -m 755 $< $(DESTDIR)$(npcommondir)/mkruntime $(archivedir):: [ -d $(archivedir) ] || mkdir $(archivedir) > /dev/null 2>&1 @@ -413,7 +405,7 @@ $(CC) -o $@ -c $< $(CPPFLAGS) $(CFLAGS) $(nploader_PROGRAM): $(nploader_SOURCES) - sed -e "s|%NPW_LIBDIR%|$(pkglibdir)|" $< > $@ + sed -e 's|%NPW_VIEWER_DIR%|$(nptargetdir_var)|' $< > $@ chmod 755 $@ $(LSB_OBJ_DIR)::