pd-externals / flite

Speech synthesis for Pd
GNU General Public License v2.0
13 stars 3 forks source link

build for MSW #4

Closed umlaeute closed 2 months ago

umlaeute commented 1 year ago

@Lucarda used to patch the flite-sources to allow for the windows builds.

now I have incorporated all of lucardas changes except for the bundled (and patched) libflite, I would like to investigate why the patch was needed in the first place (and if there's a fix that could be upstreamed)

Lucarda commented 1 year ago

IIRC __declspec(dllexport) needs to be out. if it is there the pd functions don't get exported in the dll and the object won't load.

umlaeute commented 1 year ago

i've submitted a fix for upstream: https://github.com/festvox/flite/issues/84

umlaeute commented 1 year ago

@lucarda: could you test whether my ugly hack in https://github.com/pd-externals/flite/commit/9af1e1693c858e927b8814eca873eacae5bd26bc allows you to build (and use) the external on Windows?

(it appears to be working when running a cross-compiled external under wine)

Lucarda commented 1 year ago

yes it works here.

NOTE: i got:

<command-line>: warning: "__declspec" redefined
<built-in>: note: this is the location of the previous definition

on almost all .c files. every message stops compilation for 3 or 4 sec. But yeah, it works :)

umlaeute commented 1 year ago

cool that it works. bad that it has such a performance penalty at compile-time.

the other option would be to just patch the upstream-sources on the fly (possibly as part of the build-process), by running the following cmd:

sed -e 's|\(#define GLOBALVARDEF\) __declspec(dllexport)|\1|' -i deps/flite/include/flite.h deps/flite/src/synth/flite.c

(we could just put that into a script in extra/ and mention it in the README)

what do you think?

Lucarda commented 1 year ago

the other option would be to just patch the upstream-sources on the fly

the other day I had come to something similar https://github.com/Lucarda/pd-hidraw/issues/2

I think the penalty is not so bad as the flite files are build just one time. If you edit the pd-flite.c all the .o files are ready and compiling is fast (from what I remember).

I think the hack is more simple but I leave this decision to you.

Lucarda commented 1 year ago

I'm totally glad that flite comes back to its original repo here. It was in my plans but i did't want to bother.

I think once this is settled I'll delete my repo. Here is the best place. :)

umlaeute commented 1 year ago

i was going to suggest to make you maintainer of this here repo, so you can keep doing your good work :-)

Lucarda commented 1 year ago

Good.

I don't have anything on the list for pd-flite but yes add me as maintainer.

Lucarda commented 1 year ago

Reopening for myself:

When I find time I'll try this right before flite_setup:

#if defined(_WIN32)
__declspec(dllexport)
#else
__attribute__((visibility("default")))
#endif
void flite_setup(void) {

To avoid hack:

https://github.com/pd-externals/flite/blob/85f47ba8be83d83e0d4520a7e673cef2512a9e5c/Makefile#L27