Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to Install Glibc With Only 1 Locale
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Vlad
Apprentice
Apprentice


Joined: 09 Apr 2002
Posts: 264
Location: San Diego, California

PostPosted: Sun Apr 14, 2002 9:22 am    Post subject: How to Install Glibc With Only 1 Locale Reply with quote

Howto Install Glibc With Only 1 Locale

Preface
This is to best done during system installation, not after a system has already been built. I haven't tried doing it on a system that's already up, so take care if you want to try it. This is designed to shave time off of the bootstrap process by removing the numerous locales which are installed by default (and the vast majority of us will never use). Also take care to research which locale you're in; I do not at this time know the commands involved to install different locales (other than US English).

1. Just before bootstrapping, determine which version of glibc is going to be installed:
Code:
# emerge --pretend glibc

These are the packages that I would merge, in order.

Calculating dependencies ...done!
[ebuild  N   ] sys-libs/glibc-2.2.5-r2 to /
Take note of the version you are installing; you must edit the correct ebuild script in order to make the changes successfully. In this example, the version is 2.2.5-r2.


2. Edit the ebuild script:
Code:
# nano -w /usr/portage/sys-libs/glibc/glibc-version.ebuild


3. Search (Control+w) for "localedata". Add a "#" in the front of the line to comment it out.
This is what the line looks like in 2.2.5-r2:
Code:
 make PARALLELMFLAGS="${MAKEOPTS}" install_root=${D} localedata/install-locales -C buildhere || die


4. Below the line you just commented out, add the following:
Code:
localedef --prefix=${D} -i en_US -f ISO-8859-1 en_US
Change the locale as needed; this example shows US English.


5. Save the build script (Control+O) and exit (Control+X). Change any compiler flags in /etc/make.conf (if you so wish) and make sure you are in /usr/portage to run the bootstrap.


6. Begin the bootstrap by issuing the command:
Code:
# scripts/bootstrap.sh
This command will NOT work if you are not in the /usr/portage directory!

*Note: If you are on a dialup or slower connection, you can download the files you need to bootstrap by using the following command:
Code:
# emerge -f glibc binutils gcc zlib

(I believe that's all of them; if it's not, will someone let me know please? :))

This will download glibc, binutils, gcc, and zlib, as well as all dependencies. Doing this will prevent your connection from accidently disconnecting after being idle between wgets, and help minimalize the chance that someone will goof up your internet connection. This works great if you bootstrap before bedtime; just do make the changes in your ebuild scripts, make sure you're in /usr/portage, and issue the command:
Code:
# emerge -f glibc binutils gcc zlib && scripts/bootstrap.sh
Don't worry; if your downloads fail; your bootstrap will NOT be done.[/b]
Back to top
View user's profile Send private message
Kream
n00b
n00b


Joined: 19 Apr 2002
Posts: 30
Location: New Delhi, India

PostPosted: Wed Dec 11, 2002 9:00 pm    Post subject: Reply with quote

Thanks for the great tip !!! :D
Back to top
View user's profile Send private message
toliman
n00b
n00b


Joined: 08 Aug 2002
Posts: 14
Location: Melbourne, AU

PostPosted: Thu Dec 12, 2002 1:21 am    Post subject: Reply with quote

if you would also like to strip locales you have previously installed, there is a masked program called localepurge in the portage tree, janneand added this small python app in a thread about removing locale files to save space

from https://forums.gentoo.org/viewtopic.php?t=24687

Code:

#!/usr/bin/env python

# file: clean_locale
# Script to remove unwanted translations.

import os, commands

# Add directories to save here:
exclude = ['locale.alias', 'C', 'POSIX', 'US_ASCII']

path = "/usr/share/locale"

dirs = os.listdir(path)
for dir in dirs:
   if dir not in exclude:
      print "Removing %s/%s..." % (path, dir)
      (err, output) = commands.getstatusoutput('rm -rf %s/%s' % (path, dir))
      if err:
         print "Could not remove %s/%s: %s" % (path, dir, output)
Back to top
View user's profile Send private message
diper
n00b
n00b


Joined: 02 Jan 2003
Posts: 1

PostPosted: Thu Jan 02, 2003 8:12 pm    Post subject: Re: How to Install Glibc With Only 1 Locale Reply with quote

I tried the trick shown below in a running installation (not one before the bootstrap stage) and found localedef would not generate the directories under /usr/lib/locale like en_US fr_FR , etc. It only generates the file locale-archive, with the requested locales inside. my questions are:

Is this new?
Is this fine?
Is this a problem? is so, any clue on how to solve it?
are those directories under /usr/lib/locale needed or all the info is kept in the locale-archive file?

Regards.

Diper



Vlad wrote:
Howto Install Glibc With Only 1 Locale

