Skip to content

wrong version into meson build file #475

Open

Description

@bioinfornatics

Dear the meson build file have to be updated to match the same tag.
Currently it is 0.20.0 while the file contains 0.10.4

maybe you would have to add a unit test to check automatically

Activity

  1. WebFreak001 commented on Nov 8, 2022

    @WebFreak001
    Member

    do you use the meson build file? Do you maybe have an example project how it's used? Maybe we can also use it in the CI pipeline.

  2. bioinfornatics commented on Nov 13, 2022

    @bioinfornatics
    ContributorAuthor

    Actually I use it order to get all dependencies of DCD, thus I have created the spec below to make rpms

    file: dlang-libdparse.spec

    # debug info seem not works with D compiler
    #%%global debug_package %%{nil}
    
    %global major_version 0
    %global minor_version 20
    %global patch_version 0
    #%%global pre beta
    %global base_name libdparse
    
    Name:           dlang-libdparse
    Version:        %{major_version}.%{minor_version}.%{patch_version}
    Release:        %autorelease
    Summary:        Library for lexing and parsing D source code
    Summary(fr):    Bibliothèque pour l'analyse syntaxique et grammaticale de code source D
    License:        Boost
    URL:            https://github.com/dlang-community/libdparse
    Source0:        https://github.com/dlang-community/libdparse/archive/v%{version}%{?pre:-%{pre}}/%{name}-%{version}%{?pre:-%{pre}}.tar.gz
    
    # ISSUE: https://github.com/dlang-community/libdparse/pull/257
    #Patch0:         https://patch-diff.githubusercontent.com/raw/dlang-community/libdparse/pull/257.patch#/0001-Add-Meson-build-definition.patch
    
    ExclusiveArch:  %{ldc_arches}
    
    BuildRequires:  ldc meson dlang-libstdx-allocator-devel
    Requires:       ldc-libs dlang-libstdx-allocator
    
    %description
    Library for lexing and parsing D source code.
    
    %description -l fr
    Bibliothèque pour l'analyse syntaxique et grammaticale de code source en D.
    
    %package        devel
    Summary:        Development files for %{name}
    Summary(fr):    Fichiers de développement pour %{name}
    Requires:       %{name}%{?_isa} = %{version}-%{release}
    Requires:       dlang-libstdx-allocator-devel
    
    %description devel
    libdparse package contains header files for developing D applications
    that use libdparse.
    
    %description devel -l fr
    Le paquet libdparse contient les fichiers d'entêtes pour développer
    des applications en D utilisant libdparse.
    
    
    %package geany-tags
    Summary:        Support for enable autocompletion in geany
    Summary(fr):    Support pour activer l'auto-complétion dans geany
    Requires:       %{name} = %{version}-%{release}
    BuildArch:      noarch
    BuildRequires:  geany
    Requires:       geany
    
    %description geany-tags
    Enable autocompletion for dsymbol library in geany (IDE)
    
    %description -l fr geany-tags
    Active l'autocompletion pour pour la bibliothèque dsymbol dans geany (IDE)
    
    %prep
    %autosetup -n %{base_name}-%{version}%{?pre:-%{pre}}
    # temp geany config directory for allow geany to generate tags
    mkdir geany_config
    
    sed -i "4 s/version: '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*'/version: '%{version}'/" meson.build
    
    %build
    
    export DFLAGS="%{_d_optflags}"
    LDFLAGS='-Wl,-z,relro -Wl,-z,now' %meson
    %meson_build
    
    # generate doc
    src_dir='src'
    sources=$(find "${src_dir}" -name '*.d')
    for f in ${sources[@]}; do
        d_path=$(dirname ${f});
        d_file=$(basename ${f});
        doc_file=doc-src/${d_path/${src_dir}}/${d_file/.d/.html};
        ldc2 -I %{_includedir}/d/stdx-allocator -I "${src_dir}" -o- -c $f -Df "${doc_file}" doc-src/index.ddoc doc-src/macros.ddoc;
    done
    mv doc-src html
    
    # generate geany tags
    headers=$(find src -name '*.d')
    geany -c geany_config -g %{base_name}.d.tags ${headers[@]}
    
    
    %install
    %meson_install
    
    # geany tags
    mkdir -p %{buildroot}%{_datadir}/geany/tags/
    install -pm0644 %{base_name}.d.tags %{buildroot}/%{_datadir}/geany/tags/
    
    %ldconfig_scriptlets
    
    %files
    %license LICENSE_1_0.txt
    %doc README.md
    %{_libdir}/%{base_name}.so.%{version}
    %{_libdir}/%{base_name}.so.%{major_version}
    
    %files devel
    %doc html
    %{_libdir}/pkgconfig/dparse.pc
    %{_includedir}/d/dparse
    %{_libdir}/%{base_name}.so
    
    %files geany-tags
    %{_datadir}/geany/tags/%{base_name}.d.tags
    
    
    %changelog
    %autochangelog

    Note:
    %meson and %meson_build are variables evaluated at build time, below their values on my computer

    $ rpm --eval %meson
    
        
      CFLAGS="${CFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CFLAGS ; 
      CXXFLAGS="${CXXFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection}" ; export CXXFLAGS ; 
      FFLAGS="${FFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FFLAGS ; 
      FCFLAGS="${FCFLAGS:--O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/lib64/gfortran/modules}" ; export FCFLAGS ; 
      LDFLAGS="${LDFLAGS:--Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 }" ; export LDFLAGS ; 
      LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-/usr/lib64:}" ; export LT_SYS_LIBRARY_PATH ; 
      CC="${CC:-gcc}" ; export CC ; 
      CXX="${CXX:-g++}" ; export CXX 
        /usr/bin/meson --buildtype=plain --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/libexec --bindir=/usr/bin --sbindir=/usr/sbin --includedir=/usr/include --datadir=/usr/share --mandir=/usr/share/man --infodir=/usr/share/info --localedir=/usr/share/locale --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib --wrap-mode=nodownload --auto-features=enabled . redhat-linux-build
    $ rpm --eval %meson_build
    
        /usr/bin/meson compile -C redhat-linux-build -j 12 --verbose
    

    some of those flags are useless for D, they are always provided at rpm build time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions