Closed Bug 340971 Opened 14 years ago Closed 14 years ago

Clean up Sunbird build and prefs for l10n/langpacks

Categories

(Calendar :: Sunbird Only, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
Sunbird 0.3

People

(Reporter: mattwillis, Assigned: mattwillis)

References

Details

Attachments

(1 file, 1 obsolete file)

We need to do some Makefile and prefs.js cleanup to allow Sunbird to use langpacks properly.

We also need to add a couple things for building Sunbird langpacks
Attachment #225008 - Flags: first-review?(mvl)
For clarity:

 langpack-%:
 	@echo "Making langpack $(LANGPACK_FILE)"
+	$(NSINSTALL) -D $(DIST)/install

is needed as the dist/install directory otherwise doesn't exist yet and the final zip of the langpack fails. bsmedberg said this target probably hadn't been tested without running installer-ab-CD first.


calendar/locales/generic/install.rdf
is used as a template for a langpack's install.rdf

calendar/sunbird/app/profile/prefs.js
is the template for user prefs.

calendar/sunbird/app/profile/Makefile.in 
is removed and its targets added to .../sunbird/app/Makefile.in
This syncs us with Ff and Tb. 
It also stops creating /profile/US directories, which bsmedberg says are old Netscape remnants that we don't need anymore.


Index: calendar/sunbird/app/Makefile.in
===================================================================

-DIRS		= profile/extensions profile
+DIRS = profile/extensions

calendar/sunbird/app/profile/Makefile.in 
is removed and its targets added to .../sunbird/app/Makefile.in
This syncs us with Ff and Tb. 
It also stops creating /profile/US directories, which bsmedberg says are old Netscape remnants that we don't need anymore.


+# hardcode en-US for the moment
+AB_CD = en-US
+DEFINES += -DAB_CD=$(AB_CD)
+
+APP_VERSION = $(SUNBIRD_VERSION)
+DEFINES += -DAPP_VERSION="$(APP_VERSION)"
+
+APP_UA_NAME = $(shell echo $(MOZ_APP_DISPLAYNAME) | sed -e's/[^A-Za-z]//g')
+DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)"

New l10n related stuff.


-APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
-DEFINES += -DAPP_VERSION="$(APP_VERSION)"

One more place to use $SUNBIRD_VERSION instead


-APP_NAME = Sunbird
+APP_NAME = $(MOZ_APP_DISPLAYNAME)

Use the appname we were passed from configure
 
-libs:: $(PROGRAM)
+AB_CD = $(MOZ_UI_LOCALE)
+
+AB := $(firstword $(subst -, ,$(AB_CD)))
+
+clean clobber repackage::
+	rm -rf $(DIST)/$(APP_NAME).app
+
+libs repackage:: $(PROGRAM)
 	mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
-	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
+	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app  --exclude English.lproj
+	mkdir -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
+	rsync -a --exclude CVS $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
 	sed -e "s/@APP_VERSION@/$(APP_VERSION)/" -e "s/@APP_NAME@/$(APP_NAME)/" -e "s/@MAC_CREATOR_CODE@/$(MAC_CREATOR_CODE)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
 	rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/MacOS
 	rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS/mangle $(DIST)/$(APP_NAME).app/Contents/MacOS/shlibsign
 	rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
 	-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/MacOS
 	cp -RL $(DIST)/branding/sunbird.icns $(DIST)/$(APP_NAME).app/Contents/Resources/sunbird.icns
 	echo -n APPL$(MAC_CREATOR_CODE) > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
 #	remove CVS dirs from packaged app
 	find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
 
-clean clobber::
-	rm -rf $(DIST)/$(APP_NAME).app

Bunch of Mac packaging adjustments for l10n and making langpacks and such.



 libs::
 	$(INSTALL) $(README_FILE) $(DIST)/bin
-	$(INSTALL) $(topsrcdir)/LICENSE	$(DIST)/bin
+	$(INSTALL) $(topsrcdir)/LICENSE $(DIST)/bin

Removed errant tab

+
+libs:: $(srcdir)/profile/prefs.js
+	$(INSTALL) $^ $(DIST)/bin/defaults/profile
+
+install:: $(srcdir)/profile/prefs.js
+	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile

Targets originally handled by .../sunbird/app/profile/Makefile.in


Index: calendar/sunbird/app/profile/sunbird.js
===================================================================
-pref("general.useragent.locale", "chrome://global/locale/intl.properties");
-pref("general.useragent.contentlocale", "chrome://browser-region/locale/region.properties");
-#expand pref("general.useragent.extra.sunbird", "Mozilla Sunbird/__APP_VERSION__");
+pref("general.useragent.locale", "@AB_CD@");
+pref("general.skins.selectedSkin", "classic/1.0");
+pref("general.useragent.extra.sunbird", "@APP_UA_NAME@/@APP_VERSION@");

Sets the initial display locale. This is critical to allow users to change locales via the Add-ons Manager. Also unhardcodes app name in useragent.

rev1 also removes a couple unrelated whitespace or ordering changes from rev0.
Attachment #225008 - Attachment is obsolete: true
Attachment #225032 - Flags: first-review?(mvl)
Attachment #225008 - Flags: first-review?(mvl)
Comment on attachment 225032 [details] [diff] [review]
rev1 - Added missing prefs.js file

>Index: calendar/locales/Makefile.in
>+	$(NSINSTALL) -D $(DIST)/install
browser/locales/Makefile.in doesn't have this line. Why do we need it?

>Index: calendar/sunbird/app/Makefile.in
>-DIRS		= profile/extensions profile
>+DIRS = profile/extensions
Drop the whitespace change, please

>+# hardcode en-US for the moment
>+AB_CD = en-US
eww, temporary things. If possible, just do the right thing here.
(In reply to comment #4)
> >+	$(NSINSTALL) -D $(DIST)/install
> browser/locales/Makefile.in doesn't have this line. Why do we need it?

Without it, if you try to make the langpack-ab-CD target, it will fail as /objdir/dist/install hasn't been created yet, and zip tries to put a file there.

I checked with bsmedberg before adding it, and he said it likely is because folks had only made the installer-ab-CD target, not the langpack-ab-CD one alone. This line ensures the target works, and will cause no problems if the dir already exists.

> >Index: calendar/sunbird/app/Makefile.in
> >-DIRS		= profile/extensions profile
> >+DIRS = profile/extensions
> Drop the whitespace change, please
It's not just a whitespace change. I'm removing profile from DIRS, and since that line has to change, I took out the unneeded tabs at the same time. 

> > >+# hardcode en-US for the moment
> >+AB_CD = en-US
> eww, temporary things. If possible, just do the right thing here.

We start with en-US. If we're passed another locale, we'll use it.
This is what browser already does.

(In reply to comment #5)
> Without it, if you try to make the langpack-ab-CD target, it will fail as
> /objdir/dist/install hasn't been created yet, and zip tries to put a file
> there.

But still, why doesn't firefox need it?
And do you need to be able to build the langpack-ab-CD target?

> > Drop the whitespace change, please
> It's not just a whitespace change. I'm removing profile from DIRS, and since
> that line has to change, I took out the unneeded tabs at the same time. 
Makefiles usually do have tabs, so just leave this one in. It's fine.
(In reply to comment #6)
> But still, why doesn't firefox need it?
Firefox _should_ have it. I would consider it a bug.

> And do you need to be able to build the langpack-ab-CD target?
Building the langpack-ab-CD target is a good, quick way to test whether a particular locale has all the localized files necessary. It should work, and this fixes it.


> Makefiles usually do have tabs, so just leave this one in. It's fine.
Will do on commit.
Status: NEW → ASSIGNED
Comment on attachment 225032 [details] [diff] [review]
rev1 - Added missing prefs.js file

ok, r=mvl
Attachment #225032 - Flags: first-review?(mvl) → first-review+
Patch checked in on MOZILLA_1_8_BRANCH and trunk.

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Blocks: 331919
You need to log in before you can comment on or make changes to this bug.