gcc: Introduce -fhardened

2023-09-17 Thread Brian Inglis via Cygwin-apps

Hi folks,

Should we consider if we could or should update our build options before gcc 14?

https://gcc.gnu.org/pipermail/gcc-patches/2023-September/630550.html

--
Take care. Thanks, Brian Inglis  Calgary, Alberta, Canada

La perfection est atteinte   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry


Re: cygport cygautoreconf failure with AC_CONFIG_MACRO_DIRS

2023-09-17 Thread Jon Turney via Cygwin-apps

On 09/08/2023 23:44, Brian Inglis via Cygwin-apps wrote:

On 2023-08-09 15:55, Jon Turney via Cygwin-apps wrote:

[...]


That leaves the second part of your patch.  I'm not sure if you're 
claiming this is the same problem, a similar problem, or a different 
problem.


That adds cygport cygautoreconf support for a newer AC_CONFIG_MACRO_DIRS 
macro to existing support for the older AC_CONFIG_MACRO_DIR macro.


Thanks.

I applied this part.

I also adjusted the similar uses of AC_CONFIG_MACRO_DIR in gnome2, mate 
and xfce4 cygclasses.


To be hyper-correct, I guess that perhaps the regex expression to use 
here is 'S?' rather than 'S*', but that doesn't seem important.




Re: cygport may not create debug info if top directory contains a symlink

2023-09-17 Thread Brian Inglis via Cygwin-apps

On 2023-09-17 08:01, Jon Turney via Cygwin-apps wrote:

On 16/09/2023 15:17, Christian Franke via Cygwin wrote:

Found during tests of busybox package:
If the path of the top build directory contains a symlink and the project's 
build scripts normalize pathnames, no debug info is created by cygport.


This is because options like
  -fdebug-prefix-map=${B}=/usr/src/debug/${PF}
have no effect because ${B} contains a symlink but the compiler is run with 
the real source path.


I think that there was some historical bug with gcc where a relative path for 
the old path in this mapping wasn't correctly handled, which is why were using 
an absolute path here at all.


So changing it to something like [1] (if that works), might be better.

[1] 
https://github.com/jon-turney/cygport/commit/4175d456a9184c5cdebd8bfb4b5ba30583cedd66


Sidenote: we should probably also be using file-prefix-map, now we're on a gcc 
which supports it.


The postinstall code then does not find any line number info with source path 
/usr/src/debug/${PF}/...


Could be fixed easily in line 414 of /bin/cygport:

-declare -r top=$(cd ${_topdir}; pwd);
+declare -r top=$(cd ${_topdir}; /bin/pwd);


Can you explain why this makes a difference?


In cygport, pwd is a bash builtin defaulting to -L; /bin/pwd defaults to -P.
Both commands support both options and we might expect the same output.
It would be better to use builtin `pwd -P` if that produces the correct result.
An STC script which creates test dirs to demonstrate the issue and show the 
alternative outputs would be nice so anyone can see.


No patch provided because I'm not sure whether this has other negative side 
effects.


If this is the case, it possibly makes sense to print a warning if "$(pwd)" != 
"$(/bin/pwd)".


