
# Included from file macros.intro/macros.intro
# Introduced for ALT Linux macros.
# Collected by Vitaly Lipatov <lav@etersoft.ru>
# I guess these macros are not defined in Sisyphus in the package build time
# These macros will be packed in rpm-build-intro package

# NOTE!
# Don't forget copy the same to macros.intro.backport

# for discussion:
%make_install_std %makeinstall_std

# If macros is component related (like kde, java, perl), use name like %name_somedir
# If macros for some dir, use name like %_omfdir

%kde_docdir %_docdir/HTML
%gtk_docdir %_datadir/gtk-doc/html
%java_dir %_datadir/java
%java_docdir %_datadir/javadoc

%_kdedocdir %_docdir/HTML
%_gtkdocdir %_datadir/gtk-doc/html
%_javadir %_datadir/java
%_javadocdir %_datadir/javadoc

# various for prev. distro...
# FIXME: on other platforms only
%rpmcflags %optflags
# due error on SUSE
#%rpmldflags %nil
%rpmcxxflags %optflags

# Normalize source file permissions
%fix_permissions \
find ./ -type d -print0 | xargs -0 chmod 0775 \
find ./ -type f -print0 | xargs -0 chmod 0664

# Remove unneeded repository info (since rpm-build-compat 1.5)
%remove_repo_info \
find ./ -type d -name .svn -print0 | xargs -0 --no-run-if-empty rm -rf {} \; \
find ./ -type d -name CVS -print0 | xargs -0 --no-run-if-empty rm -rf {} \;

# macro for init scripts configs (/etc/default in Debian/Ubuntu)
%_sysconfigdir %_sysconfdir/sysconfig

# 32bit libs placement dir (inside 64bit package too)
%_lib32dir %_prefix/lib

# path to /etc/sudoers extension dir
%_sudoersdir %_sysconfdir/sudoers.d

# cups lib dir
%_cupslibdir %_prefix/lib/cups


# Included from file macros.intro/macros.intro.backport
# Introduced for ALT Linux and already applied in Sisyphus macros
# Collected by Vitaly Lipatov <lav@etersoft.ru>
# These macros will be packed in rpm-build-compat package (only on ALT)

# introduced since rpm-4.0.4-alt98.28
# https://bugzilla.altlinux.org/show_bug.cgi?id=22710
%_aclocaldir %_datadir/aclocal
# Subsys dir placed in various dirs
%_locksubsysdir %_var/lock/subsys


# introduced 23.12.2008 in rpm 4.0.4-alt96.13 as
# %_rpmmacrosdir    %_rpmlibdir/macros.d
%_rpmmacrosdir %_sysconfdir/rpm/macros.d

# introduced in rpm 4.0.4-alt83
# https://bugzilla.altlinux.org/show_bug.cgi?id=13925
%autoreconf %__autoreconf

# introduced in rpm 4.0.4-alt55
#  + Add macros: %_desktopdir, %_pixmapsdir (#8767)
%_desktopdir %_datadir/applications
%_pixmapsdir %_datadir/pixmaps

# introduced in rpm 4.0.4-alt54
#  + Added %__autoreconf macro (#8307)
%__autoreconf autoreconf -fisv

# introduced in rpm 4.0.4-alt42
%_x11x11dir %{_x11dir}/lib/X11
%_pkgconfigdir %{_libdir}/pkgconfig

# from mdk
%makeinstall_std %make_install DESTDIR=%buildroot install

# 
%_omfdir %_datadir/omf

# add in rpm-build-python 0.33.1-alt1
# https://bugzilla.altlinux.org/show_bug.cgi?id=13941
%python_build	\
	%__python setup.py build
%python_install	\
	%__python setup.py install --skip-build --root=%buildroot
# TODO: need to be add
%python_check %__python setup.py check

# Included from file macros.distro/macros.alt
# Platform and version dependend macros (ALT Linux only)
# These macros introduced for ALT and packed for ALT Linux only
# These macros will packed in rpm-build-intro package on ALT

# Start service only after manual install
# this case is never run due no tty under rpm process install
# 1 - 1st install, 2 - update package
%start_service() \
        false && [ -z "$DURING_INSTALL" ] && [ "$1" = "1" ] && %_initddir/%{1} start || : \
%nil

# PLD compatibility
%groupadd /usr/sbin/groupadd -r -f
%useradd /usr/sbin/useradd -r
#%userremove userdel
#%groupremove groupdel


# Included from file macros.distro/macros.alt.4.1
# Platform and version dependend macros
# These macros will packed in rpm-build-compat package on ALT

# Prepare cmake build (since rpm-build-compat 1.4)
%cmake \
mkdir build; cd build; \
cmake .. \\\
    -DCMAKE_INSTALL_PREFIX=%prefix \\\
    -DLIB_DESTINATION=%_lib \\\
  %if "%_lib" == "lib64" \
    -DLIB_SUFFIX="64" \\\
  %else \
    -DLIB_SUFFIX="" \\\
  %endif \
    -DCMAKE_SKIP_RPATH:BOOL=yes \\\
    -DCMAKE_C_FLAGS:STRING='%optflags' \\\
    -DCMAKE_CXX_FLAGS:STRING='%optflags' \
cd -

# _sharedstatedir is broken on ALTLinux p6 and early
# https://bugzilla.redhat.com/show_bug.cgi?id=185862
%_sharedstatedir /var/lib
