Apostolos\’ Daily Plate

Compiling pulseaudio-5.99.3 on Solaris x86

Posted in Πληροφορική, OpenIndiana, OpenSolaris by asyropoulos on 9 Φεβρουαρίου, 2015

Oracle has released some patches that can be used to compile a very old version of PulseAudio. I have used these patches and after adding some things and removing some others I have successfully managed to compile Pulse Audio. The patches follows:


diff -rupN pulseaudio-5.99.3.old/src/daemon/default.pa.in pulseaudio-5.99.3/src/daemon/default.pa.in
--- pulseaudio-5.99.3.old/src/daemon/default.pa.in 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/daemon/default.pa.in 2015-02-08 22:11:11.577334805 +0200
@@ -54,7 +54,7 @@ ifelse(@HAVE_ALSA@, 1, [dnl
#load-module module-alsa-source device=hw:1,0
])dnl
ifelse(@HAVE_OSS_OUTPUT@, 1, [dnl
-#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
+load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
])dnl
ifelse(@HAVE_WAVEOUT@, 1, [dnl
diff -rupN pulseaudio-5.99.3.old/src/daemon/esdcompat.in pulseaudio-5.99.3/src/daemon/esdcompat.in
--- pulseaudio-5.99.3.old/src/daemon/esdcompat.in 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/daemon/esdcompat.in 2015-02-08 22:11:11.577649151 +0200
@@ -88,7 +88,10 @@ EOF
;;
esac

– shift
+ # don’t try to shift nonexisting args
+ if [ $1 ]; then
+ shift
+ fi
done

eval «exec ‘@PA_BINARY@’$ARGS»
diff -rupN pulseaudio-5.99.3.old/src/modules/gconf/module-gconf.c pulseaudio-5.99.3/src/modules/gconf/module-gconf.c
— pulseaudio-5.99.3.old/src/modules/gconf/module-gconf.c 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/modules/gconf/module-gconf.c 2015-02-08 22:11:11.578283648 +0200
@@ -56,7 +56,7 @@ struct module_item {
uint32_t index;
};

-struct module_info {
+struct pa_module_info {
struct userdata *userdata;
char *name;

@@ -129,7 +129,7 @@ static char *read_string(struct userdata
}
}

-static void unload_one_module(struct module_info *m, unsigned i) {
+static void unload_one_module(struct pa_module_info *m, unsigned i) {
struct userdata *u;

pa_assert(m);
@@ -148,7 +148,7 @@ static void unload_one_module(struct mod
m->items[i].name = m->items[i].args = NULL;
}

-static void unload_all_modules(struct module_info *m) {
+static void unload_all_modules(struct pa_module_info *m) {
unsigned i;

pa_assert(m);
@@ -160,7 +160,7 @@ static void unload_all_modules(struct mo
}

static void load_module(
– struct module_info *m,
+ struct pa_module_info *m,
unsigned i,
const char *name,
const char *args,
@@ -199,7 +199,7 @@ static void load_module(
}

static void module_info_free(void *p) {
– struct module_info *m = p;
+ struct pa_module_info *m = p;

pa_assert(m);

@@ -227,14 +227,14 @@ static int handle_event(struct userdata

case ‘+’: {
char *name;
– struct module_info *m;
+ struct pa_module_info *m;
unsigned i, j;

if (!(name = read_string(u)))
goto fail;

if (!(m = pa_hashmap_get(u->module_infos, name))) {
– m = pa_xnew(struct module_info, 1);
+ m = pa_xnew(struct pa_module_info, 1);
m->userdata = u;
m->name = name;
m->n_items = 0;
diff -rupN pulseaudio-5.99.3.old/src/modules/module-augment-properties.c pulseaudio-5.99.3/src/modules/module-augment-properties.c
— pulseaudio-5.99.3.old/src/modules/module-augment-properties.c 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/modules/module-augment-properties.c 2015-02-08 22:11:11.578666761 +0200
@@ -158,8 +158,8 @@ static void update_rule(struct rule *r)
/* Let’s try a more aggressive search, but only one level */
if ((desktopfiles_dir = opendir(DESKTOPFILEDIR))) {
while ((dir = readdir(desktopfiles_dir))) {
– if (dir->d_type != DT_DIR
– || pa_streq(dir->d_name, «.»)
+ if (/* dir->d_type != DT_DIR
+ || */ pa_streq(dir->d_name, «.»)
|| pa_streq(dir->d_name, «..»))
continue;

diff -rupN pulseaudio-5.99.3.old/src/modules/module-solaris.c pulseaudio-5.99.3/src/modules/module-solaris.c
— pulseaudio-5.99.3.old/src/modules/module-solaris.c 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/modules/module-solaris.c 2015-02-08 22:11:11.579626929 +0200
@@ -135,6 +135,7 @@ static const char* const valid_modargs[]
static uint64_t get_playback_buffered_bytes(struct userdata *u) {
audio_info_t info;
uint64_t played_bytes;
+ int64_t buffered_bytes;
int err;

pa_assert(u->sink);
@@ -161,10 +162,13 @@ static uint64_t get_playback_buffered_by

pa_smoother_put(u->smoother, pa_rtclock_now(), pa_bytes_to_usec(played_bytes, &u->sink->sample_spec));

– if (u->written_bytes > played_bytes)
– return u->written_bytes – played_bytes;
– else
– return 0;
+ buffered_bytes = u->written_bytes – played_bytes;
+
+ if (buffered_bytes < 0) {
+ buffered_bytes = 0;
+ }
+
+ return (uint64_t) buffered_bytes;
}

static pa_usec_t sink_get_latency(struct userdata *u, pa_sample_spec *ss) {
@@ -415,7 +419,7 @@ static int sink_process_msg(pa_msgobject
if (unsuspend(u) < 0) return -1; u->sink->get_volume(u->sink);
– u->sink->get_mute(u->sink);
+ u->sink->get_mute(u->sink,(_Bool*)1);
}
u->sink_suspended = false;
}
@@ -486,14 +490,26 @@ static int source_process_msg(pa_msgobje
static void sink_set_volume(pa_sink *s) {
struct userdata *u;
audio_info_t info;
+ pa_volume_t v;

pa_assert_se(u = s->userdata);

+ if (u->fd < 0) { + u->fd = pa_open_cloexec(u->device_name, u->mode | O_NONBLOCK, 0);
+ }
+
if (u->fd >= 0) {
AUDIO_INITINFO(&info);

– info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
– pa_assert(info.play.gain <= AUDIO_MAX_GAIN); + v = pa_cvolume_max(&s->real_volume);
+ if (v > PA_VOLUME_NORM) {
+ v = PA_VOLUME_NORM;
+ }
+
+ info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
+
+ pa_log_debug(«PA_VOLUME_NORM is %ld», PA_VOLUME_NORM);
+ pa_log_debug(«Setting volume %ld %ld», v, info.play.gain);

if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) @@ -513,22 +529,29 @@ static void sink_get_volume(pa_sink *s) if (u->fd >= 0) {
if (ioctl(u->fd, AUDIO_GETINFO, &info) < 0) pa_log(«AUDIO_SETINFO: %s», pa_cstrerror(errno)); – else + else { + pa_log_debug(«Getting volume %ld %ld», info.play.gain, (info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN)); pa_cvolume_set(&s->real_volume, s->sample_spec.channels, info.play.gain * PA_VOLUME_NORM / AUDIO_MAX_GAIN);
+ }
}
}

static void source_set_volume(pa_source *s) {
struct userdata *u;
audio_info_t info;
+ pa_volume_t v;

pa_assert_se(u = s->userdata);

if (u->fd >= 0) {
AUDIO_INITINFO(&info);

– info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
– pa_assert(info.play.gain <= AUDIO_MAX_GAIN); + v = pa_cvolume_max(&s->real_volume);
+ if (v > PA_VOLUME_NORM) {
+ v = PA_VOLUME_NORM;
+ }
+
+ info.play.gain = v * AUDIO_MAX_GAIN / PA_VOLUME_NORM;

if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) @@ -1034,7 +1057,7 @@ int pa__init(pa_module *m) { if (sink_new_data.muted_is_set) u->sink->set_mute(u->sink);
else
– u->sink->get_mute(u->sink);
+ u->sink->get_mute(u->sink,(_Bool*)1);

pa_sink_put(u->sink);
}
diff -rupN pulseaudio-5.99.3.old/src/modules/oss/module-oss.c pulseaudio-5.99.3/src/modules/oss/module-oss.c
— pulseaudio-5.99.3.old/src/modules/oss/module-oss.c 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/modules/oss/module-oss.c 2015-02-08 22:11:11.581263125 +0200
@@ -32,6 +32,10 @@
*
*/

+#define HAVE_OSSV4
+#define TRUE 1
+#define FALSE 0
+
#ifdef HAVE_CONFIG_H
#include
#endif
@@ -123,7 +127,18 @@ struct userdata {
int mode;

int mixer_fd;
+
+#ifdef HAVE_OSSV4
+ int mixer_dev;
+ int mixer_sink_control;
+ int mixer_source_control;
+ int mixer_cmax;
+ int mixer_dsp_fd;
+ oss_mixext sink_mixext;
+ oss_mixext source_mixext;
+#else
int mixer_devmask;
+#endif

int nfrags, frag_size, orig_frag_size;

@@ -809,6 +824,160 @@ static int source_process_msg(pa_msgobje
return ret;
}

+#ifdef HAVE_OSSV4
+
+static const char *
+mixer_ext_type_get_name (int type)
+{
+ switch (type) {
+ case MIXT_DEVROOT:
+ return «Device root entry»;
+ case MIXT_GROUP:
+ return «Controller group»;
+ case MIXT_ONOFF:
+ return «On/Off switch»;
+ case MIXT_ENUM:
+ return «Enumeration control»;
+ case MIXT_MONOSLIDER:
+ return «Mono slider (0-255)»;
+ case MIXT_STEREOSLIDER:
+ return «Stereo slider (0-255)»;
+ case MIXT_MESSAGE:
+ return «Textual message»;
+ case MIXT_MONOVU:
+ return «Mono VU meter value»;
+ case MIXT_STEREOVU:
+ return «Stereo VU meter value»;
+ case MIXT_MONOPEAK:
+ return «Mono VU meter peak value»;
+ case MIXT_STEREOPEAK:
+ return «Stereo VU meter peak value»;
+ case MIXT_RADIOGROUP:
+ return «Radio button group»;
+ case MIXT_MARKER:
+ /* Separator between normal and extension entries */
+ return «Separator»;
+ case MIXT_VALUE:
+ return «Decimal value entry»;
+ case MIXT_HEXVALUE:
+ return «Hex value entry»;
+ case MIXT_SLIDER:
+ return «Mono slider (31-bit value range)»;
+ case MIXT_3D:
+ return «3D»;
+ case MIXT_MONOSLIDER16:
+ return «Mono slider (0-32767)»;
+ case MIXT_STEREOSLIDER16:
+ return «Stereo slider (0-32767)»;
+ case MIXT_MUTE:
+ return «Mute switch»;
+ default:
+ break;
+ }
+
+ return «Unknown»;
+}
+
+void
+mixer_showflags (int flags)
+{
+ struct
+ {
+ int flag;
+ char nick[16];
+ } all_flags[] = {
+ /* first the important ones */
+ {
+ MIXF_MAINVOL, «MAINVOL»}, {
+ MIXF_PCMVOL, «PCMVOL»}, {
+ MIXF_RECVOL, «RECVOL»}, {
+ MIXF_MONVOL, «MONVOL»}, {
+ MIXF_DESCR, «DESCR»},
+
+ /* now the rest in the right order */
+ {
+ MIXF_READABLE, «READABLE»}, {
+ MIXF_WRITEABLE, «WRITABLE»}, {
+ MIXF_POLL, «POLL»}, {
+ MIXF_HZ, «HZ»}, {
+ MIXF_STRING, «STRING»}, {
+ MIXF_DYNAMIC, «DYNAMIC»}, {
+ MIXF_OKFAIL, «OKFAIL»}, {
+ MIXF_FLAT, «FLAT»}, {
+ MIXF_LEGACY, «LEGACY»}, {
+ MIXF_CENTIBEL, «CENTIBEL»}, {
+ MIXF_DECIBEL, «DECIBEL»}, {
+ MIXF_WIDE, «WIDE»}
+ };
+ int num_flags = (sizeof (all_flags) / sizeof ((all_flags)[0]));
+ int i;
+
+ if (flags == 0) {
+ pa_log_debug (» flags : None»);
+ return;
+ }
+
+ for (i=0; i < num_flags; i++) { + if ((flags & all_flags[i].flag)) { + pa_log_debug (» flag : %s», all_flags[i].nick); + flags &= ~all_flags[i].flag; /* unset */ + } + } + + /* Unknown flags? */ + if (flags != 0) { + pa_log_debug (» flag : ????»); + } + + return; +} + +static void sink_get_volume(pa_sink *s) { + struct userdata *u; + + pa_assert_se(u = s->userdata);
+
+ if (pa_oss_get_volume(u->mixer_dsp_fd, &(u->sink_mixext), &s->sample_spec, &s->real_volume) >= 0)
+ return;
+
+ pa_log_info(«Device doesn’t support reading mixer settings: %s», pa_cstrerror(errno));
+}
+
+static void sink_set_volume(pa_sink *s) {
+ struct userdata *u;
+
+ pa_assert_se(u = s->userdata);
+
+ if (pa_oss_set_volume(u->mixer_dsp_fd, &(u->sink_mixext), &s->sample_spec, &s->real_volume) >= 0)
+ return;
+
+ pa_log_info(«Device doesn’t support writing mixer settings: %s», pa_cstrerror(errno));
+}
+
+static void source_get_volume(pa_source *s) {
+ struct userdata *u;
+
+ pa_assert_se(u = s->userdata);
+
+ if (pa_oss_get_volume(u->mixer_dsp_fd, &(u->source_mixext), &s->sample_spec, &s->real_volume) >= 0)
+ return;
+
+ pa_log_info(«Device doesn’t support reading mixer settings: %s», pa_cstrerror(errno));
+}
+
+static void source_set_volume(pa_source *s) {
+ struct userdata *u;
+
+ pa_assert_se(u = s->userdata);
+
+ if (pa_oss_set_volume(u->mixer_dsp_fd, &(u->source_mixext), &s->sample_spec, &s->real_volume) >= 0)
+ return;
+
+ pa_log_info(«Device doesn’t support writing mixer settings: %s», pa_cstrerror(errno));
+}
+
+#else
+
static void sink_get_volume(pa_sink *s) {
struct userdata *u;

@@ -880,6 +1049,7 @@ static void source_set_volume(pa_source

pa_log_info(«Device doesn’t support writing mixer settings: %s», pa_cstrerror(errno));
}
+#endif

static void thread_func(void *userdata) {
struct userdata *u = userdata;
@@ -1162,6 +1332,11 @@ finish:

int pa__init(pa_module*m) {

+#ifdef HAVE_OSSV4
+ struct oss_sysinfo si = { {0,}, };
+ struct oss_mixerinfo mi = { 0, };
+#endif
+
struct audio_buf_info info;
struct userdata *u = NULL;
const char *dev;
@@ -1259,7 +1434,9 @@ int pa__init(pa_module*m) {
m->userdata = u;
u->fd = fd;
u->mixer_fd = -1;
+#ifndef HAVE_OSSV4
u->mixer_devmask = 0;
+#endif
u->use_getospace = u->use_getispace = true;
u->use_getodelay = true;
u->mode = mode;
@@ -1426,6 +1603,194 @@ int pa__init(pa_module*m) {
if ((u->mixer_fd = pa_oss_open_mixer_for_device(u->device_name)) >= 0) {
bool do_close = true;

+#ifdef HAVE_OSSV4
+#define IGNORE_DEV 1
+ int i;
+
+ u->mixer_dsp_fd = -1;
+
+ if (ioctl (u->mixer_fd, SNDCTL_SYSINFO, &si) < 0) {
+ pa_log_debug («SNDCTL_SYSINFO failed»);
+ goto fail;
+ }
+ for (i = 0; i < si.nummixers; i++) { + mi.dev = i; + if (ioctl (u->mixer_fd, SNDCTL_MIXERINFO, &mi) < 0) {
+ pa_log_debug(«SNDCTL_MIXERINFO failed»);
+ goto fail;
+ }
+ if (mi.enabled != 0) {
+ /*
+ * There could be multiple mixers. First we only care about
+ * ones which are enabled. In any case we should not touch
+ * disabled mixers! But beyond that it may not be clear which
+ * one to use! There is a way to relate the card number to the
+ * device node name. But there does not seem to be a real good
+ * way to chose which one to use. So maybe an env. var. could
+ * be used to select a dsp device node name and then pick the
+ * correct mixer number. (See load_devices() in audioctl).
+ * This code now will always pick the first enabled mixer
+ * found. Which may be wrong for multiple mixers and/or sound
+ * cards. It may be possible/desirable to control all mixers
+ * found at the same time???
+ */
+ break;
+ }
+ }
+
+ if (i < si.nummixers) {
+ struct stat sbuf;
+
+ if ((stat(mi.devnode, &sbuf) != 0) ||
+ ((sbuf.st_mode & S_IFCHR) == 0)) {
+ pa_log(«Failed to get mixer dsp device.»);
+ i = si.nummixers;
+ }
+ }
+
+ if (i < si.nummixers && + (u->mixer_dsp_fd = pa_oss_open_mixer(mi.devnode)) >= 0) {
+
+ /* Will cause for loop to exit if not filled in by OSS */
+ u->mixer_cmax = -1;
+ if (ioctl(u->mixer_dsp_fd, SNDCTL_MIX_NREXT, &u->mixer_cmax) < 0) { + pa_log(«Failed to get max control.»); + goto fail; + } + + pa_log_debug («Opened mixer device %d with %d controls\n», + mi.dev, mi.nrext); + + u->mixer_sink_control = -1;
+ u->mixer_source_control = -1;
+
+ for (i=0; i < u->mixer_cmax; i++) {
+ memset (&(u->sink_mixext), 0, sizeof (oss_mixext));
+
+#ifdef IGNORE_DEV
+ /* This will cause dev to be ignored */
+ u->sink_mixext.dev = -1;
+#else
+ u->sink_mixext.dev = mi.dev;
+#endif
+
+ /*
+ * The real way to pick a control on a mixer is with this
+ * number. Note that control numbers are unique across all
+ * mixers. So dev can just be ignored. When dev is included
+ * it will only be used to check for correct dev from
+ * userland. But it will not be used to select a mixer.
+ */
+ u->sink_mixext.ctrl = i;
+
+ pa_log_debug («Control %d», u->sink_mixext.ctrl);
+
+ if (ioctl (u->mixer_dsp_fd, SNDCTL_MIX_EXTINFO,
+ &(u->sink_mixext)) < 0) { + pa_log_debug («SNDCTL_MIX_EXTINFO failed»); + continue; + } + + pa_log_debug (» name : %s», u->sink_mixext.extname);
+ pa_log_debug (» type : %s (%d)»,
+ mixer_ext_type_get_name (u->sink_mixext.type),
+ u->sink_mixext.type);
+ pa_log_debug (» maxval : %d», u->sink_mixext.maxvalue);
+ pa_log_debug (» parent : %d», u->sink_mixext.parent);
+ mixer_showflags (u->sink_mixext.flags);
+
+ if ((u->sink_mixext.flags & MIXF_PCMVOL)) {
+ pa_log_debug («First PCM control: %d», i);
+ u->mixer_sink_control = i;
+ break;
+ }
+
+ /*
+ * Note that MIXF_MAINVOL may not be an exclusive single
+ * control. For example on AudioHD there will be one for each
+ * output jack (Green, Black, Orange…). So to really do a
+ * master volume you would need to do all MIXF_MAINVOL at the
+ * same time…
+ */
+ if (((u->sink_mixext.flags & MIXF_MAINVOL)) &&
+ u->mixer_sink_control == -1) {
+ pa_log_debug («First main volume control: %d», i);
+ u->mixer_sink_control = i;
+ }
+ }
+
+ if (u->mixer_sink_control != -1) {
+ pa_log_debug («Setting OSS sink callbacks.»);
+ pa_sink_set_get_volume_callback(u->sink, sink_get_volume);
+ pa_sink_set_set_volume_callback(u->sink, sink_set_volume);
+ u->sink->n_volume_steps = 101;
+ do_close = FALSE;
+ } else {
+ pa_log_debug («Not setting OSS sink callbacks.»);
+ }
+
+ for (i=0; i < mi.nrext; i++) { + memset (&(u->source_mixext), 0, sizeof (oss_mixext));
+#ifdef IGNORE_DEV
+ /* This will cause dev to be ignored */
+ u->source_mixext.dev = -1;
+#else
+ u->source_mixext.dev = mi.dev;
+#endif
+ /*
+ * The real way to pick a control on a mixer is with this
+ * number. Note that control numbers are unique across all
+ * mixers. So dev can just be ignored. When dev is included
+ * it will only be used to check for correct dev from userland.
+ * But it will not be used to select a mixer.
+ */
+ u->source_mixext.ctrl = i;
+
+ pa_log_debug («Control %d», u->source_mixext.ctrl);
+
+ if (ioctl (u->mixer_dsp_fd, SNDCTL_MIX_EXTINFO,
+ &(u->source_mixext)) == -1) {
+ pa_log_debug («SNDCTL_MIX_EXTINFO failed»);
+ continue;
+ }
+
+ pa_log_debug (» name : %s», u->source_mixext.extname);
+ pa_log_debug (» type : %s (%d)»,
+ mixer_ext_type_get_name (u->source_mixext.type),
+ u->source_mixext.type);
+ pa_log_debug (» maxval : %d», u->source_mixext.maxvalue);
+ pa_log_debug (» parent : %d», u->source_mixext.parent);
+ mixer_showflags (u->source_mixext.flags);
+
+ /*
+ * There may be more then one MIXF_RECVOL on a mixer. In fact
+ * for audioHD the can be three (line-in, mix-in, and cd-in).
+ * For a master gain it may be good to adjust all…
+ */
+ if ((u->source_mixext.flags & MIXF_RECVOL)) {
+ pa_log_debug («First REC control: %d», i);
+ u->mixer_source_control = i;
+ break;
+ }
+ }
+
+ if (u->mixer_source_control != -1) {
+ pa_log_debug («Setting OSS source callbacks.»);
+ pa_source_set_get_volume_callback(u->source, source_get_volume);
+ pa_source_set_set_volume_callback(u->source, source_set_volume);
+ u->source->n_volume_steps = 101;
+ do_close = FALSE;
+ } else {
+ pa_log_debug («Not setting OSS source callbacks.»);
+ }
+
+ if (do_close == TRUE) {
+ pa_close(u->mixer_dsp_fd);
+ u->mixer_dsp_fd = -1;
+ }
+ }
+
+#else
if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &u->mixer_devmask) < 0) pa_log_warn(«SOUND_MIXER_READ_DEVMASK failed: %s», pa_cstrerror(errno)); else { @@ -1445,11 +1810,14 @@ int pa__init(pa_module*m) { do_close = false; } } +#endif if (do_close) { pa_close(u->mixer_fd);
u->mixer_fd = -1;
+#ifndef HAVE_OSSV4
u->mixer_devmask = 0;
+#endif
}
}

@@ -1568,6 +1936,10 @@ void pa__done(pa_module*m) {
if (u->fd >= 0)
pa_close(u->fd);

+#ifdef HAVE_OSSV4
+ if (u->mixer_dsp_fd >= 0)
+ pa_close(u->mixer_dsp_fd);
+#endif
if (u->mixer_fd >= 0)
pa_close(u->mixer_fd);

diff -rupN pulseaudio-5.99.3.old/src/modules/oss/oss-util.c pulseaudio-5.99.3/src/modules/oss/oss-util.c
— pulseaudio-5.99.3.old/src/modules/oss/oss-util.c 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/modules/oss/oss-util.c 2015-02-08 22:11:11.581982216 +0200
@@ -246,6 +246,190 @@ int pa_oss_set_fragments(int fd, int nfr
return 0;
}

+#ifdef HAVE_OSSV4
+static int
+oss4_mixer_slider_pack_volume (oss_mixext *mixext, int channels, const pa_cvolume *volume)
+{
+ int val = 0;
+ int lvol = 0;
+ int rvol = 0;
+ int lval = 0;
+ int rval = 0;
+
+ switch (mixext->type) {
+ case MIXT_MONOSLIDER:
+ case MIXT_MONOSLIDER16:
+ case MIXT_SLIDER:
+ lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
+ val = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
+ break;
+
+ case MIXT_STEREOSLIDER:
+ lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
+ lval = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
+ if (channels >= 2) {
+ rvol = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
+ rval = (rvol*mixext->maxvalue)/PA_VOLUME_NORM;
+ }
+
+ val = ((rval & 0xff) << 8) | (lval & 0xff); + break; + + case MIXT_STEREOSLIDER16: + lvol = volume->values[0] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[0];
+ lval = (lvol*mixext->maxvalue)/PA_VOLUME_NORM;
+ if (channels >= 2) {
+ rvol = volume->values[1] > PA_VOLUME_NORM ? PA_VOLUME_NORM : volume->values[1];
+ rval = (rvol*mixext->maxvalue)/PA_VOLUME_NORM;
+ }
+
+ val = ((rval & 0xffff) << 16) | (lval & 0xffff); + + break; + + default: + return 0; + } + + return val; +} + +static void +oss4_mixer_slider_unpack_volume (oss_mixext *mixext, int v, pa_cvolume * volume) +{ + uint32_t val, vol; + + val = (uint32_t) v; + switch (mixext->type) {
+ case MIXT_SLIDER:
+ vol = val;
+ volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ if (volume->channels >= 2) {
+ volume->values[1] = volume->values[0];
+ }
+ break;
+ case MIXT_MONOSLIDER:
+ /* oss repeats the value in the upper bits, as if it was stereo */
+ vol = val & 0x00ff;
+ volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ if (volume->channels >= 2) {
+ volume->values[1] = volume->values[0];
+ }
+ break;
+ case MIXT_MONOSLIDER16:
+ /* oss repeats the value in the upper bits, as if it was stereo */
+ vol = val & 0x0000ffff;
+ volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ if (volume->channels >= 2) {
+ volume->values[1] = volume->values[0];
+ }
+ break;
+ case MIXT_STEREOSLIDER:
+ vol = (val & 0x00ff);
+ volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ if (volume->channels >= 2) {
+ vol = (val & 0xff00) >> 8;
+ volume->values[1] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ }
+ break;
+ case MIXT_STEREOSLIDER16:
+ vol = (val & 0x0000ffff);
+ volume->values[0] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ if (volume->channels >= 2) {
+ vol = (val & 0xffff0000) >> 16;
+ volume->values[1] = PA_CLAMP_VOLUME((vol * PA_VOLUME_NORM) / mixext->maxvalue);
+ }
+ break;
+ default:
+ return;
+ }
+}
+
+static int
+oss4_mixer_get_control_val (int fd, oss_mixext *mixext, int *val)
+{
+ oss_mixer_value ossval = { 0, };
+
+ /* ossval.dev = mixext->dev; */
+ ossval.dev = -1; /* if -1 on entry then is ignored */
+ /*
+ * The real way to pick a control on a mixer is with this number.
+ * Note that control numbers are uniq across all mixers. So dev
+ * can just be ignored. When dev is included it will only be used
+ * to check for correct dev from userland. But it will not be used
+ * to select a mixer.
+ */
+ ossval.ctrl = mixext->ctrl;
+ ossval.timestamp = mixext->timestamp;
+
+ if (ioctl (fd, SNDCTL_MIX_READ, &ossval) == -1) {
+ pa_log_debug («SNDCTL_MIX_READ failed»);
+ *val = 0;
+ return -1;
+ }
+
+ *val = ossval.value;
+ pa_log_debug («got value 0x%08x from %s», *val, mixext->extname);
+ return 0;
+}
+
+static int
+oss4_mixer_set_control_val (int fd, oss_mixext *mixext, int val)
+{
+ oss_mixer_value ossval = { 0, };
+
+ /* ossval.dev = mixext->dev; */
+ ossval.dev = -1; /* if -1 on entry then is ignored */
+ /*
+ * The real way to pick a control on a mixer is with this number.
+ * Note that control numbers are uniq across all mixers. So dev
+ * can just be ignored. When dev is included it will only be used
+ * to check for correct dev from userland. But it will not be used
+ * to select a mixer.
+ */
+ ossval.ctrl = mixext->ctrl;
+ ossval.timestamp = mixext->timestamp;
+ ossval.value = val;
+
+ if (ioctl (fd, SNDCTL_MIX_WRITE, &ossval) == -1) {
+ pa_log_debug («SNDCTL_MIX_WRITE failed»);
+ return -1;
+ }
+
+ pa_log_debug («set value 0x%08x on %s», val, mixext->extname);
+ return 0;
+}
+
+int pa_oss_get_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, pa_cvolume *volume) {
+ int v = 0;
+
+ if (oss4_mixer_get_control_val (fd, mixext, &v) != 0) {
+ pa_log_debug («Getting volume failed»);
+ return -1;
+ }
+
+ pa_cvolume_reset(volume, ss->channels);
+
+ oss4_mixer_slider_unpack_volume (mixext, v, volume);
+
+ return 0;
+}
+
+int pa_oss_set_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, const pa_cvolume *volume) {
+ int val = 0;
+
+ val = oss4_mixer_slider_pack_volume (mixext, ss->channels, volume);
+
+ if (oss4_mixer_set_control_val (fd, mixext, val) != 0) {
+ pa_log_debug («Setting volume failed»);
+ return -1;
+ }
+
+ return 0;
+}
+
+#else
+
int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume) {
char cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
unsigned vol;
@@ -288,6 +472,7 @@ int pa_oss_set_volume(int fd, unsigned l
pa_log_debug(«Wrote mixer settings: %s», pa_cvolume_snprint(cv, sizeof(cv), volume));
return 0;
}
+#endif

static int get_device_number(const char *dev) {
const char *p, *e;
@@ -386,9 +571,11 @@ int pa_oss_get_hw_description(const char
return r;
}

-static int open_mixer(const char *mixer) {
+int pa_oss_open_mixer(const char *mixer) {
int fd;

+ pa_log_debug («Opening device %s», mixer);
+
if ((fd = pa_open_cloexec(mixer, O_RDWR|O_NDELAY, 0)) >= 0)
return fd;

@@ -400,19 +587,22 @@ int pa_oss_open_mixer_for_device(const c
char *fn;
int fd;

– if ((n = get_device_number(device)) < 0)
+ if ((n = get_device_number(device)) < 0) { + pa_log_debug («Cannot find device»); return -1; + } if (n == 0) – if ((fd = open_mixer(«/dev/mixer»)) >= 0)
+ if ((fd = pa_oss_open_mixer(«/dev/mixer»)) >= 0)
return fd;

fn = pa_sprintf_malloc(«/dev/mixer%i», n);
– fd = open_mixer(fn);
+ fd = pa_oss_open_mixer(fn);
pa_xfree(fn);

if (fd < 0)
pa_log_warn(«Failed to open mixer ‘%s’: %s», device, pa_cstrerror(errno));
+ else

return fd;
}
diff -rupN pulseaudio-5.99.3.old/src/modules/oss/oss-util.h pulseaudio-5.99.3/src/modules/oss/oss-util.h
— pulseaudio-5.99.3.old/src/modules/oss/oss-util.h 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/modules/oss/oss-util.h 2015-02-08 22:11:11.582249622 +0200
@@ -29,11 +29,21 @@ int pa_oss_auto_format(int fd, pa_sample

int pa_oss_set_fragments(int fd, int frags, int frag_size);

+#define HAVE_OSSV4
+
+#ifdef HAVE_OSSV4
+int pa_oss_set_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, const pa_cvolume *volume);
+int pa_oss_get_volume(int fd, oss_mixext *mixext, const pa_sample_spec *ss, pa_cvolume *volume);
+
+#else
+
int pa_oss_set_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, const pa_cvolume *volume);
int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_cvolume *volume);
+#endif

int pa_oss_get_hw_description(const char *dev, char *name, size_t l);

int pa_oss_open_mixer_for_device(const char *device);
+int pa_oss_open_mixer(const char *device);

#endif
diff -rupN pulseaudio-5.99.3.old/src/pulse/sample.h pulseaudio-5.99.3/src/pulse/sample.h
— pulseaudio-5.99.3.old/src/pulse/sample.h 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/pulse/sample.h 2015-02-08 22:11:11.582624201 +0200
@@ -121,7 +121,9 @@ PA_C_DECL_BEGIN
#if defined(__sparc__) && defined(_BIG_ENDIAN)
#define WORDS_BIGENDIAN
#endif

+#if defined(_BIG_ENDIAN)
+#define WORDS_BIGENDIAN
+#endif
#endif

/** Maximum number of allowed channels */
diff -rupN pulseaudio-5.99.3.old/src/pulsecore/core-scache.h pulseaudio-5.99.3/src/pulsecore/core-scache.h
— pulseaudio-5.99.3.old/src/pulsecore/core-scache.h 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/pulsecore/core-scache.h 2015-02-08 22:11:11.582922144 +0200
@@ -25,7 +25,6 @@
#include <pulsecore/memchunk.h> #include <pulsecore/sink.h>

-#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16)

typedef struct pa_scache_entry {
uint32_t index;
@@ -65,4 +64,5 @@ size_t pa_scache_total_size(pa_core *c);

void pa_scache_unload_unused(pa_core *c);

+#define PA_SCACHE_ENTRY_SIZE_MAX (1024*1024*16)
#endif
diff -rupN pulseaudio-5.99.3.old/src/pulsecore/shm.c pulseaudio-5.99.3/src/pulsecore/shm.c
— pulseaudio-5.99.3.old/src/pulsecore/shm.c 2015-01-21 16:16:53.000000000 +0200
+++ pulseaudio-5.99.3/src/pulsecore/shm.c 2015-02-08 22:11:11.583260666 +0200
@@ -371,8 +371,11 @@ int pa_shm_cleanup(void) {
if (strncmp(de->d_name, «pulse-shm-«, SHM_ID_LEN))
#endif
continue;

+#if defined(__sun)
+ if (pa_atou(de->d_name + 10, &id) < 0) +#else if (pa_atou(de->d_name + SHM_ID_LEN, &id) < 0)
+#endif
continue;

if (pa_shm_attach(&seg, id, false) < 0) diff -rupN pulseaudio-5.99.3.old/src/utils/padsp.c pulseaudio-5.99.3/src/utils/padsp.c — pulseaudio-5.99.3.old/src/utils/padsp.c 2015-01-21 16:16:53.000000000 +0200 +++ pulseaudio-5.99.3/src/utils/padsp.c 2015-02-08 22:17:07.921244432 +0200 @@ -2275,6 +2275,7 @@ static int dsp_ioctl(fd_info *i, unsigne break; } +#ifndef __sun case SOUND_PCM_READ_RATE: debug(DEBUG_LEVEL_NORMAL, __FILE__»: SOUND_PCM_READ_RATE\n»); @@ -2298,6 +2299,7 @@ static int dsp_ioctl(fd_info *i, unsigne *(int*) argp = pa_sample_size(&i->sample_spec)*8;
pa_threaded_mainloop_unlock(i->mainloop);
break;
+#endif

case SNDCTL_DSP_GETOPTR: {
count_info *info;
@@ -2368,7 +2370,7 @@ fail:
return ret;
}

-#ifdef sun
+#ifdef __sun
int ioctl(int fd, int request, …) {
#else
int ioctl(int fd, unsigned long request, …) {

Compiling OpenOffice4

Posted in Πληροφορική, OpenIndiana, OpenSolaris by asyropoulos on 5 Φεβρουαρίου, 2014

NOTE: The patches that are described below have been included in the source tree of OpenOffice and some of them in the source tree of LibreOffice. In all cases the patches have been included using the Apache License 2.0 and the corresponding license for LibreOffice.

 

Recently I tried to compile the latest version of OpenOffice4. Since I do not think SunStudio is worth the trouble, I decided tocompile using gcc and GNU ld. I have used gcc v. 4.8.2 and GNU ld (GNU Binutils) 2.24. Also, I have used Perl 5.16.3 and Java version «1.7.0_51». The following commands show what I did to configure the system:

$ export CONFIG_SHELL=/bin/bash
$ export LD_ALTEXEC=/opt/gnu/bin/gld 
$ PATH=/opt/gnu/ant/bin:/opt/gnu/perl5/5.16.3/bin:$PATH
$ export ANT_HOME=/opt/gnu/ant/
$ export JAVA_HOME=/usr/jdk/jdk1.7.0
$ autoconf
$ ./configure \\
   --with-dmake-url=http://dmake.apache-extras.org.codespot.com/files/dmake-4.12.tar.bz2\
   --with-epm-url=http://www.msweet.org/files/project2/epm-3.7-source.tar.gz --disable-odk\ 
   --with-lang="el en" \
   --with-junit=/extra/sources/OpenOffice/java/junit-4.11.jar --disable-randr \ 
   --enable-category-b --enable-pdfimport \
   --enable-wiki-publisher --with-dict=ALL  
   --with-build-version="Build by Apostolos Syropoulos" \
   --with-package-format="pkg" --with-jdk-home=/usr/jdk/jdk1.7.0\
   --without-stlport --with-system-libxml
$ ./bootstrap
$ source SolarisX86GccEnv.Set.sh
$ cd instsetoo_native
$ build --all

Note that it might be helpful to set the varible GNUMAKE in file SolarisX86GccEnv.Set.sh. Also, before starting to build you should make sure you have updated some of the makefiles. In particular, I had to modify the following files:

aoo4/main/solenv/gbuild/platform/solaris.mk
aoo4/main/solenv/inc/unxsogi.mk
aoo4/main/solenv/inc/tg_compv.mk

The last file should be modified as the following patch shows:

--- tg_compv.mk.old	Τετ Φεβ  5 18:25:31 2014
+++ tg_compv.mk	Παρ Ιαν 10 20:00:33 2014
@@ -28,7 +28,9 @@
 .IF "$(COMNAME)"=="" || "$(COMPATH:s!\!/!)"!="$(COMPATH_STORED)"
 .IF "$(L10N_framework)"==""

-COMNAME:=
+COM:=GCC
+COMNAME:=gcc3
+COMID=gcc3

 .IF "$(COM)"=="GCC"
 CFLAGSVERSION=-dumpversion
@@ -157,3 +159,5 @@

 .ENDIF			# "$(L10N_framework)"==""
 .ENDIF			# "$(COMNAME)"==""
+COMID=gcc3
+SHORTSTDCPP3="6"

This should be modified, at least in principle, by the configuration process but this is not something I have noticed. Now, the system has only one makefile for Solaris which is wrong! So I had to create one file based on the corresponding Linux makefile. Note that OpenOffice uses both dmake and GNUmake and the following file is used by GNUmake.

#File solaris.mk

GUI := UNX
COM := GCC

gb_MKTEMP := mktemp -t gbuild.XXXXXX

gb_CC := gcc
gb_CXX := g++
gb_GCCP := gcc
gb_AR := ar
gb_AWK := /usr/xpg4/bin/awk
gb_CLASSPATHSEP := :

# use CC/CXX if they are nondefaults
ifneq ($(origin CC),default)
gb_CC := $(CC)
gb_GCCP := $(CC)
endif
ifneq ($(origin CXX),default)
gb_CXX := $(CXX)
endif

gb_OSDEFS := \
	-D$(OS) \
	-D$(GUI) \
	-DSYSV \
	-DSUN \
	-DSUN4 \
	-D_REENTRANT \
	-D_POSIX_PTHREAD_SEMANTICS \
	-D_PTHREADS \
	-DUNIX \
	-DUXN \

ifeq ($(CPUNAME),INTEL)
gb_OSDEFS += -DINTEL

endif

ifeq ($(GXX_INCLUDE_PATH),)
GXX_INCLUDE_PATH=$(COMPATH)/include/c++/$(shell gcc -dumpversion)
endif

gb_COMPILERDEFS := \
	-D$(COM) \
	-DCPPU_ENV=gcc3 \
	-DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \

gb_CFLAGS := \
	-Wall \
	-Wendif-labels \
	-Wextra \
	-Wshadow \
	-fPIC \
	-fmessage-length=0 \
	-fno-common \
	-fno-strict-aliasing \
	-pipe \

gb_CXXFLAGS := \
	-Wall \
	-Wendif-labels \
	-Wextra \
	-Wno-ctor-dtor-privacy \
	-Wno-non-virtual-dtor \
	-Wshadow \
	-fPIC \
	-fmessage-length=0 \
	-fno-common \
	-fno-strict-aliasing \
	-fno-use-cxa-atexit \
	-pipe \

ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
gb_CFLAGS_WERROR := -Werror
gb_CXXFLAGS_WERROR := -Werror
endif

gb_LinkTarget_EXCEPTIONFLAGS := \
	-DEXCEPTIONS_ON \
	-fexceptions \
	-fno-enforce-eh-specs \

gb_LinkTarget_NOEXCEPTIONFLAGS := \
	-DEXCEPTIONS_OFF \
	-fno-exceptions \

gb_LinkTarget_LDFLAGS += \
	$(subst -L../lib , ,$(SOLARLIB)) \
	-w \
	-lpthread  \
	-Bdirect \
	-z defs \
	-z combreloc \

ifeq ($(gb_DEBUGLEVEL),2)
gb_COMPILEROPTFLAGS := -O0
else
gb_COMPILEROPTFLAGS := -Os
endif

gb_COMPILERNOOPTFLAGS := -O0

# Helper class

gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs)

# convert parametters filesystem root to native notation
# does some real work only on windows, make sure not to
# break the dummy implementations on unx*
define gb_Helper_convert_native
$(1)
endef

# CObject class

define gb_CObject__command
$(call gb_Output_announce,$(2),$(true),C  ,3)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	mkdir -p $(dir $(call gb_CObject_get_dep_target,$(2))) && \
	$(gb_CC) \
		$(DEFS) $(CFLAGS) \
		-c $(3) \
		-o $(1) \
		-MMD -MT $(call gb_CObject_get_target,$(2)) \
		-MF $(call gb_CObject_get_dep_target,$(2)) \
		-I$(dir $(3)) \
		$(INCLUDE))
endef

# CxxObject class

define gb_CxxObject__command
$(call gb_Output_announce,$(2),$(true),CXX,3)
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	mkdir -p $(dir $(call gb_CxxObject_get_dep_target,$(2))) && \
	$(gb_CXX) \
		$(DEFS) $(CXXFLAGS) \
		-c $(3) \
		-o $(1) \
		-MMD -MT $(call gb_CxxObject_get_target,$(2)) \
		-MF $(call gb_CxxObject_get_dep_target,$(2)) \
		-I$(dir $(3)) \
		$(INCLUDE_STL) $(INCLUDE))
endef

# LinkTarget class

define gb_LinkTarget__get_rpath_for_layer
$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS)))
endef

gb_LinkTarget__RPATHS := \
	URELIB:\dORIGIN \
	UREBIN:\dORIGIN/../lib:\dORIGIN \
	OOO:\dORIGIN:\dORIGIN/../ure-link/lib \
	BRAND:\dORIGIN:\dORIGIN/../basis-link/program:\dORIGIN/../basis-link/ure-link/lib \
	SDKBIN:\dORIGIN/../../ure-link/lib \
	NONEBIN:\dORIGIN/../lib:\dORIGIN \

gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)

ifeq ($(gb_DEBUGLEVEL),2)
gb_LinkTarget_CXXFLAGS += -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
gb_LinkTarget_CFLAGS += -ggdb3 -finline-limit=0 -fno-inline -fno-default-inline

endif

gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC)))
gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))

define gb_LinkTarget__command_dynamiclink
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_CXX) \
		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
		$(subst \d,$$,$(RPATH)) $(LDFLAGS) \
		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
		$(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \
		$(patsubst %,-l%,$(EXTERNAL_LIBS)) \
		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
		-o $(1))
endef

define gb_LinkTarget__command_staticlink
$(call gb_Helper_abbreviate_dirs,\
	mkdir -p $(dir $(1)) && \
	$(gb_AR) -rsu $(1) \
		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
		2> /dev/null)
endef

define gb_LinkTarget__command
$(call gb_Output_announce,$(2),$(true),LNK,4)
$(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1)))
$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1)))
endef

# Library class

gb_Library_DEFS :=
gb_Library_TARGETTYPEFLAGS := -shared -Wl,-z,noexecstack
gb_Library_SYSPRE := lib
gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_
gb_Library_PLAINEXT := .so
gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT)
ifeq ($(gb_PRODUCT),$(true))
gb_Library_STLEXT := port_gcc$(gb_Library_PLAINEXT)
else
gb_Library_STLEXT := port_gcc_stldebug$(gb_Library_PLAINEXT)
endif

ifeq ($(CPUNAME),X86_64)
gb_Library_OOOEXT := $(gb_Library_PLAINEXT)
gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
else
gb_Library_OOOEXT := $(gb_Library_PLAINEXT)
gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
endif

gb_STDLIBS := \
        m \
        c \

gb_Library_PLAINLIBS_NONE += \
	$(gb_STDLIBS) \
	dl \
	freetype \
	jpeg \
	pthread \
	X11 \
	Xext \
	SM \
	ICE \
	z \
	cppunit

gb_Library_FILENAMES := \
	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \

gb_Library_LAYER := \
	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):URELIB) \
	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \

define gb_Library_get_rpath
'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))'
endef

define gb_Library_Library_platform
$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1))

endef

# StaticLibrary class

gb_StaticLibrary_DEFS :=
gb_StaticLibrary_SYSPRE := lib
gb_StaticLibrary_PLAINEXT := .a
gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)

gb_StaticLibrary_FILENAMES := \
	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \

gb_StaticLibrary_StaticLibrary_platform =

# Executable class

gb_Executable_EXT :=

gb_Executable_LAYER := \
	$(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \
	$(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \
	$(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \
	$(foreach exe,$(gb_Executable_BRAND),$(exe):BRAND) \
	$(foreach exe,$(gb_Executable_NONE),$(exe):NONEBIN) \

define gb_Executable_get_rpath
'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))'
endef

define gb_Executable_Executable_platform
$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1))

endef

# CppunitTest class

gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
gb_CppunitTest_SYSPRE := libtest_
gb_CppunitTest_EXT := .so
gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
gb_CppunitTest_get_libfilename = $(gb_CppunitTest_get_filename)

define gb_CppunitTest_CppunitTest_platform
$(call gb_LinkTarget_get_target,$(2)) : RPATH :=

endef

# JunitTest class

define gb_JunitTest_JunitTest_platform
$(call gb_JunitTest_get_target,$(1)) : DEFS := \
	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/openoffice.org3/program/soffice}" \
    -Dorg.openoffice.test.arg.env=LD_LIBRARY_PATH \
    -Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \

endef

# SdiTarget class

gb_SdiTarget_SVIDLPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib

# SrsPartMergeTarget

gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib

# SrsPartTarget class

gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc
gb_SrsPartTarget_RSCCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)

define gb_SrsPartTarget__command_dep
$(call gb_Helper_abbreviate_dirs,\
	$(gb_GCCP) \
		-MM -MT $(call gb_SrsPartTarget_get_target,$(1)) \
		$(INCLUDE) \
		$(DEFS) \
		-c -x c++-header $(2) \
		-o $(call gb_SrsPartTarget_get_dep_target,$(1)))
endef

# ComponentTarget

gb_XSLTPROCPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
gb_Library_COMPONENTPREFIXES := \
    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \

The file that follows is used by dmake:

#File unxsogi.mk

# mk file for unxsogi
ASM=/opt/gnu/bin/gas
AFLAGS=
CDEFAULTOPT*=-O2

SOLAR_JAVA=TRUE
JAVAFLAGSDEBUG=-g

# _PTHREADS is needed for the stl
CDEFS+=-D_PTHREADS -D_REENTRANT -DSYSV -DSUN -DSUN4 -D_POSIX_PTHREAD_SEMANTICS -D_USE_NAMESPACE=1 

.IF "$(SOLAR_JAVA)"!=""
JAVADEF=-DSOLAR_JAVA
.IF "$(debug)"==""
JAVA_RUNTIME=-ljava
.ELSE
JAVA_RUNTIME=-ljava_g
.ENDIF
.ENDIF 

# architecture dependent flags for the C and C++ compiler that can be changed by
# exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
ARCH_FLAGS*=

CXX*=g++
CC*=gcc
CFLAGS=-c
CFLAGSCC= -pipe $(ARCH_FLAGS) 

CFLAGSEXCEPTIONS=-fexceptions
CFLAGS_NO_EXCEPTIONS=-fno-exceptions

CFLAGSCXX= -pipe $(ARCH_FLAGS) -Wno-ctor-dtor-privacy -fno-use-cxa-atexit
.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
CFLAGSCXX += -fvisibility-inlines-hidden
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"

PICSWITCH:=-fPIC

CFLAGSOBJGUIMT=
CFLAGSOBJCUIMT=
CFLAGSSLOGUIMT=$(PICSWITCH)
CFLAGSSLOCUIMT=$(PICSWITCH)
CFLAGSPROF=
CFLAGSDEBUG=-g
CFLAGSDBGUTIL=
CFLAGSOPT=-O2
CFLAGSNOOPT=
CFLAGSOUTOBJ=-o

STATIC		= -Wl,-Bstatic
DYNAMIC		= -Wl,-Bdynamic

LINK*=$(CXX)
LINKC*=$(CC)

LINKFLAGS=-lstdc++
LINKFLAGSAPPGUI=-Wl,-export-dynamic
LINKFLAGSSHLGUI=-shared
LINKFLAGSAPPCUI=-Wl,-export-dynamic
LINKFLAGSSHLCUI=-shared
LINKFLAGSTACK=
LINKFLAGSPROF=
LINKFLAGSOPT=

LINKFLAGS=
LINKFLAGSAPPGUI=
LINKFLAGSSHLGUI=-shared
LINKFLAGSAPPCUI=
LINKFLAGSSHLCUI=-shared
LINKFLAGSTACK=
LINKFLAGSPROF=
LINKFLAGSDEBUG=-ggdb3 -finline-limit=0 -fno-inline -fno-default-inline
LINKFLAGSOPT=
LINKFLAGSDEFS*=-Wl,-z,defs
LINKFLAGSRUNPATH_URELIB=-Wl,-rpath,\''$$ORIGIN'\'
LINKFLAGSRUNPATH_UREBIN=-Wl,-rpath,\''$$ORIGIN'\'
LINKFLAGSRUNPATH_OOO=-Wl,-rpath,\''$$ORIGIN'\'
LINKFLAGSRUNPATH_SDK=-Wl,-rpath,\''$$ORIGIN'\'
LINKFLAGSRUNPATH_BRAND=-Wl,-rpath,\''$$ORIGIN'\'
LINKFLAGSRUNPATH_OXT=
LINKFLAGSRUNPATH_BOXT=-Wl,-rpath,\''$$ORIGIN'\'
LINKFLAGSRUNPATH_NONE=
LINKFLAGS=-Wl,-z,combreloc $(LINKFLAGSDEFS)
#LINKVERSIONMAPFLAG=-M
LINKVERSIONMAPFLAG=
#LINKFLAGSNOEXSTK*=-Wl,-M,/usr/lib/ld/map.noexstk 
LINKFLAGSNOEXSTK*=-Wl,-z,noexecstack
LINKFLAGSAPPGUI+=$(LINKFLAGSNOEXSTK)
LINKFLAGSAPPCUI+=$(LINKFLAGSNOEXSTK)

# enable visibility define in "sal/types.h"
.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"

# Reihenfolge der libs NICHT egal!

STDLIBCPP=-lstdc++

STDOBJVCL=$(L)/salmain.o
STDOBJGUI=
STDSLOGUI=
STDOBJCUI=
STDSLOCUI=

# libraries for linking shared libraries
STDSHLGUIMT=$(DYNAMIC) -lpthread -lthread -lm
STDSHLCUIMT=$(DYNAMIC) -lpthread -lthread -lm

STDLIBGUIMT+=-lX11

LIBMGR=ar
LIBFLAGS=-r
# LIBEXT=.so

IMPLIB=
IMPLIBFLAGS=

MAPSYM=
MAPSYMFLAGS=

RC=irc
RCFLAGS=-fo$@ $(RCFILES)
RCLINK=
RCLINKFLAGS=
RCSETVERSION=

DLLPOSTFIX=
DLLPRE=lib
DLLPOST=.so

Note that initially the use of map files is diabled. Now we can start building OpenOffice. Below, I am copying the notes I kept while building.

================================================================================================
build --all:soltools

in file /extra/sources/OpenOffice./aoo4/main/soltools/mkdepend
change -lCstd to -stdc++
Make this change in all makefiles :-(

in file aoo4/main/soltools/adjustvisibility/adjustvisibility.cxx
add #include <string.h>
=================================================================================================
build --all:sal

Apply the following patches

--- sal/osl/unx/file.cxx.old	Πεμ Δεκ 26 19:00:55 2013
+++ sal/osl/unx/file.cxx	Πεμ Δεκ 26 19:01:22 2013
@@ -1092,7 +1092,7 @@
             OSL_TRACE(
                 "posix_madvise(..., POSIX_MADV_WILLNEED) failed with %d", e);
         }
-#elif defined SOLARIS
+#elif defined NOTSOLARIS
         if (madvise(static_cast(p), nLength, MADV_WILLNEED) != 0)
         {
             OSL_TRACE("madvise(..., MADV_WILLNEED) failed with %d", errno);

--- sal/osl/unx/util.c.old	Πεμ Δεκ 26 21:05:19 2013
+++ sal/osl/unx/util.c	Πεμ Δεκ 26 21:04:02 2013
@@ -313,7 +313,7 @@
 #endif

 #if    ( defined(__GNUC__) && (defined(X86) || defined(X86_64)) )\
-    || ( defined(SOLARIS) && defined (__SUNPRO_C)  && defined(__i386) )
+    || ( defined(SOLARIS) && ( defined (__SUNPRO_C) || defined(__GNUC__) ) && defined(__i386) )

 /* Safe default */
 int osl_isSingleCPU = 0;

Also, delete the information about a map file in sal/util/makefile.mk

==================================================================================================
build --all:salhelper

Delete info about map file in 

./main/salhelper/source/makefile.mk

===================================================================================================
build --all:store

Delete info about map file in 

./main/store/util//makefile.mk

===================================================================================================

build --all:registry

Delete the information about a map file in 

./main/registry/util/makefile.mk

=====================================================================================================================

build --all:openssl 

cd ./unxsogi.pro/misc/build/openssl-0.9.8o/. && Configure solaris-x86-gcc -I/usr/include -L/usr/lib shared && touch so_configured_openssl

Build and manually copy the shared library

These files are not UTF-8 encoded and so they don't compile:

/extra/sources/OpenOffice./aoo4/main/apache-commons/unxsogi.pro/misc/build/commons-httpclient-3.1/src/examples/ClientApp.java
/extra/sources/OpenOffice./aoo4/main/apache-commons/unxsogi.pro/misc/build/commons-httpclient-3.1/src/examples/TrivialApp.java

http://lists.freedesktop.org/archives/libreoffice/2013-June/053831.html

=====================================================================================================================

build --all:icu 

Apply the following patch to configure:

--- icu/unxsogi.pro/misc/build/icu/source/configure.old	Παρ Δεκ 27 15:38:13 2013
+++ icu/unxsogi.pro/misc/build/icu/source/configure	Παρ Δεκ 27 15:42:21 2013
@@ -2969,7 +2969,7 @@
             CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmi
ssing-prototypes -Wwrite-strings -Wno-long-long"
             case "${host}" in
             *-*-solaris*)
-                CFLAGS="$CFLAGS -D__STDC__=0";;
+                CFLAGS="$CFLAGS -std=c99 -D_XPG6 -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";;
             esac
         else
             case "${host}" in
@@ -2982,10 +2982,10 @@
         fi
         if test "$GXX" = yes
         then
-            CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long"
+            CXXFLAGS="$CXXFLAGS -std=c++11 -D_XPG6 -W -Wall -ansi -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long"
             case "${host}" in
             *-*-solaris*)
-                CXXFLAGS="$CXXFLAGS -D__STDC__=0";;
+                CXXFLAGS="$CXXFLAGS";;
             esac
         else
             case "${host}" in

Reconfigure with

./configure --enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no

and build using the build --all:icu command.

Also add #define _XPG6 to tools/ctestfw/unicode/uperf.h

======================================================================================================================
build --all:nss <--- 12/01/2014

Add NS_USE_GCC = 1 to nss-3.14.4/mozilla/security/coreconf/SunOS5.mk  

Add #include  to nss/unxsogi.pro/misc/build/nss-3.14.4/mozilla/nsprpub/pr/src/pthreads/ptio.c

Add #include  to nss/unxsogi.pro/misc/build/nss-3.14.4/mozilla/security/nss/lib/freebl/unix_rand.c

======================================================================================================================
build --all:libxmlsec 

First do:

cd /extra/sources/OpenOffice/aoo4/main/nss/unxsogi.pro/misc/build/nss-3.14.4/mozilla
mkdir -p /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/
mkdir -p /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/obsolete
mkdir -p /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nspr
cp ./security/nss/lib/nss/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./dist/out/include/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/util/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./nsprpub/pr/include/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./nsprpub/pr/include/obsolete/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/obsolete/.
cp ./nsprpub/pr/include/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./nsprpub/pr/include/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nspr/.
cp ./dist/out/include/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nspr/.
cp ./security/nss/lib/cryptohi/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/certdb/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/pkcs7/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/smime/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/pkcs12/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/freebl/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./security/nss/lib/freebl/ecl/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.
cp ./dist/public/nss/*.h /extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro/include/nss/.

Next do

$ cd /extra/sources/OpenOffice/aoo4/main/libxmlsec/unxsogi.pro/misc/build/xmlsec1-1.2.14
$ ./configure ADDCFLAGS= CPPFLAGS= --with-pic --disable-shared --disable-crypto-dl\
  --with-libxslt=no --with-gnutls=no LIBXML2LIB=-lxml2 --enable-pkgconfig=no \
  --with-openssl=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro \
  --with-nss=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro \
  --with-nspr=/extra/sources/OpenOffice/aoo4/main/solver/410/unxsogi.pro
$ cd ..
$ touch so_configured_so_xmlsec1

Now you can compile using build --all:libxmlsec

======================================================================================================================
build --all:cppu

delete all info about map files in

main/cppu/util/makefile.mk

======================================================================================================================
build --all:cppuhelper

delete all info about map files in

./main/cppuhelper/source/makefile.mk

======================================================================================================================
build --all:jvmfwk

delete all info about map files in

./main/jvmfwk/plugins/sunmajor/pluginlib/makefile.mk
./main/jvmfwk/source/makefile.mk

======================================================================================================================
build --all:eventattacher

delete all info about map files in

./main/eventattacher/source/makefile.mk 

======================================================================================================================
build --all:ucbhelper

delete all info about map files in

./main/ucbhelper/workben/myucp/makefile.mk

======================================================================================================================
build --all:comphelper

Apply the following patch

--- solver/410/unxsogi.pro/inc/comphelper/locale.hxx.old	Κυρ Δεκ 29 18:33:47 20
13
+++ solver/410/unxsogi.pro/inc/comphelper/locale.hxx	Κυρ Δεκ 29 18:34:33 2013
@@ -71,9 +71,11 @@
         static const Locale& DE_AT();
         static const Locale& AR();
         static const Locale& CA();
+#undef CS
         static const Locale& CS();
         static const Locale& DA();
         static const Locale& EL();
+#undef ES
         static const Locale& ES();
         static const Locale& FI();
         static const Locale& FR();

=========================================================================================================================

build --all:bridges

First apply the following patches

--- bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx.old	Δευ Δεκ 30 15:29:36 2013
+++ bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx	Δευ Δεκ 30 15:30:27 2013
@@ -26,6 +26,7 @@

 #include 
 #include 
+#include 
 #include 
 #include 

--- bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx.old	Δευ Ιαν 27 17:38:53 2014
+++ bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx	Δευ Ιαν 27 17:34:30 2014
@@ -45,12 +45,20 @@
 {

 //==================================================================================================
-static void callVirtualMethod(
+void callVirtualMethod(
     void * pAdjustedThisPtr,
     sal_Int32 nVtableIndex,
     void * pRegisterReturn,
     typelib_TypeClass eReturnType,
     sal_Int32 * pStackLongs,
+    sal_Int32 nStackLongs ) __attribute__((noinline));
+
+void callVirtualMethod(
+    void * pAdjustedThisPtr,
+    sal_Int32 nVtableIndex,
+    void * pRegisterReturn,
+    typelib_TypeClass eReturnType,
+    sal_Int32 * pStackLongs,
     sal_Int32 nStackLongs )
 {
 	// parameter list is mixed list of * and values
@@ -67,6 +75,13 @@
     void * stackptr;
 	asm volatile (
         "mov   %%esp, %6\n\t"
+       // preserve potential 128bit stack alignment
+        "and   $0xfffffff0, %%esp\n\t"
+        "mov   %0, %%eax\n\t"
+        "lea   -4(,%%eax,4), %%eax\n\t"
+        "and   $0xf, %%eax\n\t"
+        "sub   $0xc, %%eax\n\t"
+        "add   %%eax, %%esp\n\t"
 		// copy values
 		"mov   %0, %%eax\n\t"
 		"mov   %%eax, %%edx\n\t"

As previously delete all references to map files in the following files

./main/bridges/source/cpp_uno/gcc3_solaris_intel/makefile.mk
./main/bridges/source/jni_uno/makefile.mk

The following patch shows what I mean by deleting all references to map files:

--- bridges/source/cpp_uno/gcc3_solaris_intel/makefile.mk.old	Δευ Δεκ 30 15:32:39 20
13
+++ bridges/source/cpp_uno/gcc3_solaris_intel/makefile.mk	Δευ Δεκ 30 15:32:56 20
13
@@ -51,7 +51,7 @@

 SHL1DEF=$(MISC)$/$(SHL1TARGET).def
 SHL1IMPLIB=i$(TARGET)
-SHL1VERSIONMAP=..$/..$/bridge_exports.map
+SHL1VERSIONMAP=
 SHL1RPATH=URELIB

 SHL1OBJS = $(SLOFILES)

=========================================================================================================================build build --all:basebmp 

Apply the following patches:

--- basebmp/source/makefile.mk.old	Δευ Δεκ 30 15:46:47 2013
+++ basebmp/source/makefile.mk	Δευ Δεκ 30 15:47:28 2013
@@ -51,7 +51,7 @@

 # SunStudio 12 (-m64 and -m32 modes): three test cases of the unit tests fail 
 # if compiled with default -xalias_level (and optimization level -xO3)
-.IF "$(OS)"=="SOLARIS"
+.IF "$(OS)"=="SOLARIS" && "$(COM)"!="GCC"
 # For Sun Studio 8 this switch does not work: compilation fails on bitmapdevice.cxx
 .IF "$(CCNUMVER)"!="00050005"
 CDEFS+=-xalias_level=compatible

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

--- basebmp/test/makefile.mk.old	Δευ Δεκ 30 15:48:32 2013
+++ basebmp/test/makefile.mk	Δευ Δεκ 30 15:47:55 2013
@@ -56,7 +56,7 @@

 # SunStudio 12 (-m64 and -m32 modes): three test cases of the unit tests fail
 # if compiled with default -xalias_level (and optimization level -xO3)
-.IF "$(OS)"=="SOLARIS" 
+.IF "$(OS)"=="SOLARIS" && "$(COM)"!="GCC"
 # For Sun Studio 8 this switch does not work: compilation fails on bitmapdevice
.cxx
 .IF "$(CCNUMVER)"!="00050005"
 CDEFS+=-xalias_level=compatible

========================================================================================================================

build --all:hwpfilter

Delete all references to map files in file

./main/hwpfilter/source/makefile.mk

========================================================================================================================

build --all:io

Delete all references to map files in files

./main/io/source/stm/makefile.mk
./main/io/source/TextInputStream/makefile.mk
./main/io/source/TextOutputStream/makefile.mk
./main/io/source/connector/makefile.mk
./main/io/source/acceptor/makefile.mk

========================================================================================================================

build --all:stoc

Delete all references to map files in files

./main/stoc/source/javaloader/makefile.mk
./main/stoc/source/javavm/makefile.mk
./main/stoc/source/proxy_factory/makefile.mk
./main/stoc/source/corereflection/makefile.mk
./main/stoc/source/inspect/makefile.mk
./main/stoc/source/invocation/makefile.mk
./main/stoc/source/invocation_adapterfactory/makefile.mk
./main/stoc/source/namingservice/makefile.mk
./main/stoc/util/makefile.mk

=======================================================================================================================

build --all:javaunohelper

Delete all references to map files in file

./main/javaunohelper/source/makefile.mk

=======================================================================================================================

build --all:i18npool

Delete all references to map files in files

./main/i18npool/source/collator/data/makefile.mk
./main/i18npool/source/search/makefile.mk
./main/i18npool/source/textconversion/data/makefile.mk
./main/i18npool/source/localedata/data/makefile.mk
./main/i18npool/source/breakiterator/data/makefile.mk
./main/i18npool/source/indexentry/data/makefile.mk
./main/i18npool/util/makefile.mk

=========================================================================================================================

build --all:UnoControls

Delete all references to map files in file

./main/UnoControls/util/makefile.mk

==========================================================================================================================

build --all:dtrans

Delete all references to map files in files

./main/dtrans/source/generic/makefile.mk
./main/dtrans/util/makefile.mk

==========================================================================================================================

build --all:pyuno

Delete all references to map files in file

./main/pyuno/source/loader/makefile.mk

==========================================================================================================================

build --all:sccomp

Delete all references to map files in file

./main/sccomp/source/solver/makefile.mk

==========================================================================================================================

build --all:shell

Delete all references to map files in files

./main/shell/source/cmdmail/makefile.mk
./main/shell/source/unix/exec/makefile.mk
./main/shell/source/backends/localebe/makefile.mk
./main/shell/source/unix/sysshell/makefile.mk

==========================================================================================================================

build --all:xmlhelp  

Delete all references to map files in files

./main/xmlhelp/source/treeview/makefile.mk
./main/xmlhelp/util/makefile.mk 

==========================================================================================================================

build --all:sdext

Delete all references to map files in files

./main/sdext/source/presenter/makefile.mk
./main/sdext/source/minimizer/makefile.mk 

==========================================================================================================================

build --all:vcl 

--- vcl/unx/generic/app/saldisp.cxx.old	Τρι Δεκ 31 14:55:00 2013
+++ vcl/unx/generic/app/saldisp.cxx	Τρι Δεκ 31 15:39:24 2013
@@ -52,11 +52,11 @@
 #include 

 #include 
+#define USE_XINERAMA_XORG

 #ifdef USE_XINERAMA
 #ifdef USE_XINERAMA_XORG
 #include 
-#elif defined USE_XINERAMA_XSUN
 #if defined(SOLARIS) && defined(INTEL) // missing extension header in standard installation
 #define MAXFRAMEBUFFERS       16
 Bool XineramaGetState(Display*, int);

--- vcl/unx/generic/app/wmadaptor.cxx.old	Τρι Δεκ 31 15:46:14 2013
+++ vcl/unx/generic/app/wmadaptor.cxx	Τρι Δεκ 31 15:47:18 2013
@@ -1117,8 +1117,9 @@
         bOnce = false;
         XTextProperty aTestProp = { NULL, None, 0, 0 };
         const char *pText = "trustme";
+	 char* pT = const_cast(pText);
         XmbTextListToTextProperty( m_pDisplay,
-                                   &const_cast(pText),
+                                   &pT,
                                    1,
                                    XStdICCTextStyle,
                                    &aTestProp );

==========================================================================================================================

build --all:oox

--- oox/util/makefile.mk.old	Τρι Δεκ 31 18:46:43 2013
+++ oox/util/makefile.mk	Τρι Δεκ 31 18:47:15 2013
@@ -77,7 +77,7 @@
 .IF "$(SYSTEM_OPENSSL)"=="YES"
 SHL1STDLIBS+= $(OPENSSLLIB)
 .ELSE
-SHL1STDLIBS+= $(OPENSSLLIBST)
+SHL1STDLIBS+= $(OPENSSLLIB)
 .ENDIF
 .ENDIF # WNT

==========================================================================================================================

build --all:accessibility

Delete all references to map files in file

./main/accessibility/util/makefile.mk

==========================================================================================================================

build --all:fpicker

Delete all references to map files in files

./main/fpicker/source/generic/makefile.mk
./main/fpicker/source/office/makefile.mk
./main/fpicker/source/unx/gnome/makefile.mk

==========================================================================================================================

build --all:uui

Delete all references to map files in file

./main/uui/util/makefile.mk

==========================================================================================================================

build --all:canvas

Delete all references to map files in files

./main/canvas/source/factory/makefile.mk
./main/canvas/source/simplecanvas/makefile.mk
./main/canvas/source/null/makefile.mk
./main/canvas/source/vcl/makefile.mk

===========================================================================================================================

build --all:scaddins

Delete all references to map files in files

./main/scaddins/source/datefunc/makefile.mk
./main/scaddins/source/analysis/makefile.mk

===========================================================================================================================

build --all:fileaccess

Delete all references to map files in file

./main/fileaccess/source/makefile.mk

===========================================================================================================================

build --all:slideshow

Delete all references to map files in file

./main/slideshow/util/makefile.mk

===========================================================================================================================

build --all:connectivity <------ 17/01/2014

First apply the following patch

--- connectivity/source/drivers/odbcbase/ODriver.cxx.old	Τετ Ιαν  1 18:23:20 2014
+++ connectivity/source/drivers/odbcbase/ODriver.cxx	Τετ Ιαν  1 18:24:08 2014
@@ -68,7 +68,7 @@
 		// this name is referenced in the configuration and in the odbc.xml
 		// Please take care when changing it.
 }
-
+#undef SS
 typedef Sequence SS;
 //------------------------------------------------------------------------------
 SS ODBCDriver::getSupportedServiceNames_Static(  ) throw (RuntimeException)

And now delete all references to map files in files

./main/connectivity/source/drivers/mysql/makefile.mk
./main/connectivity/source/manager/makefile.mk
./main/connectivity/source/drivers/jdbc/makefile.mk
./main/connectivity/source/drivers/hsqldb/makefile.mk
./main/connectivity/source/drivers/dbase/makefile.mk
./main/connectivity/source/drivers/calc/makefile.mk
./main/connectivity/source/drivers/flat/makefile.mk
./main/connectivity/source/drivers/adabas/makefile.mk
./main/connectivity/source/drivers/odbc/makefile.mk
./main/connectivity/source/cpool/makefile.mk

===========================================================================================================================

build --all:svx  <-- This is not valid with the current build!

In file 

/extra/sources/OpenOffice./aoo4/main/svx/source/form/formcontroller.cxx

use compat_functional.hxx from LibreOffice!
http://docs.libreoffice.org/o3tl/html/compat__functional_8hxx_source.html

===========================================================================================================================

build --all:basctl

Delete all references to map files in file

./main/basctl/util/makefile.mk

===========================================================================================================================

build --all:forms

Delete all references to map files in file

./main/forms/util/makefile.mk

===========================================================================================================================

build --all:extensions

Delete all references to map files in files

./main/extensions/source/logging/makefile.mk
./main/extensions/source/dbpilots/makefile.mk
./main/extensions/source/abpilot/makefile.mk
./main/extensions/source/update/feed/makefile.mk
./main/extensions/source/oooimprovecore/makefile.mk
./main/extensions/source/bibliography/makefile.mk
./main/extensions/source/oooimprovement/makefile.mk
./main/extensions/source/xmlextract/makefile.mk
./main/extensions/source/update/check/makefile.mk 
./main/extensions/source/propctrlr/makefile.mk
./main/extensions/source/update/ui/makefile.mk
./main/extensions/source/resource/makefile.mk
./main/extensions/source/scanner/makefile.mk
./main/extensions/source/preload/makefile.mk

===========================================================================================================================

build --all:cui

Delete all references to map files in file

./main/cui/util/makefile.mk

===========================================================================================================================

build --all:starmath

Delete all references to map files in file

./main/starmath/util/makefile.mk

==================================================================================================

build --all:filter

Delete all references to map files in files

./main/filter/source/graphicfilter/ipbm/makefile.mk
./main/filter/source/graphicfilter/eras/makefile.mk
./main/filter/source/graphicfilter/itga/makefile.mk
./main/filter/source/graphicfilter/itiff/makefile.mk
./main/filter/source/graphicfilter/ipcd/makefile.mk
./main/filter/source/msfilter/powerpoint/makefile.mk
./main/filter/source/graphicfilter/ios2met/makefile.mk
./main/filter/source/xmlfilteradaptor/makefile.mk
./main/filter/source/placeware/makefile.mk
./main/filter/source/graphicfilter/egif/makefile.mk
./main/filter/source/config/cache/makefile.mk
./main/filter/source/t602/makefile.mk
./main/filter/source/svg/makefile.mk
./main/filter/source/pdf/makefile.mk
./main/filter/source/graphicfilter/ipsd/makefile.mk
./main/filter/source/xsltfilter/makefile.mk
./main/filter/source/graphicfilter/idxf/makefile.mk
./main/filter/source/graphicfilter/epbm/makefile.mk
./main/filter/source/graphicfilter/ipict/makefile.mk
./main/filter/source/graphicfilter/expm/makefile.mk
./main/filter/source/graphicfilter/epgm/makefile.mk
./main/filter/source/graphicfilter/ieps/makefile.mk
./main/filter/source/graphicfilter/iras/makefile.mk
./main/filter/source/graphicfilter/etiff/makefile.mk
./main/filter/source/graphicfilter/eppm/makefile.mk
./main/filter/source/flash/makefile.mk
./main/filter/source/graphicfilter/eps/makefile.mk
./main/filter/source/graphicfilter/ipcx/makefile.mk
./main/filter/source/xmlfilterdetect/makefile.mk
./main/filter/source/graphicfilter/eos2met/makefile.mk
./main/filter/source/graphicfilter/epict/makefile.mk
./main/filter/source/graphicfilter/icgm/makefile.mk

=========================================================================================================================

build --all:sd

Delete all references to map files in file

./main/sd/util/makefile.mk

=========================================================================================================================

build --all:desktop 

Delete all references to map files in files

./main/desktop/test/deployment/active/makefile.mk
./main/desktop/test/deployment/boxt/makefile.mk
./main/desktop/source/so_comp/makefile.mk
./main/desktop/source/deployment/gui/makefile.mk
./main/desktop/source/migration/services/makefile.mk
./main/desktop/source/app/makefile.mk
./main/desktop/source/splash/makefile.mk
./main/desktop/test/deployment/passive/makefile.mk
./main/desktop/source/deployment/makefile.mk
./main/desktop/source/offacc/makefile.mk
./main/desktop/source/pkgchk/unopkg/makefile.mk

========================================================================================================================

build --all:chart2

Delete all references to map files in files

./main/chart2/source/controller/makefile.mk
./main/chart2/source/model/makefile.mk

=======================================================================================================================

build --all:sc      

Delete all references to map files in files

./main/sc/addin/rot13/makefile.mk
./main/sc/util/makefile.mk

=======================================================================================================================

build --all:scripting

Delete all references to map files in files

./main/scripting/source/dlgprov/makefile.mk
./main/scripting/source/vbaevents/makefile.mk
./main/scripting/source/basprov/makefile.mk
./main/scripting/source/stringresource/makefile.mk

========================================================================================================================

build --all:writerfilter

Delete all references to map files in file

./main/writerfilter/util/makefile.mk

========================================================================================================================

build --all:dbaccess   

Delete all references to map files in files

./main/dbaccess/source/ext/macromigration/makefile.mk
./main/dbaccess/source/ext/adabas/makefile.mk
./main/dbaccess/util/makefile.mk
./main/dbaccess/source/filter/xml/makefile.mk 

========================================================================================================================

build --all:reportdesign

Delete all references to map files in file

./main/reportdesign/util/makefile.mk

=======================================================================================================================

build --all:xmlsecurity

In the following files the one has to fix the inclusion of nss related header files:

./aoo4/main/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
./aoo4/main/solver/410/unxsogi.pro/inc/external/xmlsec/nss/app.h
./aoo4/main/solver/410/unxsogi.pro/inc/external/xmlsec/nss/tokens.h
./aoo4/main/solver/410/unxsogi.pro/inc/external/xmlsec/nss/akmngr.h
./aoo4/main/solver/410/unxsogi.pro/inc/external/xmlsec/nss/crypto.h
./aoo4/main/solver/410/unxsogi.pro/inc/external/xmlsec/nss/x509.h
./aoo4/main/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
./aoo4/main/xmlsecurity/source/xmlsec/nss/secerror.cxx

Also, delete all references to map files in file

./main/xmlsecurity/util/makefile.mk

=======================================================================================================================

build --all:remotebridges

Delete all references to map files in file

./main/remotebridges/source/unourl_resolver/makefile.mk

=======================================================================================================================

build --all:testtools 

Delete all references to map files in file

./main/testtools/source/bridgetest/makefile.mk

=======================================================================================================================
build --all:lingucomponent

Delete all references to map files in files

./main/lingucomponent/source/thesaurus/libnth/makefile.mk
./main/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/makefile.mk
./main/lingucomponent/source/languageguessing/makefile.mk
./main/lingucomponent/source/spellcheck/spell/makefile.mk

======================================================================================================================
build --all:ucb  

Delete all references to map files in files

./main/ucb/source/ucp/hierarchy/makefile.mk
./main/ucb/source/sorter/makefile.mk
./main/ucb/source/ucp/webdav/makefile.mk
./main/ucb/source/ucp/package/makefile.mk
./main/ucb/source/ucp/gvfs/makefile.mk
./main/ucb/source/core/makefile.mk
./main/ucb/source/cacher/makefile.mk
./main/ucb/source/ucp/ext/makefile.mk
./main/ucb/source/ucp/tdoc/makefile.mk
./main/ucb/source/ucp/expand/makefile.mk
./main/ucb/source/ucp/file/makefile.mk
./main/ucb/source/ucp/ftp/makefile.mk

Also make the following change in file ./main/ucb/source/ucp/webdav/makefile.mk

.IF "$(SYSTEM_OPENSSL)" == "YES"
CFLAGS+= -I$(OPENSSL_CFLAGS)
SHL1STDLIBS+= $(OPENSSLLIB)
.ELSE
SHL1STDLIBS+= $(OPENSSLLIBST) <----------
.ENDIF

to

.IF "$(SYSTEM_OPENSSL)" == "YES"
CFLAGS+= -I$(OPENSSL_CFLAGS)
SHL1STDLIBS+= $(OPENSSLLIB)
.ELSE
SHL1STDLIBS+= $(OPENSSLLIB)  <-----------
.ENDIF

Before the last step make sure you set LD_LIBRARY_PATH to the absolute path leading to /main/solver/410/unxsogi.pro/lib/. That’s all.

How to format USB flash drives with FAT32

Posted in OpenIndiana, OpenSolaris by asyropoulos on 20 Δεκεμβρίου, 2010

First find the device name that corresponds to the USB flash drive:

# rmformat
Looking for devices...
1. Logical Node: /dev/rdsk/c0t0d0p0
Physical Node: /pci@0,0/pci1458,5004@13,2/storage@1/disk@0,0
Connected Device: Kingston DataTraveler 2.0 6.16
Device Type: Removable
Bus: USB
Size: 979,0 MB
Label: <None>
Access permissions: Medium is not write protected.
2. Logical Node: /dev/rdsk/c13t1d0p0
Physical Node: /pci@0,0/pci1458,b002@11/cdrom@1,0
Connected Device: TSSTcorp CDDVDW SH-S203D  SB01
Device Type: DVD Reader/Writer
Bus: <Unknown>
Size: <Unknown>
Label: <Unknown>
Access permissions: <Unknown>

Second create a FAT32 partition using the following command:

fdisk /dev/rdsk/c0t0d0p0

Finally, construct the file system using the following command:

mkfs -F pcfs -o fat=32,b=apostolos /dev/rdsk/c0t0d0p0:c

Here what follows the b= part will become the name of the disk.

Disabling IIIMF

Posted in OpenIndiana, OpenSolaris by asyropoulos on 23 Οκτωβρίου, 2010

OpenSolaris and the current version of OpenIndiana uses IIIMF (Internet Intranet Input Method Framework). Unfortunately, this tool does not function properly in OpenIndiana especially when Greek is the basic language. If one wants to get reed of IIIMF, then there are a number of things that must be done:

  1. Disable IIIMF from the System ▸ Preferences  ▸ Startup Applications Preferences.
  2. Create file /etc/hal/fdi/policy/10-x11-input.fdi that roughly contains the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <deviceinfo version="0.2">
    <device>
    <match key="info.capabilities" contains="input.keys">
    <merge key="input.x11_options.XkbRules" type="string">base</merge>
    <merge key="input.x11_options.XkbLayout" type="string">us,gr</merge>
    <merge key="input.x11_options.XkbVariant" type="string">,polytonic</merge>
    <merge key="input.x11_options.XkbOptions"
     type="string">grp:alt_shift_toggle,terminate:ctrl_alt_bksp,kpdl:comma</merge>
    </match>
    </device>
    </deviceinfo>
  3. Replace file /usr/share/X11/locale/el_GR.UTF-8/Compose and file /usr/share/X11/locale/en_US.UTF-8/Compose with the actual Xorg Compose files from http://cgit.freedesktop.org/xorg/lib/libX11/ In particular, download the latest libX11 source and find the corresponding files in folder nls. Note that this folder contains files named Compose.pre. These files are not directly usable. One needs to «translate» all XCOMM strings to #s.
  4. Reboot your system and you are ready!

OpenSolaris: Compiling FFmpeg for 64-bit

Posted in OpenSolaris by asyropoulos on 25 Ιουνίου, 2010

Compiling the SVN version of FFmpeg for 64-bit is not difficult, but one must a little bit careful. First of all, one needs to compile x264, xvid, and libnut  among others. In all cases, one must ensure that the libraries are compiled with the -fPIC -DPIC swicthes (even SunStudio recognizes these switches). For some reason, it is necessary to produce position-independent code (PIC)  and these switches ensure this. Once these additional libraries have been installed in the proper folders (e.g., /usr/local/lib/amd64), we need to compile FFmpeg. In order to configure, I have used the following command:

CFLAGS="-m64 -I/opt/gnu/include" \
LDFLAGS="-m64 -L/opt/gnu/lib/amd64 -R/opt/gnu/lib/amd64" \
./configure --prefix=/opt/gnu --bindir=/opt/gnu/bin/amd64
--shlibdir=/opt/gnu/lib/amd64 --libdir=/opt/gnu/lib/amd64 --enable-libopencore-amrnb\
--enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame  --enable-libnut \
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264  --enable-libxvid \
--enable-zlib --enable-bzlib  --cc=cc --enable-pic --enable-shared --enable-version3 \
--enable-gpl --enable-nonfree --enable-x11grab  --disable-mmx --enable-postproc \
--extra-cflags="-fPIC -DPIC" --enable-pthreads

Note that here cc is Sun C 5.11 SunOS_i386 Aten 2010/05/10 , that is, the latest version of the SunStudio. The configuration process generates a number of files but two of them must be modified.  First, file config.h must be modified using the following patch:

--- config.h.orig	Παρ Ιουν 25 23:26:05 2010
+++ config.h	Τετ Ιουν 23 17:03:05 2010
@@ -28,7 +28,7 @@
 #define ARCH_SPARC 0
 #define ARCH_SPARC64 0
 #define ARCH_TOMI 0
-#define ARCH_X861
+#define ARCH_X86 0
 #define ARCH_X86_32 0
 #define ARCH_X86_64 1
 #define HAVE_ALTIVEC 0
@@ -45,7 +45,7 @@
 #define HAVE_NEON 0
 #define HAVE_PPC4XX 0
 #define HAVE_SSE 0
-#define HAVE_SSSE3 0
+#define HAVE_SSSE3 1
 #define HAVE_VIS 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_PTHREADS 1

Also, file config.mak must be modified using the following patch:

--- config.mak.orig	Παρ Ιουν 25 23:34:57 2010
+++ config.mak	Τετ Ιουν 23 17:02:47 2010
@@ -12,7 +12,7 @@
 SRC_PATH="/opt/sources/BACKUP/MPLAYER/ffmpeg"
 SRC_PATH_BARE=/opt/sources/BACKUP/MPLAYER/ffmpeg
 BUILD_ROOT="/opt/sources/BACKUP/MPLAYER/ffmpeg"
-ARCH=x86
+ARCH=x86_64
 CC=cc
 AS=cc
 LD=cc
@@ -30,7 +30,7 @@
 CC_O=-o $@
 LDFLAGS= -m64 -L/opt/gnu/lib/amd64 -R/opt/gnu/lib/amd64
 FFSERVERLDFLAGS=
-SHFLAGS=-mimpure-text -shared -Wl,-h,$$(@F)
+SHFLAGS=-shared -Wl,-h,$$(@F)
 YASMFLAGS=-f elf -DARCH_X86_64 -m amd64 -DPIC -g dwarf2
 BUILDSUF=
 FULLNAME=$(NAME)$(BUILDSUF)

Once these steps have been taken, compilation should complete with no errors.

OpenSolaris: Compiling clisp-2.48 for 64bit

Posted in OpenSolaris by asyropoulos on 19 Απριλίου, 2010

Compiling clisp-2.48 for 64bit OpenSolaris is a little bit tricky.


$ mkdir clisp; cd clisp
$ clisp_basedir=`pwd`
$ clisp_toolsdir=$clisp_basedir/clisp-tools
$ clisp_builddir=$clisp_basedir/clisp-build
$ mkdir $clisp_toolsdir

Now download libsigsegv and ffcal and unpack the archives and proceed:


$ cd libsigsegv-2.8   
$ CC="gcc-4.3.2 -m64" ./configure \
   --prefix=$clisp_toolsdir && make && \
   make check &&  make install
$ cd $clisp_basedir
$ cd ffcall-1.10
$ CC="gcc-4.3.2 -m64" ./configure \
  --build=x86_64-pc-solaris2.11 \
  --prefix=$clisp_toolsdir && \
  make && make check && \
  make install
$ cd $clisp_basedir
$ cd clisp-2.48
$ CC="gcc-4.3.2 -m64" \
  CFLAGS="-I/tmp/clisp/clisp-tools/include" \
  LDFLAGS="-L/tmp/clisp/clisp-tools/lib 
-R/tmp/clisp/clisp-tools/lib"  ./configure \ 
  --with-ffcall --with-libffcall-prefix=$clisp_toolsdir \
  --with-libsigsegv-prefix=$clisp_toolsdir --disable-mmap \
  --without-readline $clisp_builddir && \
cd $clisp_builddir && make

At some point it the compilation process stops because two symbols are undefined. However, these symbols are defined in libgnu.a. For some strange reason even if one adds the name of the library in the Makefile, the compiler fails to find the library. For this reason, I had to do the following dirty trick:


$ cd boot
$ mkdir foo
$ cp lisp.a lisp.a.orig
$ mv lisp.a foo/.
$ cp ../gllib/.libs/libgnu.a foo/.
$ cd foo
$ for lib in *.a; do ar x $lib; done
$ ar cr ../lisp.a *.o
$ ranlib ../lisp.a
$ cd ..
$ rm -rf foo
$ cd ..
$ make

Now the compilation of clisp completes succesfully! Note that the same trick should be applied even when compiling for 32bit OpenSolaris.

OpenSolaris: Backing up DVDs

Posted in OpenSolaris by asyropoulos on 18 Απριλίου, 2010

I buy a lot of DVDs since I do prefer to watch moview and TV shows on my TV set. However, I prefer not to view the original DVDs in order to keep them with no scratches. To do this I need to back up them. For this I use vobcopy (you can get binaries from www.sunfreepacks.com) and DVDShrink (this is not the official site of the software!) with wine. Once you have installed vobcopy and wine, you can install DVDShrink by entering the command

$wine dvdshrink32setup.exe

Here is what you should do in order to «rip» a DVD:

  1. Insert your DVD to your DVD drive and enter the comand:
    $ vobcopy -i /media/NAME_OF_DVD -I

    to see  that vobcopy works.

  2. «Rip» the DVD with the command
    $vobcopy -i /media/NAME_OF_DVD -m -o /destination/folder
  3. Start up DVDShrink and choose the /destination/folder and create shrinked copy of the DVD.
  4. Burn the resulting image (I assume you have asked DVDShrink to create a DVD image file).

That’s all!

PS It is now possible to use backlite, a Qt only version of k9copy. The packages (i.e., backlite and Qt)  will be available from sunfreepacks really soon.

OpenSolaris/OpenIndiana: Installing legacy nVIDIA drivers

Posted in OpenSolaris by asyropoulos on 18 Απριλίου, 2010

Here are the steps one must follow in order to install the legacy nVIDIA drivers in a system with an old nVIDIA card but a very recent version of OpenSolaris:


$ pfexec beadm list
$ pfexec beadm create osol-134-nvidia
$ pfexec beadm mount osol-134-nvidia /mnt
$ pfexec pkg -R /mnt uninstall -r driver/graphics/nvidia

When using a recent version of OpenIndiana, the last command of the previous list of commands must be replaced with the command


$ pfexec pkg uninstall driver/graphics/nvidia xorg-video

The commands that follow complete the installation of the legacy driver.


$ pfexec /bin/sh NVIDIA-Solaris-x86-96.43.16.run --extract-only
$ cd NVIDIA-Solaris-x86-96.43.16
$ pfexec pkgadd -R /mnt -d . NVDAgraphics NVDAgraphicsr
$ pfexec bootadm update-archive -R /mnt
$ pfexec beadm unmount -f osol-134-nvidia
$ pfexec beadm activate osol-134-nvidia
$ pfexec reboot -p

Note that the version of the legacy driver depends on one’s hardware.

Compiling Mono on OpenSolaris

Posted in OpenSolaris by asyropoulos on 19 Φεβρουαρίου, 2010

Compiling mono on OpenSolaris is not a straightforward task so I have decided to explain what one has to do in order to compile it. The «recipe» is based on the following explanation.

https://bugzilla.novell.com/show_bug.cgi?id=353874

In order to build mono I have used gcc-4.3.2, which is part of package developer/gcc/gcc-432. First of all, one needs to build  libgdiplus-x.y. After uncompressing the source code, enter the following  commands to build this library.:

CC=gcc-4.3.2 ./configure --prefix=/opt/mono
make


If you prefer a different installation folder, you should use this alternative folder in the --prefix=
Now download and uncompress mono-2.x.y.tar.bz2 Inside the source tree create a file which must contain the following:

ulimit -Hs $((10*1024))
#
prctl -s -t basic -n process.max-stack-size -v 8MB $$
prctl -s -t privileged -n process.max-stack-size -v 128MB $$
#
CC=gcc-4.3.2 CXX=g++-4.3.2 CFLAGS="-I/opt/mono/include" \
LDFLAGS="-L/opt/mono/lib -R/opt/mono" \
./configure --prefix=/opt/mono  --with-jit=yes \
--with-large-heap=yes --with-tls=pthread
#
gmake

Then execute this script and it will build mono.  In the installation phase it might be necessary to create a similar script. Next we need to build mono-basic-x.y.tar.bz2. As in the previous case, download and uncompress the source and inside the source tree create another script that will contain the following lines:

ulimit -Hs $((10*1024))
#
prctl -s -t basic -n process.max-stack-size -v 8MB $$
prctl -s -t privileged -n process.max-stack-size -v 128MB $$
PATH=/opt/mono/bin:$PATH
CC=gcc-4.3.2 CXX=g++-4.3.2 CFLAGS="-I/opt/mono/include" \
LDFLAGS="-L/opt/mono/lib -R/opt/mono/lib" ./configure --prefix=/opt/mono-2.6.1
#
gmake

One should be able to build gnome-sharp-x.y.z, gtk-sharp-x.y.z, and gnome-desktop-sharp-x.y.z. with similar scripts. That’s all.

The latest version of mono (i.e., version 2.10.1) compiles far more easily than the previous versions. I have managed to produce binaries for the i386-pc-solaris2.11 and   x86_64-pc-solaris2.11 platforms with essentially the same recipe. First of all, download the Boehm-Demers-Weiser conservative garbage collector and installed in the folder where you will install mono (e.g., /opt/mono). Then make sure you have the various binaries from the GNU-tool-chain. For the i386-pc-solaris2.11 platform you can used the following command to configure compilation:

CFLAGS="-I/opt/mono-2.10.1/include" \
LDFLAGS="-L/opt/mono/lib -R/opt/mono/lib" \
./configure   --prefix=/opt/mono --disable-dtrace \
--with-gc=boehm --with-sigaltstack=no

When configuration finishes, you need to edit file mono/profiler/Makefile. In particular, you need to modify the -D_FILE_OFFSET_BITS=64 preprocessor flag (see the CPPFLAGS section) and make it -D_FILE_OFFSET_BITS=32. Now, you can build mono. For the x86_64-pc-solaris2.11 you can used the following command:

CC=x86_64-pc-solaris2.11-gcc CXX=x86_64-pc-solaris2.11-g++  \
CFLAGS="-I/opt/mono/include" LDFLAGS="-m64 -L/opt/mono/lib -R/opt/mono/lib" \
./configure --with-gc=boehm --prefix=/opt/mono --disable-dtrace --with-sigaltstack=no

Here x86_64-pc-solaris2.11-gcc and x86_64-pc-solaris2.11-g++ are scripts that call the correspodning compiler in 64-bit more. For example, the contents of x86_64-pc-solaris2.11-gcc follow:

#! /bin/bash
exec /usr/bin/gcc -m64 "$@"

Building the other components is very easy! In fact, I have compiled pinta and the following scree-shot shows how it works in my system.