#!/bin/bash
ALIAS_FILE="__DATADIR__/locale/locale.alias"
-LOCAR_FILE="__PREFIX__/locale/locale-archive"
+LOCAR_FILE="__PREFIX__/lib/locale/locale-archive"
LOC_PATH="__PREFIX__/lib/locale/"
+SBIN_DIR="__SBINDIR__"
rm -f ${LOCAR_FILE}
if [ ! -d ${LOC_PATH} ]; then
echo "Cannot open directory \"${LOC_PATH}\""
- #exit 1
+ exit 1
+fi
+
+if [ ! -f ${ALIAS_FILE} ]; then
+ echo "Cannot open alias file \"${ALIAS_FILE}\""
+ exit 1
fi
PRIMARY=${LC_ALL}
fi
if [ -d ${PRIMARY} ]; then
- /usr/bin/localedef --alias-file=${ALIAS_FILE} --add-to-archive ${PRIMARY}
+ localedef --alias-file=${ALIAS_FILE} --add-to-archive ${PRIMARY}
fi
fi
-find ${LOC_PATH} -type d | while read loc; do
- /usr/bin/localedef --alias-file=${ALIAS_FILE} --add-to-archive ${loc}
-done
+find ${LOC_PATH} -mindepth 1 -maxdepth 1 -type d -exec localedef --alias-file=${ALIAS_FILE} --add-to-archive {} \;
-exec /usr/sbin/tzdata-update
+exec ${SBIN_DIR}/tzdata-update
Requires: findutils
Requires: coreutils
Requires: tzdata
-#Requires: glibc-common
+Requires: glibc-locale
%description
carring locale information for tizen platform
%{?asan:%gcc_unforce_options}
sed -ie "s#__DATADIR__#%{_datadir}#" $RPM_SOURCE_DIR/tizen-build-locale-archive
sed -ie "s#__PREFIX__#%{_prefix}#" $RPM_SOURCE_DIR/tizen-build-locale-archive
+sed -ie "s#__SBINDIR__#%{_sbindir}#" $RPM_SOURCE_DIR/tizen-build-locale-archive
+sed -ie "s#__DATADIR__#%{_datadir}#" $RPM_SOURCE_DIR/tzdata-update
%install
install -m 0700 $RPM_SOURCE_DIR/tizen-build-locale-archive %{buildroot}%{_sbindir}
install -m 0700 $RPM_SOURCE_DIR/tzdata-update %{buildroot}%{_sbindir}
-mkdir -p %{buildroot}/usr/lib/locale
+mkdir -p %{buildroot}%{_prefix}/lib/locale
CHARSET=UTF-8
-LOCALE_DIR=%{buildroot}/usr/lib/locale
+LOCALE_DIR=%{buildroot}%{_prefix}/lib/locale
mkdir -p $LOCALE_DIR
%if "%{?tizen_profile_name}" == "tv"
I18NPATH=localedata GCONV_PATH=iconvdata localedef --quiet -c -f $CHARSET -i ${LOCALE%%.*} $LOCALE_DIR/$LOCALE
done
-mkdir -p %{buildroot}/usr/share/i18n/
-make -f %{SOURCE10} IN=localedata/SUPPORTED OUT=%{buildroot}/usr/share/i18n/SUPPORTED
+mkdir -p %{buildroot}%{_datadir}/i18n/
+make -f %{SOURCE10} IN=localedata/SUPPORTED OUT=%{buildroot}%{_datadir}/i18n/SUPPORTED
-%post -p /usr/sbin/tizen-build-locale-archive
+%post -p %{_sbindir}/tizen-build-locale-archive
%triggerin -- tzdata
-/usr/sbin/tzdata-update
+%{_sbindir}/tzdata-update
%postun
%posttrans
-ls /usr/lib/locale/ | /bin/grep _ | /usr/bin/xargs -I {} /bin/rm -rf /usr/lib/locale/{}
-rm -rf /usr/lib/locale/C.UTF-8
-find /usr/share/locale/ -name libc.mo | /bin/grep -v en_GB | /usr/bin/xargs -I {} /bin/rm {}
+find %{_prefix}/lib/locale/ -name "*_*" -delete
+find %{_prefix}/lib/locale/ -name "C.UTF-8" -delete
+find %{_datadir}/locale/ -not -path "*/en_GB/*" -name "libc.mo" -delete
%clean
rm -rf "$RPM_BUILD_ROOT"
%defattr(-,root,root)
%license COPYING COPYING.LIB
%{_prefix}/lib/locale/*
-%attr(0644,root,root) %config %{_prefix}/share/i18n/SUPPORTED
+%attr(0644,root,root) %config %{_datadir}/i18n/SUPPORTED
%{_sbindir}/tizen-build-locale-archive
%{_sbindir}/tzdata-update
%manifest tizen-locale.manifest