Code Monkey home page Code Monkey logo

Comments (2)

WebFreak001 avatar WebFreak001 commented on June 25, 2024

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.

from libdparse.

bioinfornatics avatar bioinfornatics commented on June 25, 2024

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

from libdparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.