Preface
This is to best done during system installation, not after a system has already been built. I haven't tried doing it on a system that's already up, so take care if you want to try it. This is designed to shave time off of the bootstrap process by removing the numerous locales which are installed by default (and the vast majority of us will never use). Also take care to research which locale you're in; I do not at this time know the commands involved to install different locales (other than US English).

1. Just before bootstrapping, determine which version of glibc is going to be installed:
Code:
# emerge --pretend glibc

These are the packages that I would merge, in order.

Calculating dependencies ...done!
[ebuild  N   ] sys-libs/glibc-2.2.5-r2 to /
Take note of the version you are installing; you must edit the correct ebuild script in order to make the changes successfully. In this example, the version is 2.2.5-r2.


2. Edit the ebuild script:
Code:
# nano -w /usr/portage/sys-libs/glibc/glibc-version.ebuild


3. Search (Control+w) for "localedata". Add a "#" in the front of the line to comment it out.
This is what the line looks like in 2.2.5-r2:
Code:
 make PARALLELMFLAGS="${MAKEOPTS}" install_root=${D} localedata/install-locales -C buildhere || die


4. Below the line you just commented out, add the following:
Code:
localedef --prefix=${D} -i en_US -f ISO-8859-1 en_US
Change the locale as needed; this example shows US English.


5. Save the build script (Control+O) and exit (Control+X). Change any compiler flags in /etc/make.conf (if you so wish) and make sure you are in /usr/portage to run the bootstrap.


6. Begin the bootstrap by issuing the command:
Code:
# scripts/bootstrap.sh
This command will NOT work if you are not in the /usr/portage directory!

*Note: If you are on a dialup or slower connection, you can download the files you need to bootstrap by using the following command:
Code:
# emerge -f glibc binutils gcc zlib

(I believe that's all of them; if it's not, will someone let me know please? :))

This will download glibc, binutils, gcc, and zlib, as well as all dependencies. Doing this will prevent your connection from accidently disconnecting after being idle between wgets, and help minimalize the chance that someone will goof up your internet connection. This works great if you bootstrap before bedtime; just do make the changes in your ebuild scripts, make sure you're in /usr/portage, and issue the command:
Code:
# emerge -f glibc binutils gcc zlib && scripts/bootstrap.sh
Don't worry; if your downloads fail; your bootstrap will NOT be done.[/b]
Back to top
View user's profile Send private message
bone
Apprentice
Apprentice


Joined: 07 Jun 2002
Posts: 255
Location: Midwest, USA

PostPosted: Tue Apr 22, 2003 1:31 pm    Post subject: Reply with quote

I started to do the rebuild of glibc with the localedata stripped down, but decided to try the ebuild localepurge instead. I am sure glad i did as I just noticed the previous post about someone trying it after bootstrap and it not working entirely. See great output from localepurge below.

Total disk space freed by localepurge: 79832K

:lol:
Back to top
View user's profile Send private message
johnjohn
n00b
n00b


Joined: 15 Apr 2002
Posts: 5

PostPosted: Thu Jun 26, 2003 2:01 am    Post subject: Re: How to Install Glibc With Only 1 Locale Reply with quote

Vlad you bastard, you never did give me credit for walking you through this on irc. I, on the other hand, am happy to give credit to the Linux From Scratch gang from whom I first learned this space-saving procedure.

Vlad wrote:
Howto Install Glibc With Only 1 Locale

*Note: If you are on a dialup or slower connection, you can download the files you need to bootstrap by using the following command:
Code:
# emerge -f glibc binutils gcc zlib

(I believe that's all of them; if it's not, will someone let me know please? :))

This will download glibc, binutils, gcc, and zlib, as well as all dependencies. Doing this will prevent your connection from accidently disconnecting after being idle between wgets, and help minimalize the chance that someone will goof up your internet connection.


These days, of course, bootstrap recognizes the --fetchonly flag, so you can just:
Code:
# /usr/portage/scripts/bootstrap.sh -f


Quote:
This works great if you bootstrap before bedtime; just do make the changes in your ebuild scripts, make sure you're in /usr/portage, and issue the command:
Code:
# emerge -f glibc binutils gcc zlib && scripts/bootstrap.sh
Don't worry; if your downloads fail; your bootstrap will NOT be done.[/b]


Now all you need to do is:
Code:
# cd /usr/portage
# ./scripts/bootstrap -f && ./scripts/bootstrap.sh


And for those of you who like everything downloaded at once:
Code:
 ./scripts/bootstrap.sh -f && emerge -f system && USE="-gtk -gnome -X" emerge -f vim screen gentoolkit ccache && time ./scripts/bootstrap.sh


That ought to keep the "slow connection, fast computer" crowd going for a while.
_________________
This is a bloc of text that can be added to posts you make. Please be sure to change this before posting, or risk looking very, very foolish
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum