FreeBSD Port

• Aug 28, 2010 - 19:42

Hi,

I'm pretty new to musescore, but I've always wanted a good open source music notation software. I could run it on linux, or windows of course (where have some years of experience with Sibelius), but I'd like to use it on FreeBSD, which I use for most work. I would like to contribute in some way to this really fascinating project, but as a first step I'm trying to port it. I'm new to porting applications as well, but I have enough experience in programming to do it, and I know the FreeBSD ports system good enough, so this could of some use to other people.
The FreeBSD ports collection is a collection of patches that are automatically applied to the source distributions during installation of a port - when installing the sources via /usr/ports, which means compiling and stuff, the other way is to install a precompiled package via pkg_add.
So, the philosophy of the ports-system in FreeBSD is - seperate the bsd-specific adjustments to the code from the original sources, so newer versions can - in the best case - be adopted only updating the link to the source-tarball and version numbers in port description files.

I have managed to compile mscore (as for now without alsa, jack and stuff, but it works), and had to hack my way through some incompatibilities. So I have to decide, how to make things working automatically.

First question is: I had to pass some additional parameters to the compiler and linker, e.g. -I/usr/local/include/stuff and -L/usr/local/lib/morestuff. Where do I put these, I'm not really a good at CMake, and I'm not sure if I get things right.

Next is, I could write a patch for CMakeLists.txt, which deletes the lines I don't need, as the ALSA-stuff, or would it be possible to put "if (FREEBSD)"-regions (when I got all this stuff working) to the file and merge it into the repository at some time? this would be much more comfortable wich new versions.

If I do that: how is the OS determined? the cmake-FAQ says:
> How can I find out platforms definitions, search paths, etc. from gcc ?
> The following is really the best if not only way to get information about predefined macros with a GNU compiler:
> $ touch empty.c
> $ gcc -v -dD -E empty.c

Is this what I'm looking for? (I want some FREEBSD-variable defined as there is APPLE, MINGW, and so on)

And do i get this correct: the CPUS-variable in the top-level specifies only the number of make-instances running in parallel, it doesn't affect the code being generated?

I noticed on the forums, there is someone ho tried porting mscore to FreeBSD already, does anybody know more about this?

There still is the log2-issue, I'm not sure why it's not supported, but I found a fast_log2() somewhere in the code and wondered what it's good for. Any help about C++-standards, and which of them have what functions, which others do not, would be appreciated - the patching in fact would be very simple in this case, but maybe I'm missing something.

That would be all for now,
I hope this is the right forum for it,
Best regards,
Friedemann


Comments

You could try
IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") to compile for freeBSD only. Somehow it could be better to make several things optional with boolean such as BUILD_ALSA, BUILD_JACK etc... and have a patch or sed command to put the boolean to the right value. See what have been done for the qt bindings.

The CPU in the Makefile is only used to setup the -j settings of make. So only to speed up the compilation process.

You might have more luck with your technical questions on the developer mailing list or on IRC. See [[nodetitle:Development]] .

I built successfully both of the unstable version and release version at r4003, after some changes.

Here're some points:

  1. At the release version (1.0), two source calls log2() math function which is supplied by glibc.
    (This function is also called on the unstable version much more.) FreeBSD libc doesn't have it,
    so I add log2() function to those files with an cheap macro like as:
    #ifndef __GLIBC__
    #define log2(x) (log((x))/log(2.0))
    #endif
    

    (2011-03-19) This change is not needed on the 9-current and the 8.2-stable versions of FreeBSD, since its
    bundled libraries supports log2() and log2f().

  2. As Friedemann indicates, the Advanced Linux Sound Architecture is not universal system among Qt's
    territory. On the CMakeFiles.txt, I think it is better to set the filtering term where the operating system
    is determined using 'if (APPLE OR MINGW OR NOT LINUX).'
  3. Some Qt commands are renamed by adding suffix '-qt4' on FreeBSD in order to distinguish from Qt3
    commands. Please use QT_LRELEASE_EXECUTABLE and QT_LUPDATE_EXECUTABLE, then
    they cover such differences.
  4. The path of Freetype header files is specified -I/usr/include/freetype2, but usually it should be
    -I/usr/local/include/freetype2 on FreeBSD. Perhaps find_package(Freetype REQUIRED) command
    and include_directories(${FREETYPE_INCLUDE_DIRS}) function of CMake may help.
  5. At the unstable version, libdl.so is linked into mscore, but it is not needed on FreeBSD because
    all functions of it are supplied by libc and libdl.so does not exist. Perhaps replacing 'dl' with
    ${CMAKE_DL_LIBS} may help this problem.
  6. At the unstable version, mscore/aeolus/aeolus/global.h causes failure of building around endian.h.
    I'm sorry I don't know whether this issue is common on all BSD family. Useful signature may be
    __FreeBSD__ or Q_OS_BSD4. Redifinition of terms are required so that
    single prefixing underscore can be accepted like as:
    #define __BYTE_ORDER _BYTE_ORDER
    
  7. At the unstable version, building on mscore/poppler/goo/goofile.cc fails without declaration of time_t
    type which is defined in sys/types.h header. Please set inclusion this header file at this cc file or
    goo/gtypes.h.

Almost chages I made above are stored in attached patch files.
release version and unstable version.
I found other problems on CMake system but I cannot resolve them with my few knowledge about CMake:

  • At mscore/mscore of both version, building some sources with Zip class fails on loading
    wrong zip.h file that is stored in /usr/local/include and ignores to find osdabzip/zip.h.
  • At mscore/mscore and sfont/sfconvert of unstable version, loading
    libsndfile.so, libvorbis.so, libogg.so, and
    libpoppler.so fails because their path -L/usr/local/lib is not set.
Attachment Size
4003.patch 3.01 KB
3999.patch 5.15 KB

Do you still have an unanswered question? Please log in first to post your question.