This is not unreasonable, and I would take a patch doing this, as there have 
been places in cygport where there are bugs handling that in the past (and 
probably still are some, since it's not something that gets tested often).


--
Take care. Thanks, Brian Inglis  Calgary, Alberta, Canada

La perfection est atteinte   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry


Re: cygport may not create debug info if top directory contains a symlink

2023-09-17 Thread Jon Turney via Cygwin-apps

On 16/09/2023 15:17, Christian Franke via Cygwin wrote:

Found during tests of busybox package:
If the path of the top build directory contains a symlink and the 
project's build scripts normalize pathnames, no debug info is created by 
cygport.


This is because options like
  -fdebug-prefix-map=${B}=/usr/src/debug/${PF}
have no effect because ${B} contains a symlink but the compiler is run 
with the real source path.


I think that there was some historical bug with gcc where a relative 
path for the old path in this mapping wasn't correctly handled, which is 
why were using an absolute path here at all.


So changing it to something like [1] (if that works), might be better.

[1] 
https://github.com/jon-turney/cygport/commit/4175d456a9184c5cdebd8bfb4b5ba30583cedd66


Sidenote: we should probably also be using file-prefix-map, now we're on 
a gcc which supports it.


The postinstall code then does not find any line number info with source 
path /usr/src/debug/${PF}/...


Could be fixed easily in line 414 of /bin/cygport:

-declare -r top=$(cd ${_topdir}; pwd);
+declare -r top=$(cd ${_topdir}; /bin/pwd);


Can you explain why this makes a difference?

No patch provided because I'm not sure whether this has other negative 
side effects.


If this is the case, it possibly makes sense to print a warning if 
"$(pwd)" != "$(/bin/pwd)".


This is not unreasonable, and I would take a patch doing this, as there 
have been places in cygport where there are bugs handling that in the 
past (and probably still are some, since it's not something that gets 
tested often).




[ITA} fluidsynth

2023-09-17 Thread Takashi Yano via Cygwin-apps
I'd like adopt the fluidsynth package.
Thanks in advance.

-- 
Takashi Yano 
inherit cmake

NAME="fluidsynth"
VERSION=2.3.2
RELEASE=1
LICENSE="LGPL-2.1-or-later"
CATEGORY="Audio"
SUMMARY="SoundFont software synthesizer"
DESCRIPTION="FluidSynth is a real-time software synthesizer based on the
SoundFont 2 specifications."
HOMEPAGE="http://www.fluidsynth.org/";
SRC_URI="https://github.com/FluidSynth/fluidsynth/archive/v${VERSION}/fluidsynth-${VERSION}.tar.gz";

PKG_NAMES="${NAME} lib${NAME}3 lib${NAME}-devel"
fluidsynth_CONTENTS="usr/bin/*.exe usr/share/"
libfluidsynth3_CATEGORY="Libs"
libfluidsynth3_SUMMARY="${SUMMARY} library"
libfluidsynth3_CONTENTS="usr/bin/cygfluidsynth-3.dll"
libfluidsynth_devel_CATEGORY="Libs"
libfluidsynth_devel_SUMMARY="${SUMMARY} library"
libfluidsynth_devel_CONTENTS="
usr/include/fluidsynth*
usr/lib/libfluidsynth.dll.a
usr/lib/pkgconfig/fluidsynth.pc
"

PKG_IGNORE="usr/lib/cmake/fluidsynth/*.cmake"

# dbus: only for RealtimeKit
# portaudio: playback is just static
CYGCMAKE_ARGS="
-Denable-dbus=OFF
-Denable-midishare=OFF
-Denable-portaudio=ON
"
--- origsrc/fluidsynth-2.3.2/src/drivers/fluid_dsound.c 2023-04-03 
00:54:17.0 +0900
+++ src/fluidsynth-2.3.2/src/drivers/fluid_dsound.c 2023-09-16 
00:02:53.038824600 +0900
@@ -28,6 +28,7 @@
 #if DSOUND_SUPPORT
 
 
+#include 
 #include 
 #include 
 #include 
--- origsrc/fluidsynth-2.3.2/src/drivers/fluid_oss.c2023-04-03 
00:54:17.0 +0900
+++ src/fluidsynth-2.3.2/src/drivers/fluid_oss.c2023-09-16 
12:35:49.965676900 +0900
@@ -109,6 +109,22 @@ fluid_oss_audio_driver_settings(fluid_se
 fluid_settings_register_str(settings, "audio.oss.device", "/dev/dsp", 0);
 }
 
+#ifdef __CYGWIN__
+#include 
+static int get_cygwin_version(void);
+static int cygwin_version;
+static int get_cygwin_version(void)
+{
+int cygwin_version = 3004006;
+char *ver = (char *) (intptr_t) cygwin_internal(CW_GETVERSIONINFO);
+int major, minor;
+if (2 == sscanf(ver, "%*s\n%% Cygwin dll major: %d\n"
+"%% Cygwin dll minor: %d", &major, &minor))
+cygwin_version = major * 1000 + minor;
+return cygwin_version;
+}
+#endif
+
 /*
  * new_fluid_oss_audio_driver
  */
@@ -133,6 +149,10 @@ new_fluid_oss_audio_driver(fluid_setting
 return NULL;
 }
 
+#ifdef __CYGWIN__
+cygwin_version = get_cygwin_version();
+#endif
+
 FLUID_MEMSET(dev, 0, sizeof(fluid_oss_audio_driver_t));
 
 fluid_settings_getint(settings, "audio.periods", &periods);
@@ -306,6 +326,10 @@ new_fluid_oss_audio_driver2(fluid_settin
 return NULL;
 }
 
+#ifdef __CYGWIN
+cygwin_version = get_cygwin_version();
+#endif
+
 FLUID_MEMSET(dev, 0, sizeof(fluid_oss_audio_driver_t));
 
 fluid_settings_getint(settings, "audio.periods", &periods);
@@ -540,6 +572,19 @@ fluid_oss_audio_run(void *d)
 {
 dev->read(synth, len, buffer, 0, 2, buffer, 1, 2);
 
+#ifdef __CYGWIN__
+for (;;)
+{
+audio_buf_info info;
+ioctl(dev->dspfd, SNDCTL_DSP_GETOSPACE, &info);
+/* Reduce latency in cygwin before 3.5.0. */
+if (cygwin_version < 3005000)
+info.bytes -= info.fragsize * (info.fragstotal - 4);
+if (info.bytes >= dev->buffer_byte_size)
+break;
+usleep(100);
+}
+#endif
 if(write(dev->dspfd, buffer, dev->buffer_byte_size) < 0)
 {
 FLUID_LOG(FLUID_ERR, "Error writing to OSS sound device: %s",
--- origsrc/fluidsynth-2.3.2/src/drivers/fluid_winmidi.c2023-04-03 
00:54:17.0 +0900
+++ src/fluidsynth-2.3.2/src/drivers/fluid_winmidi.c2023-09-16 
00:02:53.038824600 +0900
@@ -75,6 +75,8 @@
 #include "fluid_midi.h"
 #include "fluid_mdriver.h"
 #include "fluid_settings.h"
+#include 
+#include 
 
 #define MIDI_SYSEX_MAX_SIZE 512
 #define MIDI_SYSEX_BUF_COUNT16
--- origsrc/fluidsynth-2.3.2/src/fluidsynth.c   2023-04-03 00:54:17.0 
+0900
+++ src/fluidsynth-2.3.2/src/fluidsynth.c   2023-09-16 00:02:53.038824600 
+0900
@@ -39,6 +39,7 @@
 #endif
 
 #if SDL2_SUPPORT
+#define SDL_MAIN_HANDLED 1
 #include 
 #endif
 
--- origsrc/fluidsynth-2.3.2/src/utils/fluid_sys.h  2023-04-03 
00:54:17.0 +0900
+++ src/fluidsynth-2.3.2/src/utils/fluid_sys.h  2023-09-16 00:02:53.048837900 
+0900
@@ -137,6 +137,7 @@ typedef gintptr  intptr_t;
  */
 #if defined(__CYGWIN__) && HAVE_WINDOWS_H
 #include 
+#undef __MINGW64_VERSION_MAJOR
 #include 
 #endif
 
--- origsrc/fluidsynth-2.3.2/src/utils/fluidsynth_priv.h2023-04-03 
00:54:17.0 +0900
+++ src/fluidsynth-2.3.2/src/utils/fluidsynth_priv.h2023-09-16 
00:02:53.048837900 +0900
@@ -45,6 +45,11 @@
 #include 
 #endif
 
+#ifdef __CYGWIN__
+#define DSOUND_SUPPORT 1
+#define WINMIDI_SUPPORT 1
+#endif
+
 
 #include "fluidsynth.h"
 


[ITA] lv2

2023-09-17 Thread Takashi Yano via Cygwin-apps
I'd like to adopt the lv2 package.
Thanks in advance.

-- 
Takashi Yano 
inherit meson

NAME="lv2"
VERSION=1.18.10
RELEASE=1
LICENSE="ISC"
CATEGORY="Audio"
SUMMARY="LV2 audio plugin specification"
DESCRIPTION="LV2 is a portable plugin standard for audio systems, similar in
scope to LADSPA, VST, AU, and others. It defines a C API for code and a format
for data files which collectively describe a plugin. LV2 consists of a simple
core (roughly equivalent in power to LADSPA) which can be extended to support
more advanced functionality. This allows the interface to be grown to
accommodate the needs of real software as they arise."
HOMEPAGE="http://lv2plug.in/";
SRC_URI="https://lv2plug.in/spec/lv2-${VERSION}.tar.xz";

PKG_NAMES="lv2 lv2-devel lv2-examples"
lv2_OBSOLETES="lv2core"
lv2_DOCS="usr/share/doc/"
lv2_CONTENTS="--exclude=eg-*.lv2 etc/ usr/lib/lv2/"
lv2_devel_REQUIRES="lv2"
lv2_devel_CONTENTS="usr/bin/lv2specgen.py usr/bin/lv2_validate
usr/include/lv2* usr/lib/pkgconfig/ usr/share/lv2specgen/"
lv2_examples_SUMMARY="Sample LV2 audio plugins"
lv2_examples_DOCS="plugins/README.txt"
lv2_examples_CONTENTS="--exclude=*.dll.a usr/lib/lv2/eg-*.lv2/"

PKG_IGNORE="usr/lib/lv2/eg-*/*.dll.a"

CYGMESON_ARGS="
-D docs=enabled
-D old_headers=true
-D tests=disabled
"

src_install() {
   cd ${S}
   meson_install
   doenv LV2_PATH "/usr/lib/lv2"
}

BUILD_REQUIRES="python39-rdflib python39-markdown python39-importlib-metadata"